[R-SIG-Finance] [R-sig-finance] Direct Specification of Mu and Sigma in fportfolio

chalabi at phys.ethz.ch chalabi at phys.ethz.ch
Mon Mar 31 21:12:24 CEST 2008


reini <reinhold.hafner at risklab.de> writes:

> Dear all, 
> I was wondering whether someone can help me to solve a problem that I posted
> some weeks ago: 
>
> In using fportfolio I would like to directly specify a mu and sigma rather
> than to hand over a multivariate time series from which mu and sigma are
> estimated by the relevant functions. How does this work? From the
> documentation it seemed possible to me, however, when I investigated the
> relevant code it is asking for a time series. 
>
> Many thanks, 
> Reinhold 
> -- 
> View this message in context: http://www.nabble.com/Direct-Specification-of-Mu-and-Sigma-in-fportfolio-tp16392702p16392702.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> 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.

Hi Reini,

we are currently working on an update of the fPortfolio package. Many
new features will become available, like LPM optimization, and second
order cone programming in a separate package.

We are trying to make fPortfolio as modular as possible to help users to
defined their own functions.

The "unfinished" manual page of portfolioSpec describes how to do it.

a quick example :

--------------

library(fPortfolio)
# 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
Spec

# Load Data and Convert to timeSeries Object:
Data = as.timeSeries(data(smallcap.ts))
Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
Data

## Compute properties of Efficient Portfolio
frontier <- portfolioFrontier(Data, Spec, "LongOnly")
plot(frontier)

--------------

you can download the latest development version from our R-Forge project
page at http://r-forge.r-project.org/projects/rmetrics/. But bear in
mind that this is a development version... if you have any suggestion to
improve the package, do not hesitate to send us your feedback!

all my apologises for the late response,
Yohan


-- 


The 2nd International R/Rmetrics User and Developer Workshop ...
[http://www.rmetrics.org]



More information about the R-SIG-Finance mailing list