# Financial contract 2 - Average annual return computed in two ways.

3 views (last 30 days)
CapaB on 22 Jun 2012
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

Javier on 10 Sep 2012
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