I have a set of sample time-series data below of monthly prices for two companies.
Q1. I want to calculate monthly and quarterly log returns.what is the most expedient way to do this? TimeSeriesAggregate[]
only has the standard Mean
, etc.
Q2. With the returns from Q1, what is the most expedient method to calculate the correlation of the monthly returns between the two companies?
Q3. How would it be possible to calculate six-monthly log returns and then create a series of overlapping $6m \log$ returns so I can derive $7\times 6M$ outcomes from the limited dataset below; i.e. [1m-6m, 2m-7m, 3m-8m, ...]
(and then calculate a correlation between these)?
(data1 = {{Date, CompanyA, CompanyB}, {"16/01/2007", 3655,
1000}, {"16/02/2007", 3655, 1000}, {"16/03/2007", 3655,
1000}, {"16/04/2007", 3655, 1000}, {"16/05/2007", 3655,
1000}, {"16/06/2007", 3435, 1011}, {"16/07/2007", 3528,
1012}, {"16/08/2007", 3348, 1013}, {"16/09/2007", 3648,
1022}, {"16/10/2007", 3648, 1022}, {"16/11/2007", 3648,
1022}, {"16/12/2007", 3648, 1022}});
(data2 = MapAt[DateList[{#, {"Day", "Month", "Year"}}] &,
data1, {2 ;;, 1}]) // Grid
Thanks