Financial contract 2 - Average annual return computed in two ways.
2 ビュー (過去 30 日間)
古いコメントを表示
First i calculate the the average annual return for the Dow jones industrial average over the last 22 years by using the first and last value.
To continue writing my code i also need to calculate the average return between two days separated by one year for every day over the last 22 years.
Shouldnt these two numbers be the same?
clear
fid = fopen( 'DJ30Daily.csv', 'r' );
str = fread( fid, '*char' );
sts = fclose( fid );
str( str == '"' ) = [];
str( str == ',' ) = '.';
cac = textscan( str, '%f' );
DJ30Daily = cell2mat(cac);
DJ30Daily = DJ30Daily(121:5668);
n=length(DJ30Daily);
K=DJ30Daily(n)-DJ30Daily(1);
P=(K/DJ30Daily(1));
AverageAnnualReturnPercentLast22y = nthroot(P, 22)
m=252-1;
d=n-m;
Ptot=0;
for i=1:d
K2=DJ30Daily(i+m)-DJ30Daily(i);
P2=K2/DJ30Daily(i);
P2=P2+1;
Ptot=Ptot+P2;
end
AverageReturnBetweenDaysSepartedBy1yearOverTheLast 22years=Ptot/d
****************************
AverageAnnualReturnPercentLast22y =
1.0575
AverageReturnBetweenDaysSepartedBy1yearOverTheLast 22years =
1.0863
0 件のコメント
回答 (1 件)
Javier
2012 年 9 月 10 日
Hello CapaB
I think you are confuse. Lets put some numbers in return calculation.
Price Annual Return
Year 1 1000
Year 2 900 -0.1
Year 3 950 0.056
Year 4 1000 0.0526
Year 5 1050 0.05
A 5 years holding investment says that you win 5%. Then, if you compound annually the return, you will get the same return. (1-0.1)*(1.056)*(1.0526)*(1.05)-1 = 5%
Just remember that Arithmetic return, geometric return and harmonic return estimations, will give you different results: Arith > Geometric > Harmonic (google it for examples).
Hope it helps. Best regards.
Javier
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Low-Level File I/O についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!