There is not always a solution if you set your constraints too high. If the riskfree rate is set to zero, do you get a rational result? If you use different assets, does the portfdolio behave? Etc.
If you post your instrument data or historical data download code, I'm sure saomone will try to replicate your error, but with only the code and not the data, we're just guessing (see list posting guidelines)
Regards,
- Brian
Bastian Offermann <bastian2507hk at yahoo.co.uk> wrote:
Nobody?? I am wondering what the problem is. Using different inputs for
setRiskFreeRate(Spec) I always get the same output (i.e. same weights).
And there is never an allocation to the riskfree asset no matter what my
required return is? Where is my mistake? Am I totally wrong here??
Thanks.
Regards
B
Hello,
i have encountered a problem with fPortfolio recently. I am using below
code:
the problem is that my risk free rate is different from the one
displayed in the graphical output and the straight line in the graphical
output intersects the efficient frontier twice. same problem when i use
"cmlLines(eff.front)" .what am i missing out on?
THanks.
Data1 <- as.timeSeries(Data1)
Data1 <- as.timeSeries(data(LPP2005REC))
Data1 <- Data1[,1:4]*250
r.p <- 0.10
r.rf <- 0.01
Spec <- portfolioSpec()
restr <- c("Short", "LongOnly")
cons <- restr[1]
setOptimize(Spec) <- "minRisk"
setRiskFreeRate(Spec) <- r.rf #/250
setTargetReturn(Spec) <- r.p #/250
setNFrontierPoints(Spec) <- 50
solver <- c("solveRquadprog", "solveRshortExact")
if(cons == "LongOnly") { setSolver(Spec) <- solver[1] }
if(cons == "Short") { setSolver(Spec) <- solver[2] }
eff.front <- portfolioFrontier(data = Data1, spec = Spec, constraints =
cons)
eff.port <- efficientPortfolio(data = Data1, spec = Spec, constraints =
cons)
tang.port <- tangencyPortfolio(data = Data1, spec = Spec, constraints =
cons)
minvar.port <- minvariancePortfolio(data = Data1, spec = Spec,
constraints = cons)
w <- as.vector(getWeights(eff.port))
w <- matrix(w, 1, ncol(Data1))
w.min <- as.vector(getWeights(minvar.port))
w.min <- matrix(w.min, 1, ncol(Data1))
w
w.min
frontierPlot(eff.front, frontier = "upper", return="mu", risk="Sigma",
type="l")
minvariancePoints(eff.front, col="red", bg="red", pch=21)
tangencyLines(eff.front)
tangencyPoints(eff.front)
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.