Hello, I am trying to use flexible inputs for an unconstrained Markowitz optimization using the fPortfolio package. The documentation says *"a time series or a named list, containing either a series of returns or named entries ?mu? and ?Sigma? being mean and covariance matrix." * is required as inputs. However, when supplying a list containing mu and sigma I get the following error *Error: class(data) == "timeSeries" is not TRUE r.p <- 0.05 Spec <- portfolioSpec() setType(Spec) <- "MV" cons <- "Short" setOptimize(Spec) <- "minRisk" setTargetReturn(Spec) <- r.p/52 setNFrontierPoints(Spec) <- 10 setSolver(Spec) <- "solveRshortExact" mu <- c(0.0002884615, 0.0007085510) covar <- matrix(c(0.0002536010, 0.0001704248, 0.0001704248, 0.0007122588), 2, 2) Data1 <- list(mu, covar) eff.front1 <- portfolioFrontier(data = Data1, spec = Spec, constraints = cons) *Any input appreciated. Thanks in advance. Regards BO
fPortfolio Inputs as List - Error Msg
4 messages · Bastian Offermann, Brian G. Peterson, Martin Becker
Nobody? Thanks. Bastian Offermann schrieb:
Hello, I am trying to use flexible inputs for an unconstrained Markowitz optimization using the fPortfolio package. The documentation says *"a time series or a named list, containing either a series of returns or named entries ?mu? and ?Sigma? being mean and covariance matrix." * is required as inputs. However, when supplying a list containing mu and sigma I get the following error *Error: class(data) == "timeSeries" is not TRUE r.p <- 0.05 Spec <- portfolioSpec() setType(Spec) <- "MV" cons <- "Short" setOptimize(Spec) <- "minRisk" setTargetReturn(Spec) <- r.p/52 setNFrontierPoints(Spec) <- 10 setSolver(Spec) <- "solveRshortExact" mu <- c(0.0002884615, 0.0007085510) covar <- matrix(c(0.0002536010, 0.0001704248, 0.0001704248, 0.0007122588), 2, 2) Data1 <- list(mu, covar) eff.front1 <- portfolioFrontier(data = Data1, spec = Spec, constraints = cons) *Any input appreciated. Thanks in advance. Regards BO
_______________________________________________ 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.
Bastian Offermann wrote:
Nobody? Thanks.
Please post both your code and the data you are using to replicate your
problem. If you provide data in addition to the commands you tried, per the
list posting guidelines, it is much easier for someone else to replicate your
problem.
Regards,
- Brian
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
Bastian Offermann wrote:
Hello, I am trying to use flexible inputs for an unconstrained Markowitz optimization using the fPortfolio package. The documentation says *"a time series or a named list, containing either a series of returns or named entries ?mu? and ?Sigma? being mean and covariance matrix." *
Which documentation? What version of fPortfolio? I don't see this documentation fragment on ?portfolioFrontier for 280.74. (Besides, Data1 [as defined below] is not a list with named entries ?mu? and ?Sigma?.) Regards, Martin
is required as inputs. However, when supplying a list containing mu and sigma I get the following error *Error: class(data) == "timeSeries" is not TRUE r.p <- 0.05 Spec <- portfolioSpec() setType(Spec) <- "MV" cons <- "Short" setOptimize(Spec) <- "minRisk" setTargetReturn(Spec) <- r.p/52 setNFrontierPoints(Spec) <- 10 setSolver(Spec) <- "solveRshortExact" mu <- c(0.0002884615, 0.0007085510) covar <- matrix(c(0.0002536010, 0.0001704248, 0.0001704248, 0.0007122588), 2, 2) Data1 <- list(mu, covar) eff.front1 <- portfolioFrontier(data = Data1, spec = Spec, constraints = cons) *Any input appreciated. Thanks in advance. Regards BO
_______________________________________________ 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.
Dr. Martin Becker Statistics and Econometrics Saarland University Campus C3 1, Room 206 66123 Saarbruecken Germany