[R-SIG-Finance] fPortfolio - Change in getWeights function

Yaakov Moser ymoser at gmail.com
Sun May 3 18:59:22 CEST 2009


I recently upgraded to the latest version of fPortfolio:


> Package:            fPortfolio
> Version:            2100.77
> Revision:           4093
> Date:               2009-04-19
Has there been a change in the behaviour of the getWeights function?

In the previous versions, it used to return a matrix with the different 
assets as the columns and the frontier points as the rows.

Now it only returns a single row, which appears to be the last point 
that is found.


Do I need to change the syntax by which I call it?


Any help appreciated.


See sample code below.


Thanks


Yaakov


Data <- as.timeSeries(data(SMALLCAP.RET))
Data<-Data[,1:3]
Spec = portfolioSpec()
portfolio<-portfolioFrontier(Data,Spec)

#portfolio returns 5 out of the 50 points as we expect.

# The weights are listed as well.

portfolio

#frontierPoints returns a 2 X 50 matrix, as expected

frontierPoints(portfolio)

#getWeights returns only one row...

getWeights(portfolio)


> [1] 2.258490e-08 0.000000e+00 1.000000e+00
> attr(,"invest")
> [1] 1



More information about the R-SIG-Finance mailing list