[R-SIG-Finance] Performance Analytics: table.CAPM
Joshua Ulrich
josh.m.ulrich at gmail.com
Fri Oct 17 02:33:39 CEST 2014
I get no errors when running your code with the most recent versions
of xts and PerformanceAnalytics on CRAN. Here's a simplified version
of your example:
library(PerformanceAnalytics)
ind <- as.yearmon(Sys.Date())-(4:1)/12
Ra <- xts(c(0.1,0.11,0.09,0.1), ind)
Rb <- xts(c(0.25,0.2,-0.4,0.01), ind)
CAPM.alpha(Ra, Rb)
table.CAPM(Ra, Rb)
Best,
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
On Wed, Oct 15, 2014 at 4:28 PM, Charles Duranceau <cduranceau at nial.ky> wrote:
> Hi,
> I noticed a problem with the function : table.CAPM when it return following error message: "Error in NextMethod(.Generic) : dims [product 4] do not match the length of object [0]"
> I noticed in a previous post the solution is to transform series in xts, but in this case the series is already a xts object.
> I don't understand as other similar functions works well as the following code shows
>
> library("xts", lib.loc="C:/Users/cduranceau/Documents/R/win-library/3.1")
> library("PerformanceAnalytics", lib.loc="C:/Users/cduranceau/Documents/R/win-library/3.1")
> # Define Returns
> pf1<-c(0.1,0.11,0.09,0.1)
> bm<-c(0.25,0.2,-0.4,0.01)
> time_index<-seq(as.Date("2003/05/01"), by = "month", length.out = 4)-1 # last day of the month
> pf1x<-as.xts(pf1,time_index)
> bmx<-as.xts(bm,time_index)
>
>
> CAPM.alpha(pf1x, bmx, Rf = 0) # works [1] 0.09965609
> table.CAPM(pf1x,bmx,Rf=0) # error
>
> Is there a way to solve the issue?
> Thank you
>
> Best Regards,
>
>
> Version info
>
> platform x86_64-w64-mingw32
> arch x86_64
> os mingw32
> system x86_64, mingw32
> status
> major 3
> minor 1.0
> year 2014
> month 04
> day 10
> svn rev 65387
> language R
> version.string R version 3.1.0 (2014-04-10)
> nickname Spring Dance
>
>
> package:
>
> Package:
>
> "PerformanceAnalytics" VERSION 1.4.3541 from CRAN ---- project.org/bin/windows/contrib/3.1/PerformanceAnalytics_1.4.3541.zip
>
> Charles
>
More information about the R-SIG-Finance
mailing list