Displaying 3 results from an estimated 3 matches for "maxsumw".
Did you mean:
maxsum
2008 Aug 12
1
fPortfolio constraints, maxsumW
Running R version 2.6.1 under Gentoo Linux and using the fPortfolio
package, I am having trouble specifying a sector constraint. One of the
constraints to be imposed is that assets 1 and 2 together account for no
more than 13.63% of the portfolio. My attempt at coding that
constraint, "maxsumW[1:2Assets]=13.63" fails. The relevant section of
my code file and the resulting error message are pasted below.
Suggestions about how to correct my coding would be most welcome.
*************Code beings here************************
Data = as.timeSeries(Jdata)
Spec = portfolioSpec()
setNFr...
2017 Dec 27
1
Error in dimnames in R
...:6]=0.10",
"minW[7:7]=0.05","maxW[7:7]=0.10","minW[8:8]=0.08","maxW[8:8]=0.12",
"minW[9:9]=0.05","maxW[9:9]=0.10","minW[10:10]=0.08","maxW[10:10]=0.12",
"minsumW[c(1:1,2:2)]=0.27","maxsumW[c(1:1,2:2)]=0.33",
"minsumW[c(3:3,4:4,6:6,10:10)]=0.37","maxsumW[c(3:3,4:4,6:6,10:10)]=0.43",
"minsumW[c(5:5,7:7,8:8,9:9)]=0.27","maxsumW[c(5:5,7:7,8:8,9:9)]=0.33",
"maxsumW[c(1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,10:10)]=1")...
2012 Sep 04
0
Calculate a minimum-variance portfolio with fPortfolio
...ted portfolio that satisfies all of them (e.g. with
5% in each asset).
4. Reproducible example:
library(fPortfolio)
# Data
data <- SMALLCAP[, 1:20]
# Constraints
box.1 <- paste0("minW[1:nAssets] = ", 0)
box.2 <- paste0("maxW[1:nAssets] = ", 0.10)
box.3 <- "maxsumW[1:nAssets] = 1"
box.4 <- "minsumW[1:nAssets] = 1"
boxConstraints <- c(box.1, box.2, box.3, box.4)
# Portfolio Specs
Spec <- portfolioSpec()
# Calculate MinVar Portfolio
minvar <- minvariancePortfolio(
data = data,
spec = Spec,
constraints = boxConstraints)...