[Uwgarp-commits] r56 - in pkg/GARPFRM: R demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jan 25 23:51:09 CET 2014


Author: tfillebeen
Date: 2014-01-25 23:51:09 +0100 (Sat, 25 Jan 2014)
New Revision: 56

Modified:
   pkg/GARPFRM/R/capm.R
   pkg/GARPFRM/demo/demo_CAPM.R
Log:
quick CAPM demo

Modified: pkg/GARPFRM/R/capm.R
===================================================================
--- pkg/GARPFRM/R/capm.R	2014-01-25 22:30:05 UTC (rev 55)
+++ pkg/GARPFRM/R/capm.R	2014-01-25 22:51:09 UTC (rev 56)
@@ -210,9 +210,7 @@
   tstat = (tmp_sm[2,2] - 1 )/tmp_sm[2,3]
   #' Two sided t-test
   tmp_B = (2*(1 - pt(abs(tstat),df=nrow(object$x_data)-1))) < CI
-  result = c(tmp_A, tmp_B)
-  result = as.matrix(result)
-  rownames(result) = cbind(c(paste("alpha.", colnames(object$y_data))),c(paste("beta. ", colnames(object$y_data))))
+  result = list(alpha = tmp_A, beta = tmp_B)
   return(result)
 }
 
@@ -225,6 +223,6 @@
   tstat = (tmp_sm[seq(2,nrow(tmp_sm),2),1] - 1 )/tmp_sm[seq(2,nrow(tmp_sm),2),2]
   #' Two sided t-test
   tmp_B = (2*(1 - pt(abs(tstat),df=nrow(object$x_data)-2))) < CI
-  result = c(tmp_A, tmp_B)  
+  result = list(alpha = tmp_A, beta = tmp_B)  
   return(result)
 }
\ No newline at end of file

Modified: pkg/GARPFRM/demo/demo_CAPM.R
===================================================================
--- pkg/GARPFRM/demo/demo_CAPM.R	2014-01-25 22:30:05 UTC (rev 55)
+++ pkg/GARPFRM/demo/demo_CAPM.R	2014-01-25 22:51:09 UTC (rev 56)
@@ -20,7 +20,6 @@
 hypTest(object,CI)
 
 # Plot data with regression line: with coefficients, and tstat specified on graph
-par(op)
 plot(object)
 
 
@@ -30,8 +29,8 @@
 object = CAPM(managers[,3:7], managers[,8])
 
 # Plot security market line
-par(op)
 chartSML(object)
+par(mfrow=c(1,1))
 
 # Retrieve alpha
 getAlphas(object)
@@ -47,5 +46,5 @@
 hypTest(object,CI)
 
 # Plot data with regression line: with coefficients, and tstat specified on graph
-par(op)
-plot(object)
\ No newline at end of file
+plot(object)
+par(mfrow=c(1,1))
\ No newline at end of file



More information about the Uwgarp-commits mailing list