The help shows an example with one benchmark for each asset:

    library(PortfolioAttribution)
    data(attrib)
    Attribution(Rp = attrib.returns[, 1:10],
      wp = attrib.weights[1, ],
      Rb = attrib.returns[, 11:20],
      wb = attrib.weights[2, ],
      method = "top.down",
      linking = "carino")

I tried to create modify the example to use one benchmark, as the following 
error message hints is possible:

Error in Attribution(Rp = attrib.returns[, 1:10], wp = attrib.weights[1,  :
  Please use benchmark xts that has columns with benchmarks for each
            asset or one common benchmark for all assets

But this is not working, giving the following error:

   Attribution(Rp = attrib.returns[, 1:10],
      wp = attrib.weights[1, ],
      Rb = attrib.returns[, 11],
      wb = 1,
      method = "top.down",
      linking = "carino")

Error in checkData(R, method = "xts") :
  The data cannot be converted into a time series.  If you are trying to pass 
in names from a data object with one column, you should use the form 
'data[rows, columns, drop = FALSE]'.  Rownames should have standard date 
formats, such as '1985-03-15'.

And for completeness, drop=FALSE  does not fix the error:

    Attribution(Rp = attrib.returns[, 1:10],
      wp = attrib.weights[1, ],
      Rb = attrib.returns[, 11, drop=FALSE],
      wb = 1,
      method = "top.down",
      linking = "carino")

Could anyone please show me how to do this?

Thanks, Roger




This message and any attachments are for the intended recipient’s use only. 
This message may contain confidential, proprietary or legally privileged 
information. No right to confidential or privileged treatment of this message 
is waived or lost by an error in transmission.
If you have received this message in error, please immediately notify the 
sender by e-mail, delete the message, any attachments and all copies from your 
system and destroy any hard copies. You must not, directly or indirectly, use, 
disclose, distribute, print or copy any part of this message or any attachments 
if you are not the intended recipient.




_______________________________________________
[email protected] 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.

Reply via email to