[R-SIG-Finance] [R-sig-finance] Flexible inputs fPortfolio possible?
vlanschot at yahoo.com
Thu May 29 09:20:18 CEST 2008
Following your advice, I did the following:
####### Efficient Frontier
Data <- as.timeSeries(MatR)
SpecDef <- portfolioSpec()
Rfree = 0.04/12
This code results in the following (what looks like correct) results:
. . . .
. . . .
However, if I then input this as follows:
ConstrLO = "LongOnly"
frontierLO = portfolioFrontier(Data, SpecDef, ConstrLO)
I get the following error:
c("'structure(list(mu = structure(c(0.0025, 0.00369565217391304, ' is not
a function, character or symbol", "'0.00271739130434783,
0.00347826086956522, 0.00858695652173913, ' is not a function, character or
symbol", "'0.00119565217391304, 0.00141304347826087, -0.00282608695652174, '
is not a function, character or symbol", "'0.0101086956521739,
0.00315217391304348, 0.0197826086956522, ' is not a function, character or
symbol", "'0.0141304347826087), .Names = c(\"FTSE.All.Share\",
\"FTSE.All.Stock.Gilts\", ' is not a function, character or symbol",
Trying to correct it by literally applying your code, and using:
PropEstimates<-function(x, spec = NULL, ...) list(mu = colMeans(x), Sigma =
I get this error:
variable "TotUni" of mode "function" was not found
In fact, even the "old" way of doing things, for example by leaving out any
setEstimator, results in:
variable "covEstimator" of mode "function" was not found
Is this because I'm still using 2.6.2 ???
Thx for any further insights/guidance,
R at N
Yohan Chalabi wrote:
>>>>> "R" == "R at Nabble" <vlanschot at yahoo.com>
>>>>> on Tue, 27 May 2008 04:15:15 -0700 (PDT)
> R> Hi,
> R> Is it possible yet to allow pre-specified mean-return and/or
> R> covar-matrices
> R> in fPortfolio? If so, where can I find instructions to
> R> achieve this? I
> R> remember reading somewhere that this would eventually become
> R> available.
> R> Thx,
> R> R at N
> Do you want to define your own estimators of the covariance matrix?
> You can do it with the dev-version of fPortfolio available at r-forge.
> a quick example :
> # only with development version of fPortfolio available on R-Forge
> # now you can define your own estimator which must returns a list with a
> # named list, with at least the following two entries '\$mu' and
> # '\$Sigma', which represent estimators for the mean and covariance,
> # respectively.
> myEstimator <-
> function(x, spec = NULL, ...) list(mu = colMeans(x), Sigma = cov(x))
> Spec <- portfolioSpec() # default portfolio specification
> setEstimator(Spec) <- "myEstimator" # new estimator
> # Load Data and Convert to timeSeries Object:
> Data = as.timeSeries(data(smallcap.ts))
> Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
> ## Compute properties of Efficient Portfolio
> frontier <- portfolioFrontier(Data, Spec, "LongOnly")
> hope this helps,
> PhD student
> Swiss Federal Institute of Technology
> Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm
> June 29th - July 3rd Meielisalp, Lake Thune, Switzerland
> R-SIG-Finance at stat.math.ethz.ch mailing list
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
View this message in context: http://www.nabble.com/Flexible-inputs-fPortfolio-possible--tp17488047p17529091.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance