[Uwgarp-commits] r54 - pkg/GARPFRM/demo
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 25 22:23:53 CET 2014
Author: tfillebeen
Date: 2014-01-25 22:23:53 +0100 (Sat, 25 Jan 2014)
New Revision: 54
Added:
pkg/GARPFRM/demo/demo_CAPM.R
Log:
quick CAPM demo draft
Added: pkg/GARPFRM/demo/demo_CAPM.R
===================================================================
--- pkg/GARPFRM/demo/demo_CAPM.R (rev 0)
+++ pkg/GARPFRM/demo/demo_CAPM.R 2014-01-25 21:23:53 UTC (rev 54)
@@ -0,0 +1,51 @@
+library(PerformanceAnalytics)
+data(managers)
+
+# Univariate CAPM
+# Run CAPM regression
+# Fiting CAPM
+object = CAPM(managers[,3], managers[,8])
+
+# Retrieve alpha
+getAlphas(object)
+# Retrieve beta
+getBetas(object)
+# Retrieve statistics
+getStatistics(object)
+# Run Hypothesis test where default is CI: 5%
+# For alpha = 0 and beta = 1 two-tail test
+hypTest(object)
+#Run hypothesis test for CI: 10%
+CI = 0.1
+hypTest(object,CI)
+
+# Plot data with regression line: with coefficients, and tstat specified on graph
+par(op)
+plot(object)
+
+
+# Multiple Linear Model CAPM
+# Run CAPM regression
+# Fiting CAPM
+object = CAPM(managers[,3:7], managers[,8])
+
+# Plot security market line
+par(op)
+chartSML(object)
+
+# Retrieve alpha
+getAlphas(object)
+# Retrieve beta
+getBetas(object)
+# Retrieve statistics
+getStatistics(object)
+# Run Hypothesis test where default is CI: 5%
+# For alpha = 0 and beta = 1 two-tail test
+hypTest(object)
+#Run hypothesis test for CI: 10%
+CI = 0.1
+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
More information about the Uwgarp-commits
mailing list