[R-SIG-Finance] fPortfolio: Extracting Weight Vectors for FrontierPoints?

Luedde, Mirko mirko.luedde at sap.com
Tue Mar 1 13:26:40 CET 2011


Hi Vishal, 

> ...
> Can you please enlighten about how to extract the weight vector when
> there are say, 50 or 100 frontier points we have computedr?
> ...

try out the stuff below and try to find some docs on S4 data types.

Best, Mirko

> getSlots("fPORTFOLIO")
         call          data          spec   constraints     portfolio 
       "call" "fPFOLIODATA" "fPFOLIOSPEC"  "fPFOLIOCON"  "fPFOLIOVAL" 
        title   description 
  "character"   "character" 

> mcd.frontier at portfolio # assuming you have variable "mcd.frontier" assigned
An object of class "fPFOLIOVAL"
Slot "portfolio":
$weights
            [,1]         [,2]       [,3]       [,4]       [,5]       [,6]
 [1,] 1.00000000 0.000000e+00 0.00000000 0.00000000 0.00000000 0.00000000
 [2,] 0.52257150 0.000000e+00 0.02614403 0.42493162 0.02635285 0.00000000
 [3,] 0.37250582 2.787466e-03 0.07108968 0.49202435 0.03324219 0.02835049
 [4,] 0.30331052 1.826008e-02 0.09057481 0.50545722 0.00000000 0.08239738
 [5,] 0.20880735 2.934532e-02 0.11067892 0.53447093 0.00000000 0.11669749
 [6,] 0.11430418 4.043056e-02 0.13078302 0.56348463 0.00000000 0.15099759
 [7,] 0.01980102 5.151581e-02 0.15088713 0.59249834 0.00000000 0.18529770
 [8,] 0.00000000 6.487394e-02 0.16800366 0.54395652 0.00000000 0.22316588
 [9,] 0.00000000 7.883454e-02 0.18432828 0.47485735 0.00000000 0.26197983
[10,] 0.00000000 9.279513e-02 0.20065290 0.40575818 0.00000000 0.30079379
...


-----Original Message-----
From: r-sig-finance-bounces at r-project.org
[mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Vishal Belsare
Sent: Monday, February 28, 2011 3:40 PM
To: r-sig-finance at r-project.org
Subject: 

Experimenting with the fPortfolio package, and computing the frontier
using some asset returns, a portfolio specification and some
constraints, I save that to an object, presumably of fPortfolio class.
I can print it,
summarize it, and plot it. However, I cannot figure out how to EXTRACT
the weight assigned to each asset on the many frontier points. If I
set the number of frontier points to compute at 50, the print and
summary will show only 5.

The 'getWeights' method will show only one vector and I don't know
which point it is for. Can you please enlighten about how to extract
the weight vector when there are say, 50 or 100 frontier points we
have computedr? I went through the the documentation for fPortfolio,
fAssets and other packages, but they don't have any information about
this.

The information is definitely in the object because I can plot the
weights across the assets in the risk-return space. I want to get
something like, a list of weight vectors, each vector corresponding to
the 'n' frontier points.


Thanks,
Vishal Belsare

_______________________________________________
R-SIG-Finance at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions
should go.

----------------------------------------------------------------------
This message w/attachments (message) is intended solely ...{{dropped:7}}



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

_______________________________________________
R-SIG-Finance mailing list
R-SIG-Finance at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-finance


End of R-SIG-Finance Digest, Vol 82, Issue 1
********************************************


More information about the R-SIG-Finance mailing list