| New Reply |
Financial contract 2 - Average annual return computed in two ways. |
Share Thread | Thread Tools |
| Jun21-12, 10:13 AM | #1 |
|
|
Financial contract 2 - Average annual return computed in two ways.
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 AverageReturnBetweenDaysSepartedBy1yearOverTheLast22years=Ptot/d ****************************** AverageAnnualReturnPercentLast22y = 1.0575 AverageReturnBetweenDaysSepartedBy1yearOverTheLast22years = 1.0863 |
| New Reply |
| Thread Tools | |
Similar Threads for: Financial contract 2 - Average annual return computed in two ways.
|
||||
| Thread | Forum | Replies | ||
| Financial contract | Math & Science Software | 0 | ||
| When does return on interest, equal your annual principle savings | Calculus | 8 | ||
| Finding annual rate of return | Biology, Chemistry & Other Homework | 1 | ||
| Average annual angle (Earth lattitude) | Introductory Physics Homework | 2 | ||