[Uwgarp-commits] r44 - in pkg/GARPFRM: R sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 20 19:17:06 CET 2014


Author: tfillebeen
Date: 2014-01-20 19:17:06 +0100 (Mon, 20 Jan 2014)
New Revision: 44

Modified:
   pkg/GARPFRM/R/capm.R
   pkg/GARPFRM/sandbox/test_capm_rb.R
Log:
plot and working on getStatistics

Modified: pkg/GARPFRM/R/capm.R
===================================================================
--- pkg/GARPFRM/R/capm.R	2014-01-14 17:17:49 UTC (rev 43)
+++ pkg/GARPFRM/R/capm.R	2014-01-20 18:17:06 UTC (rev 44)
@@ -126,7 +126,7 @@
   # Multi-Beta CAPM
   x <- coef(summary(object))
   tmp_sm <- do.call(rbind, x)
-  holder = holder<-matrix(0,nrow=1,ncol=ncol(ncol(coef(tmp)))*2)
+  holder = holder<-matrix(0,nrow=1,ncol=ncol(ncol(coef(object)))*2)
   n = 1
   for (i in 1:ncol(ncol(coef(tmp)))){
     tmpHolder = cbind(c(paste("alpha.",colnames(ncol(coef(tmp)))[i])) ,c(paste("beta.",colnames(managers[,3:4])[i])))
@@ -143,4 +143,12 @@
   ylab <- colnames(object$y_data)
   plot(x=coredata(object$x_data), y=(object$y_data), xlab=xlab, ylab=ylab, main="CAPM Plot")
   abline(object)
+  abline(h=0,v=0,lty=3)
+  alpha = coef(summary(object))[1,1]
+  a_tstat = coef(summary(object))[1,3]
+  beta = coef(summary(object))[2,1]
+  b_tstat = coef(summary(object))[2,3]
+  legend("topleft", legend=c(paste("alpha =", round(alpha,dig=2),"(", round(a_tstat,dig=2),")"),
+                             paste("beta =", round(beta,dig=2),"(", round(b_tstat,dig=2),")")), cex=.8, bty="n")
+  
 }

Modified: pkg/GARPFRM/sandbox/test_capm_rb.R
===================================================================
--- pkg/GARPFRM/sandbox/test_capm_rb.R	2014-01-14 17:17:49 UTC (rev 43)
+++ pkg/GARPFRM/sandbox/test_capm_rb.R	2014-01-20 18:17:06 UTC (rev 44)
@@ -1,4 +1,3 @@
-
 library(GARPFRM)
 data(crsp.short)
 



More information about the Uwgarp-commits mailing list