#===> build two single index models <===#
data(stock94)
data(stock99)
data(stock94Info)
sim1 <- stockModel(stock94, model='SIM',
industry=stock94Info$industry, index=25)
sim2 <- stockModel(stock99, model='SIM',
industry=stock94Info$industry, index=25)
#===> adjust the betas <===#
# the output is a new stock model
simBlu <- adjustBeta(sim1, sim2)
simVas <- adjustBeta(sim2, method='Vasicek')
#===> build optimal portfolios <===#
opSim <- optimalPort(sim2)
opBlu <- optimalPort(simBlu)
opVas <- optimalPort(simVas)
#===> test portfolios on 2004-9 <===#
data(stock04)
tpSim <- testPort(stock04, opSim)
tpBlu <- testPort(stock04, opBlu)
tpVas <- testPort(stock04, opVas)
#===> compare performances <===#
plot(tpSim, ylim=c(1,2.2))
lines(tpBlu, col=2, lty=2)
lines(tpVas, col=3, lty=3)
legend('topleft', col=1:3, lty=1:3, legend=c('none', 'Blume', 'Vasicek'))
Run the code above in your browser using DataLab