getWeights bug?
Martin Maechler
maechler at stat.math.ethz.ch
Tue Mar 13 18:44:10 CET 2012
>>>>> Bruno Rossetto <brunorossetto.office at gmail.com>
>>>>> on Mon, 12 Mar 2012 21:08:53 +0100 writes:
> Hi! I'm trying to use the weightsLinePlot function of the fPortfolio
> library.
> it seems to call the function getWeights(fPortfolioObject), which is
> not returning a matrix, but a single vector(a single line). Thus the
> weightsLinePlot is not working.
You are right.
I'm an Rmetrics-core member, but not at all involved in the
fPortfolio package.
After spending 15 minutes,
I'm pretty convinced that the bug may even be "earlier"
as it seems *MANY* parts of the code assume a that
getWeights() returns a matrix
{{and you are right it does not in this case}}.
> Can you point me to a solution?
Let's hope for the Rmetrics-core members who have built
fPortfolio ....
Best regards,
Martin Maechler
> Below some specs, the code and the output.
>> version
> _
> platform x86_64-pc-mingw32
> arch x86_64
> os mingw32
> system x86_64, mingw32
> status
> major 2
> minor 13.2
> year 2011
> month 09
> day 30
> svn rev 57111
> language R
> version.string R version 2.13.2 (2011-09-30)
>> library(fPortfolio)
>> Data = SMALLCAP.RET
>> Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
>> head(Data)
>> Spec = portfolioSpec();
>> frontier = portfolioFrontier(Data,Spec)
>> getWeights(frontier)
>> weightsLinePlot(frontier)
> ##OUTPUT:
>> frontier = portfolioFrontier(Data,Spec)
>> getWeights(frontier)
> [1] 0.000000e+00 1.805789e-08 1.000000e+00 0.000000e+00
> attr(,"invest")
> [1] 1
>> weightsLinePlot(frontier)
> Error in plot.window(xlim, ylim, log, ...) : 'xlim' value not valid
>>
> [[alternative HTML version deleted]]
> _______________________________________________
> Rmetrics-core mailing list
> Rmetrics-core at r-project.org
> https://stat.ethz.ch/mailman/listinfo/rmetrics-core
More information about the Rmetrics-core
mailing list