Calculate 10y returns out of monthly data
显示 更早的评论
hey guys,
i have monthly returns (1mil. simulations). Now i want to calculate corresponding 10 year returns. for example vextor x: 0.05 0.02 0.03 0.4 -0.21 ...
what matlab should do now is to calculate: ((1+r(1))*(1+r(2))*...(1+r(120)))-1 and ((1+r(121))*(1+r(122))*...(1+r(240)))-1 and so on...
thx for your help
采纳的回答
更多回答(1 个)
Roger Wohlwend
2014-10-24
y = exp(filter(ones(120,1),1,log(1+r)))-1;
y = y(120:end);
2 个评论
Markus
2014-10-24
Roger Wohlwend
2014-10-24
Oh, my mistake.
y = exp(filter(ones(120,1),1,log(1+r)))-1;
y = y(120:120:end);
类别
在 帮助中心 和 File Exchange 中查找有关 Language Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!