Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The bug is not in your code, it is in the R package itself. It it is shown on the package validation check <a href="http://www.r-project.org/nosvn/R.check/r-release-windows-ix86+x86_64/PerformanceAnalytics-00check.html" rel="nofollow">here</a> and it can be reproduced with:</p> <pre><code>library(PerformanceAnalytics) example(CAPM.alpha) </code></pre> <p>The error seems to be on line 40 of Return.excess.R. It should be replaced with:</p> <pre><code>xR = coredata(as.xts(R))-coredata(as.xts(Rf)) </code></pre> <p>The easiest way of fixing this in practice is to run:</p> <pre><code>require(utils) assignInNamespace( "Return.excess", function (R, Rf = 0) { # @author Peter Carl # edited by orizon # .. additional comments removed R = checkData(R) if(!is.null(dim(Rf))){ Rf = checkData(Rf) indexseries=index(cbind(R,Rf)) columnname.Rf=colnames(Rf) } else { indexseries=index(R) columnname.Rf=Rf Rf=xts(rep(Rf, length(indexseries)),order.by=indexseries) } return.excess &lt;- function (R,Rf) { xR = coredata(as.xts(R))-coredata(as.xts(Rf)) #fixed } result = apply(R, MARGIN=2, FUN=return.excess, Rf=Rf) colnames(result) = paste(colnames(R), "&gt;", columnname.Rf) result = reclass(result, R) return(result) }, "PerformanceAnalytics" ) </code></pre> <p>Then your original command works:</p> <pre><code>&gt; data(managers) &gt; CAPM.alpha(managers[,1,drop=FALSE], managers[,8,drop=FALSE], Rf=.035/12) [1] 0.005960609 </code></pre> <p>Be aware that I have not verified that the function does what it purports to do.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload