• API
• FAQ
• Tools
• Archive
daily pastebin goal
3%
SHARE
TWEET

# Untitled

a guest Oct 12th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. %% Import Monthly Dates and Rates from the CRSP Index
4.
5. for iRowsMonthlyCrsp = 1:numel(datesMonthlyCrsp)
6.    date = datesMonthlyCrsp(iRowsMonthlyCrsp);
7.    rate = ratesMonthlyCrsp(iRowsMonthlyCrsp);
8.
9.    stringDate = num2str(date);
10.    dateResult = datestr( datenum(stringDate,'yyyymmdd') );
11.
12.    fprintf('%d dates: %s rates: %s \n', iRowsMonthlyCrsp, dateResult, rate);
13. end
14. %% Convert to correct timeline (Jan 1962 - Des 2016)
15.
16. convRatesMonthlyCrsp = ratesMonthlyCrsp(434:1093);
17.
18. xYearsMonths = datetime(1962,1:660,1);
19.
20. plot(xYearsMonths,convRatesMonthlyCrsp);
21.
22.
23.
24. %% Convert convRatesMonthlyCrsp to convRatesAnnuallyCrsp
25. xx = datetime(1962:2016,12,31)'
26. x = convRatesMonthlyCrsp;
27. convRatesAnnuallyCrsp = sum(reshape(x,12,[]))';
28.
29. plot(xx,convRatesAnnuallyCrsp)
30. %% Calculate Mean Annually
31.
32. meanAnnually = mean(convRatesAnnuallyCrsp);
33.
34. %% Calculate Standard Deviation Annually
35.
36. StdAnnually = std(convRatesAnnuallyCrsp);
37.
38. %Exercise 1B)
39. %%
42.
43. for iRowsMonthlyCpi = 1:numel(datesMonthlyCpi)
44.    date1 = datesMonthlyCpi(iRowsMonthlyCpi);
45.    rate1 = ratesMonthlyCpi(iRowsMonthlyCpi);
46.
47.    stringDate1 = num2str(date1);
48.    dateResult1 = datestr( datenum(stringDate1,'yyyymmdd') );
49.
50.    fprintf('%d dates: %s rates: %s \n', iRowsMonthlyCpi, dateResult1, rate1)
51. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top