MATLAB Answers

Hello! i have been given a task to find monthly log return time series and then aggregate each to an annual log return series. but every code i use, follows with an error. how do i convert the data to annual the easiest possible way?

2 views (last 30 days)
Khuzaima Ahmad
Khuzaima Ahmad on 29 Sep 2018
Answered: Peter Perkins on 1 Oct 2018
This is the code i used to find monthly log returns:
RFRmonthly = readtable('22RFR-monthly.xlsx');
RFRmonthly.Properties.VariableNames{1} = 'Time';
RFRmonthly.Properties.VariableNames{2} = 'Index';
RFR_Monthly = 2 * log(RFRmonthly.Index./ lagmatrix(RFRmonthly.Index,1));

  0 Comments

Sign in to comment.

Answers (2)


Peter Perkins
Peter Perkins on 1 Oct 2018
If the question is, "how do i convert the data to annual the easiest possible way?", the answer is to import using readtable (Check!) then convert using table2timetable and call retime with 'yearly' as the new time basis. I guess you want to get the last value in each year, or interpolate; I don't thnk you want to aggregate in the sense of sum. So something like
ttAnnual = retime(ttMonthly,'yearly','lastvalue')
but I'm just guessing. The I guess you'd lag that, divide the original price by the lagged price, and log.
I believe that the Financial Toolbox has a function called tick2ret, if you have access to that.

  0 Comments

Sign in to comment.