Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
braverock
GitHub Repository: braverock/portfolioanalytics
Path: blob/master/sandbox/RFinance2014/data_prep.R
1433 views
1
2
##### Equity Data for Example 1 and Example 2 #####
3
load("data/crsp_weekly.rda")
4
5
equity.data <- cbind(largecap_weekly[,1:15],
6
midcap_weekly[,1:15],
7
smallcap_weekly[,1:5])
8
market <- largecap_weekly[,21]
9
Rf <- largecap_weekly[,22]
10
11
##### edhec Data for Example 3 and Example 4 #####
12
# Load the updated edhec dataset
13
load("data/edhec.rda")
14
15
# Prep data for Examples 3 and 4
16
R <- edhec[,c("Convertible.Arbitrage", "Equity.Market.Neutral",
17
"Fixed.Income.Arbitrage",
18
"CTA.Global", "Emerging.Markets", "Global.Macro")]
19
# Abreviate column names for convenience and plotting
20
colnames(R) <- c("CA", "EMN", "FIA", "CTAG", "EM", "GM")
21
22
23
# clean up and remove the data we don't need
24
rm(largecap_weekly, midcap_weekly, smallcap_weekly, microcap_weekly)
25
rm(edhec)
26
27