Load Packages
require(quantmod)
## Loading required package: quantmod
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: TTR
## Version 0.4-0 included new data defaults. See ?getSymbols.
require(ggplot2)
## Loading required package: ggplot2
require(MASS)
## Loading required package: MASS
require(reshape2)
## Loading required package: reshape2
getRisk <- function(graphDate, ticks, t_bill_rate){
startDate = as.Date(paste0(graphDate, "-1-1"))
endDate = as.Date(paste0(graphDate, "-12-31"))
getSymbols(ticks, src = "yahoo", from = startDate, to = endDate)
## merge
dataset <- dailyReturn(get(ticks[1]))
for (i in 2:length(ticks)) {
dataset <- merge(dataset, dailyReturn(get(ticks[i])))
}
names(dataset) <- ticks
# [VFINX, VBTIX, VGSIX]
dataset_col_mean <- colMeans(dataset[graphDate])
f_num <- numeric(length(ticks))
f_num <- f_num + 1/length(ticks)
f <- as.matrix(f_num)
dataset_col_mean_m <- as.matrix(dataset_col_mean)
t(f) %*% dataset_col_mean_m
# big V 2011
dataset_m <- as.matrix(dataset[graphDate])
V <- cov(as.matrix(dataset[graphDate]),as.matrix(dataset[graphDate]))
V_matrix <- as.matrix(V)
#var 2010
f <- as.matrix(f)
v <- t(f) %*% V_matrix %*% f
#sd 2010
sqrt(v)
#coefficients
ones <- numeric(length(ticks))
ones <- ones + 1
ones <- as.vector(ones)
a <- t(ones)%*%solve(V)%*%ones
b <- t(ones)%*%solve(V)%*%as.matrix(colMeans(dataset[graphDate]))
c <- t(as.matrix(colMeans(dataset[graphDate])))%*%solve(V)%*%as.matrix(colMeans(dataset[graphDate]))
## frontier parameters
sig_mv <- 1/sqrt(a)
sig_mv <- as.numeric(sig_mv)
mu_mv <- b/a
v_as <- sqrt((a*c-b^2)/a)
### plots
upper <-function(s) mu_mv + v_as*sqrt((s^2) - (sig_mv^2))
lower <-function(s) mu_mv - v_as*sqrt((s^2) - (sig_mv^2))
# old plot stuff
#nums <- seq(sig_mv, sig_mv+sig_mv, sig_mv/10)
#risk <- c(nums, nums)
#reward <- c(lower(nums), upper(nums))
#fmv <- (sig_mv^2)*ginv(V_matrix)%*%ones
# including rf
mu_si <- t_bill_rate
mu_cl <- t_bill_rate + 0.03
v_st <- v_as*sqrt(1 + ((mu_mv - mu_si)/(v_as*mu_mv))^2)
v_ct <- v_as*sqrt(1 + ((mu_mv - mu_cl)/(v_as*mu_mv))^2)
sig_st <- sig_mv*sqrt(1 + ((v_as*sig_mv)/(mu_mv - mu_si))^2)
sig_ct <- sig_mv*sqrt(1 + ((v_as*sig_mv)/(mu_mv - mu_cl))^2)
# mu eff 0 to mu_st
sig_lower <- seq(0,sig_st, length=3)
mu_eff_lower <- mu_si + v_st*sig_lower
# mu eff sig_st to sig_ct
sig_mid <- seq(sig_st, sig_ct, length=3)
mu_eff_mid <- mu_mv + v_as*sqrt(sig_mid^2 - sig_mv^2)
# mu eff sig_ct to inf
sig_upper <- seq(sig_ct, 1.3*sig_ct, length=3)
mu_eff_upper <- mu_cl + v_ct*sig_upper
upper <-function(s) mu_mv + v_as*sqrt((s^2) - (sig_mv^2))
lower <-function(s) mu_mv - v_as*sqrt((s^2) - (sig_mv^2))
nums <- seq(sig_mv, sig_mv+sig_mv, sig_mv/10)
risk <- c(nums, nums)
reward <- c(lower(nums), upper(nums))
#fmv <- (sig_mv^2)*ginv(V_matrix)%*%ones
#stacked df
mu_eff <- cbind(mu_eff_lower, mu_eff_mid, mu_eff_upper)
mu_eff_melt <- melt(mu_eff)
risk_levels <- cbind(sig_lower, sig_mid, sig_upper)
risk_levels_melt <- melt(risk_levels)
#new plot stuff
risk_rf <- risk_levels_melt[3]
reward_rf <- mu_eff_melt[3]
#f values min
# return means
mu_st <- mu_mv + (v_as^2)*(sig_mv^2)/(mu_mv - mu_si)
mu_ct <- mu_mv + (v_as^2)*(sig_mv^2)/(mu_mv - mu_cl)
fst <- as.numeric(((sig_mv^2)/(mu_mv-mu_si)))*ginv(V_matrix)%*%(dataset_col_mean_m - mu_si*ones)
fct <- as.numeric(((sig_mv^2)/(mu_mv-mu_cl)))*ginv(V_matrix)%*%(dataset_col_mean_m - mu_cl*ones)
#f lower
f_lower <- (sig_lower/sig_st)*fst
mu_ct <- as.numeric(mu_ct)
#f sig_st to sig_ct
f_mid <- fst*is.numeric((mu_ct - mu_eff_mid)/(mu_ct-mu_st)) + fct*is.numeric((mu_eff_mid - mu_st)/(mu_ct - mu_st))
# f sig_ct to inf
f_upper <- (sig_upper/sig_ct)*fct
return(list(risk_rf, reward_rf, risk, reward, f_upper, f_mid, f_upper))
}
plotRisk_abc <- function(graphDate, t_bill_rate){
t_bill_rate <- t_bill_rate
ticks1 <- c("VFINX","VBTIX","VGSIX")
ticks2 <- c("VFINX","VBTIX","VGSIX","DFSTX", "VFITX", "DFEMX")
ticks3 <- c("VFINX","VBTIX","VGSIX","DFSTX", "VFITX", "DFEMX","GOOGL", "XOM", "UPS")
# double numers indicate risky
both <- getRisk(graphDate, ticks1, t_bill_rate)
x1 = both[[1]]
y1 = both[[2]]
x11 = both[[3]]
y11 = both[[4]]
both2 <- getRisk(graphDate, ticks2, t_bill_rate)
x2 = both2[[1]]
y2 = both2[[2]]
x22 = both2[[3]]
y22 = both2[[4]]
both3 <- getRisk(graphDate, ticks3, t_bill_rate)
x3 = both3[[1]]
y3 = both3[[2]]
x33 = both3[[3]]
y33 = both3[[4]]
#rf
dfA <- data.frame(cbind(x1,y1))
dfB <- data.frame(cbind(x2,y2))
dfC <- data.frame(cbind(x3,y3))
#risky
dfAA <- data.frame(cbind(x11,y11))
dfBB <- data.frame(cbind(x22,y22))
dfCC <- data.frame(cbind(x33,y33))
names(dfA) <- c("x1","y1")
names(dfB) <- c("x2","y2")
names(dfC) <- c("x3","y3")
gg <- ggplot() +
geom_point(data = dfA, aes(x = x1, y = y1, shape = "A RF")) +
geom_point(data = dfB, aes(x = x2, y = y2, shape = "A and B RF")) +
geom_point(data = dfC, aes(x = x3, y = y3, shape = "A, B, and C RF")) +
# geom_point(data = dfAA, aes(x = x11, y = y11, shape = "A")) +
# geom_point(data = dfBB, aes(x = x22, y = y22, shape = "A and B")) +
# geom_point(data = dfCC, aes(x = x33, y = y33, shape = "A, B, and C")) +
ylab("Expected return") +
xlab("Risk") +
theme(legend.title=element_blank())
fef_a_lower <- both[[5]]
fef_a_mid <- both[[6]]
fef_a_upper <- both[[7]]
fef_ab_lower <- both2[[5]]
fef_ab_mid <- both2[[6]]
fef_ab_upper <- both2[[7]]
fef_abc_lower <- both3[[5]]
fef_abc_mid <- both3[[6]]
fef_abc_upper <- both3[[7]]
fef_a_lower < as.data.frame(fef_a_lower, row.names = ticks1)
print(fef_a_lower)
fef_a_mid < as.data.frame(fef_a_mid, row.names = ticks1)
fef_a_upper < as.data.frame(fef_a_upper, row.names = ticks1)
fef_ab_lower < as.data.frame(fef_ab_lower, row.names = ticks2)
fef_ab_mid < as.data.frame(fef_ab_mid, row.names = ticks2)
fef_ab_upper < as.data.frame(fef_ab_upper, row.names = ticks2)
fef_abc_lower < as.data.frame(fef_abc_lower, row.names = ticks3)
fef_abc_mid < as.data.frame(fef_abc_mid, row.names = ticks3)
fef_abc_upper < as.data.frame(fef_abc_upper, row.names = ticks3)
colnames(fef_a_lower) <- "f_a_lower"
colnames(fef_a_mid) <- "f_a_mid"
colnames(fef_a_upper) <- "f_a_upper"
colnames(fef_ab_lower) <- "f_ab_lower"
colnames(fef_ab_mid) <- "f_ab_mid"
colnames(fef_ab_upper) <- "f_ab_upper"
colnames(fef_abc_lower) <- "f_abc_lower"
colnames(fef_abc_mid) <- "f_abc_mid"
colnames(fef_abc_upper) <- "f_abc_upper"
rownames(fef_a_lower) <- ticks1
rownames(fef_a_mid) <- ticks1
rownames(fef_a_upper) <- ticks1
rownames(fef_ab_lower) <- ticks2
rownames(fef_ab_mid) <- ticks2
rownames(fef_ab_upper) <- ticks2
rownames(fef_abc_lower) <- ticks3
rownames(fef_abc_mid) <- ticks3
rownames(fef_abc_upper) <- ticks3
# fmv_a <- as.data.frame(fmv_a, row.names = ticks1)
# colnames(fmv_a) <- "fmv"
# fmv_ab <- as.data.frame(fmv_ab, row.names = ticks2)
# colnames(fmv_ab) <- "fmv"
# fmv_abc <- as.data.frame(fmv_abc, row.names = ticks3)
# colnames(fmv_abc) <- "fmv"
gg
return(list(gg, fef_a_lower, fef_a_mid, fef_a_upper, fef_ab_lower, fef_ab_mid, fef_ab_upper, fef_abc_lower, fef_abc_mid, fef_abc_upper))
#return(list(fmv_a,fmv_ab,fmv_abc,gg))
}
plotRisk_abc("2010", 0.0029)
## As of 0.4-0, 'getSymbols' uses env=parent.frame() and
## auto.assign=TRUE by default.
##
## This behavior will be phased out in 0.5-0 when the call will
## default to use auto.assign=FALSE. getOption("getSymbols.env") and
## getOptions("getSymbols.auto.assign") are now checked for alternate defaults
##
## This message is shown once per session and may be disabled by setting
## options("getSymbols.warning4.0"=FALSE). See ?getSymbols for more details.
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16644 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12112 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 13712 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16644 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12112 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 13712 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14102 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12141 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14145 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16644 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12112 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 13712 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14102 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12141 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14145 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 18511 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16844 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16600 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## [,1]
## [1,] 0.16825711
## [2,] 1.00225047
## [3,] -0.05171304
## [[1]]
##
## [[2]]
## f_a_lower
## VFINX 0.16825711
## VBTIX 1.00225047
## VGSIX -0.05171304
##
## [[3]]
## f_a_mid
## VFINX 0.34222316
## VBTIX 1.74385703
## VGSIX -0.08608019
##
## [[4]]
## f_a_upper
## VFINX 0.16825711
## VBTIX 1.00225047
## VGSIX -0.05171304
##
## [[5]]
## f_ab_lower
## VFINX 0.19936023
## VBTIX 1.38622670
## VGSIX -0.04726117
## DFSTX -0.02843798
## VFITX -0.37080843
## DFEMX -0.02280188
##
## [[6]]
## f_ab_mid
## VFINX 0.42018400
## VBTIX 2.41427392
## VGSIX -0.07635117
## DFSTX -0.07198122
## VFITX -0.65026988
## DFEMX -0.03585565
##
## [[7]]
## f_ab_upper
## VFINX 0.19936023
## VBTIX 1.38622670
## VGSIX -0.04726117
## DFSTX -0.02843798
## VFITX -0.37080843
## DFEMX -0.02280188
##
## [[8]]
## f_abc_lower
## VFINX 0.145975368
## VBTIX 1.389993139
## VGSIX -0.041368270
## DFSTX -0.015830362
## VFITX -0.374436453
## DFEMX -0.029153342
## GOOGL 0.008171478
## XOM 0.043938698
## UPS -0.006980251
##
## [[9]]
## f_abc_mid
## VFINX 0.31873657
## VBTIX 2.42378760
## VGSIX -0.06762797
## DFSTX -0.04673120
## VFITX -0.65921751
## DFEMX -0.04540768
## GOOGL 0.01893669
## XOM 0.07482671
## UPS -0.01730321
##
## [[10]]
## f_abc_upper
## VFINX 0.145975368
## VBTIX 1.389993139
## VGSIX -0.041368270
## DFSTX -0.015830362
## VFITX -0.374436453
## DFEMX -0.029153342
## GOOGL 0.008171478
## XOM 0.043938698
## UPS -0.006980251
plotRisk_abc("2011", 0.0012)
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17132 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12116 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14305 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17132 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12116 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14305 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14389 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12256 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14154 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17132 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12116 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14305 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14389 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12256 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14154 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 18517 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17063 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16837 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## [,1]
## [1,] 0.19367823
## [2,] 1.00725602
## [3,] -0.09041894
## [[1]]
##
## [[2]]
## f_a_lower
## VFINX 0.19367823
## VBTIX 1.00725602
## VGSIX -0.09041894
##
## [[3]]
## f_a_mid
## VFINX 0.3985660
## VBTIX 1.7496254
## VGSIX -0.1481914
##
## [[4]]
## f_a_upper
## VFINX 0.19367823
## VBTIX 1.00725602
## VGSIX -0.09041894
##
## [[5]]
## f_ab_lower
## VFINX 0.241638479
## VBTIX 0.973208288
## VGSIX -0.080911561
## DFSTX -0.042381700
## VFITX 0.020716495
## DFEMX -0.001689399
##
## [[6]]
## f_ab_mid
## VFINX 0.44963197
## VBTIX 1.67485690
## VGSIX -0.13412854
## DFSTX -0.08389715
## VFITX 0.04880735
## DFEMX 0.04472948
##
## [[7]]
## f_ab_upper
## VFINX 0.241638479
## VBTIX 0.973208288
## VGSIX -0.080911561
## DFSTX -0.042381700
## VFITX 0.020716495
## DFEMX -0.001689399
##
## [[8]]
## f_abc_lower
## VFINX 0.2223440945
## VBTIX 0.9739092747
## VGSIX -0.0781098729
## DFSTX -0.0390397554
## VFITX 0.0209317910
## DFEMX -0.0007785493
## GOOGL -0.0079311131
## XOM 0.0170237987
## UPS 0.0070559904
##
## [[9]]
## f_abc_mid
## VFINX 0.4618918949
## VBTIX 1.6738145547
## VGSIX -0.1355503720
## DFSTX -0.0848147027
## VFITX 0.0504775808
## DFEMX 0.0472810199
## GOOGL -0.0237845074
## XOM -0.0005583982
## UPS 0.0112429301
##
## [[10]]
## f_abc_upper
## VFINX 0.2223440945
## VBTIX 0.9739092747
## VGSIX -0.0781098729
## DFSTX -0.0390397554
## VFITX 0.0209317910
## DFEMX -0.0007785493
## GOOGL -0.0079311131
## XOM 0.0170237987
## UPS 0.0070559904
plotRisk_abc("2012", 0.0016)
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17293 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12143 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14114 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17293 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12143 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14114 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14288 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12257 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14353 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17293 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12143 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14114 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14288 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12257 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14353 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 18400 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16940 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16689 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## [,1]
## [1,] 0.1251295748
## [2,] 1.0055443764
## [3,] 0.0006292142
## [[1]]
##
## [[2]]
## f_a_lower
## VFINX 0.1251295748
## VBTIX 1.0055443764
## VGSIX 0.0006292142
##
## [[3]]
## f_a_mid
## VFINX 0.247687964
## VBTIX 1.754718310
## VGSIX -0.002406274
##
## [[4]]
## f_a_upper
## VFINX 0.1251295748
## VBTIX 1.0055443764
## VGSIX 0.0006292142
##
## [[5]]
## f_ab_lower
## VFINX 0.126275000
## VBTIX 1.240661460
## VGSIX 0.001116260
## DFSTX -0.008930818
## VFITX -0.234944838
## DFEMX 0.009439252
##
## [[6]]
## f_ab_mid
## VFINX 0.246342142
## VBTIX 2.139125143
## VGSIX -0.002516954
## DFSTX -0.012475223
## VFITX -0.383270718
## DFEMX 0.012795610
##
## [[7]]
## f_ab_upper
## VFINX 0.126275000
## VBTIX 1.240661460
## VGSIX 0.001116260
## DFSTX -0.008930818
## VFITX -0.234944838
## DFEMX 0.009439252
##
## [[8]]
## f_abc_lower
## VFINX 0.098096130
## VBTIX 1.229208013
## VGSIX 0.001377113
## DFSTX -0.007057100
## VFITX -0.225745035
## DFEMX 0.011450017
## GOOGL -0.001264479
## XOM 0.027301254
## UPS 0.005254215
##
## [[9]]
## f_abc_mid
## VFINX 0.172424586
## VBTIX 2.112853770
## VGSIX -0.002230906
## DFSTX -0.008487861
## VFITX -0.363499289
## DFEMX 0.017378769
## GOOGL -0.002692524
## XOM 0.059480372
## UPS 0.014773084
##
## [[10]]
## f_abc_upper
## VFINX 0.098096130
## VBTIX 1.229208013
## VGSIX 0.001377113
## DFSTX -0.007057100
## VFITX -0.225745035
## DFEMX 0.011450017
## GOOGL -0.001264479
## XOM 0.027301254
## UPS 0.005254215
plotRisk_abc("2013", 0.0013)
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17512 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12267 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14326 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17512 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12267 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14326 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14216 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12373 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14385 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17512 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12267 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14326 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14216 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12373 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14385 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 18715 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17099 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 16965 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## [,1]
## [1,] 0.2140647
## [2,] 1.0659605
## [3,] -0.1832829
## [[1]]
##
## [[2]]
## f_a_lower
## VFINX 0.2140647
## VBTIX 1.0659605
## VGSIX -0.1832829
##
## [[3]]
## f_a_mid
## VFINX 0.3453062
## VBTIX 1.8968983
## VGSIX -0.2422045
##
## [[4]]
## f_a_upper
## VFINX 0.2140647
## VBTIX 1.0659605
## VGSIX -0.1832829
##
## [[5]]
## f_ab_lower
## VFINX 0.20988813
## VBTIX 1.20082369
## VGSIX -0.17664217
## DFSTX 0.01406717
## VFITX -0.12803823
## DFEMX -0.02721372
##
## [[6]]
## f_ab_mid
## VFINX 0.29365817
## VBTIX 2.16567731
## VGSIX -0.23938500
## DFSTX 0.02426935
## VFITX -0.26438381
## DFEMX 0.02016397
##
## [[7]]
## f_ab_upper
## VFINX 0.20988813
## VBTIX 1.20082369
## VGSIX -0.17664217
## DFSTX 0.01406717
## VFITX -0.12803823
## DFEMX -0.02721372
##
## [[8]]
## f_abc_lower
## VFINX 0.171777947
## VBTIX 1.200944842
## VGSIX -0.176923877
## DFSTX 0.016467659
## VFITX -0.137346788
## DFEMX -0.026579959
## GOOGL -0.003358895
## XOM 0.028395699
## UPS 0.028723391
##
## [[9]]
## f_abc_mid
## VFINX 0.23789665
## VBTIX 2.16799721
## VGSIX -0.24265280
## DFSTX 0.03727846
## VFITX -0.27700498
## DFEMX 0.01890756
## GOOGL -0.01699806
## XOM 0.05805870
## UPS 0.01651727
##
## [[10]]
## f_abc_upper
## VFINX 0.171777947
## VBTIX 1.200944842
## VGSIX -0.176923877
## DFSTX 0.016467659
## VFITX -0.137346788
## DFEMX -0.026579959
## GOOGL -0.003358895
## XOM 0.028395699
## UPS 0.028723391
plotRisk_abc("2014", 0.0025)
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17512 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12368 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14236 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17512 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12368 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14236 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14245 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12361 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14445 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17512 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12368 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14236 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14245 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12361 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14445 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 18297 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17289 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17345 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## [,1]
## [1,] 0.15006514
## [2,] 1.02068065
## [3,] -0.04889759
## [[1]]
##
## [[2]]
## f_a_lower
## VFINX 0.15006514
## VBTIX 1.02068065
## VGSIX -0.04889759
##
## [[3]]
## f_a_mid
## VFINX 0.3031504
## VBTIX 1.7846993
## VGSIX -0.0878497
##
## [[4]]
## f_a_upper
## VFINX 0.15006514
## VBTIX 1.02068065
## VGSIX -0.04889759
##
## [[5]]
## f_ab_lower
## VFINX 0.12621286
## VBTIX 1.11856853
## VGSIX -0.04848502
## DFSTX 0.01102279
## VFITX -0.09763700
## DFEMX 0.01598216
##
## [[6]]
## f_ab_mid
## VFINX 0.23452232
## VBTIX 1.90425967
## VGSIX -0.09048330
## DFSTX 0.03439673
## VFITX -0.11946754
## DFEMX 0.03677213
##
## [[7]]
## f_ab_upper
## VFINX 0.12621286
## VBTIX 1.11856853
## VGSIX -0.04848502
## DFSTX 0.01102279
## VFITX -0.09763700
## DFEMX 0.01598216
##
## [[8]]
## f_abc_lower
## VFINX 0.099144243
## VBTIX 1.131597066
## VGSIX -0.047002336
## DFSTX 0.013193562
## VFITX -0.113519881
## DFEMX 0.013579923
## GOOGL 0.000532968
## XOM 0.009532897
## UPS 0.025044228
##
## [[9]]
## f_abc_mid
## VFINX 0.167059627
## VBTIX 1.933891054
## VGSIX -0.087557842
## DFSTX 0.038789498
## VFITX -0.154192563
## DFEMX 0.030934270
## GOOGL 0.002853644
## XOM 0.025431973
## UPS 0.042790339
##
## [[10]]
## f_abc_upper
## VFINX 0.099144243
## VBTIX 1.131597066
## VGSIX -0.047002336
## DFSTX 0.013193562
## VFITX -0.113519881
## DFEMX 0.013579923
## GOOGL 0.000532968
## XOM 0.009532897
## UPS 0.025044228
plotRisk_abc("2015", 0.0065)
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17446 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12351 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14159 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17446 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12351 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14159 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14651 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12360 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14243 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17446 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12351 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14159 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14651 != reported length 200
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 12360 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 14243 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17989 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17058 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## Warning in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=",
## from.m, : downloaded length 17452 != reported length 200
## pausing 1 second between requests for more than 5 symbols
## [,1]
## [1,] 0.1898499
## [2,] 1.0511447
## [3,] -0.1350554
## [[1]]
##
## [[2]]
## f_a_lower
## VFINX 0.1898499
## VBTIX 1.0511447
## VGSIX -0.1350554
##
## [[3]]
## f_a_mid
## VFINX 0.3790375
## VBTIX 1.8284028
## VGSIX -0.2074403
##
## [[4]]
## f_a_upper
## VFINX 0.1898499
## VBTIX 1.0511447
## VGSIX -0.1350554
##
## [[5]]
## f_ab_lower
## VFINX 0.11638927
## VBTIX 1.14388471
## VGSIX -0.12671296
## DFSTX 0.06282791
## VFITX -0.10317260
## DFEMX 0.01727346
##
## [[6]]
## f_ab_mid
## VFINX 0.22373295
## VBTIX 2.01261355
## VGSIX -0.19400032
## DFSTX 0.12860613
## VFITX -0.20379402
## DFEMX 0.03284171
##
## [[7]]
## f_ab_upper
## VFINX 0.11638927
## VBTIX 1.14388471
## VGSIX -0.12671296
## DFSTX 0.06282791
## VFITX -0.10317260
## DFEMX 0.01727346
##
## [[8]]
## f_abc_lower
## VFINX 0.12346846
## VBTIX 1.11084031
## VGSIX -0.13098097
## DFSTX 0.05734722
## VFITX -0.07393106
## DFEMX 0.02062510
## GOOGL -0.01217741
## XOM -0.01864435
## UPS 0.04004405
##
## [[9]]
## f_abc_mid
## VFINX 0.23842842
## VBTIX 1.95699161
## VGSIX -0.20076485
## DFSTX 0.11661269
## VFITX -0.15470005
## DFEMX 0.03721990
## GOOGL -0.02695984
## XOM -0.03074320
## UPS 0.06391532
##
## [[10]]
## f_abc_upper
## VFINX 0.12346846
## VBTIX 1.11084031
## VGSIX -0.13098097
## DFSTX 0.05734722
## VFITX -0.07393106
## DFEMX 0.02062510
## GOOGL -0.01217741
## XOM -0.01864435
## UPS 0.04004405