[R-SIG-Finance] portfolioFrontier/Spec: targetReturn
Josh Ulrich
josh.m.ulrich at gmail.com
Thu May 8 21:07:57 CEST 2008
List,
I am trying to help a colleague with a question, but I am - by no
means - an expert in this area. The output of the portfolioFrontier
function in the code below doesn't change for different values of
targetReturn and riskFreeRate (in portfolioSpec). I would appreciate
if someone could point me to information on why this should be
expected or not.
Best,
Josh
require(TTR)
require(zoo)
suppressMessages(require(fPortfolio))
syms <- c('ABNDX','CAIBX','CWBFX','CWGIX','RYEOX','RYMTX','DBV')
X <- getYahooData(syms[1], start=20070601, quiet=TRUE)
X <- zoo( X$Close, X$Date )
for(i in 2:NROW(syms)) {
print(syms[i])
x <- getYahooData(syms[i], start=20070601, quiet=TRUE)
X <- cbind( X, zoo( x$Close, x$Date ) )
}
colnames(X) <- syms
R <- as.timeSeries(returns(X, percentage = TRUE))
Spec = portfolioSpec(model = list(type = c("MV", "CVaR"),
estimator = c("mean", "cov"), tailRisk = list(), params = list()),
portfolio = list(weights = NULL, targetReturn = NULL,
targetRisk = 4, targetAlpha = 0.05, riskFreeRate = NULL,
nFrontierPoints = 50),
solver = list(solver = c("quadprog", "Rdonlp2", "lpSolve"), trace = FALSE))
Spec
frontier <- portfolioFrontier( R, Spec, c("minW[1:nAssets]=0"))
weightsSlider(frontier)
> sessionInfo()
R version 2.7.0 (2008-04-22)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] fPortfolio_260.72 fAssets_260.72 fRegression_260.72 fMultivar_260.72
[5] sn_0.4-4 mnormt_1.2-1 fTrading_260.72 polspline_1.0.15
[9] nnet_7.2-42 mgcv_1.3-31 fBasics_260.72 fImport_260.72
[13] fSeries_260.72 fCalendar_262.73 fEcofin_260.72 fUtilities_260.72
[17] spatial_7.2-42 RUnit_0.4.17 robustbase_0.2-8 MASS_7.2-42
[21] lpSolve_5.6.2 quadprog_1.4-11 zoo_1.5-3 TTR_0.14-0
loaded via a namespace (and not attached):
Error in x[["Version"]] : subscript out of bounds
In addition: Warning message:
In FUN(c("grid", "lattice")[[2L]], ...) :
DESCRIPTION file of package 'lattice' is missing or broken
--
http://quantemplation.blogspot.com
More information about the R-SIG-Finance
mailing list