[Uwgarp-commits] r18 - pkg/GARPFRM/vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 26 22:28:59 CET 2013


Author: tfillebeen
Date: 2013-11-26 22:28:58 +0100 (Tue, 26 Nov 2013)
New Revision: 18

Modified:
   pkg/GARPFRM/vignettes/sample_vignette.Rnw
Log:
Consumption + 60 sample size

Modified: pkg/GARPFRM/vignettes/sample_vignette.Rnw
===================================================================
--- pkg/GARPFRM/vignettes/sample_vignette.Rnw	2013-11-26 07:02:51 UTC (rev 17)
+++ pkg/GARPFRM/vignettes/sample_vignette.Rnw	2013-11-26 21:28:58 UTC (rev 18)
@@ -42,10 +42,7 @@
 
 \begin{abstract}
 Standard Capital Asset Pricing Model (CAPM) fitting and testing using Quandl data.
-Efficient Frontier w/ constraints options: short-sale and borrowing
 
-Standard Capital Asset Pricing Model
-
 CAPM Assumptions
 1. Identical investors who are price takers;
 2. Investment over the same time horizon; 
@@ -53,6 +50,8 @@
 4. Can borrow and lend at risk-free rate;
 5. Investors only care about portfolio expected return and variance;
 6. Market consists of all publicly traded assets.
+
+The Consumption-Oriented CAPM is analogous to the simple form of the CAPM. Except that the growth rate of per capita consumption has replaced the rate of return on the market porfolio as the influence effecting returns.
 \end{abstract}
 
 \tableofcontents
@@ -93,9 +92,9 @@
 
 \subsection{Fitting CAPM Model}
 <<ex4>>=
-# Run CAPM regression for AAPL (AAPL) using first 4 years
-# 48 months divided by 12 months in a years = 4 years
-capm.fit = lm(AAPL~MARKET,data=exReturns.df,subset=1:48)
+# Run CAPM regression for AAPL (AAPL) using first 5 years
+# 60 months divided by 12 months in a years = 5 years
+capm.fit = lm(AAPL~MARKET,data=exReturns.df,subset=1:60)
 summary(capm.fit)
 
 # Plot data with regression line
@@ -107,17 +106,18 @@
 abline(capm.fit)    
 # Create Axis 
 abline(h=0,v=0,lty=3)
-# Setting beta & tstat on the plot for APPL
+# Placing beta & tstat values on the plot for APPL
 beta = coef(summary(capm.fit))[2,1]
 text(x=-.15, y=.3, paste("Beta=", round(beta,dig=2)))
-text(x=-.148, y=.27, paste("tstat=", round(coef(summary(capm.fit))[1,3],dig=2)))
+tstat = coef(summary(capm.fit))[1,3]
+text(x=-.148, y=.27, paste("tstat=", round(tstat,dig=2)))
 @
 
 \section{Testing CAPM}
 \subsection{Created CAPM Function}
 <<ex5>>=
 # Use a capm.tstats function:
-  # Estimating CAPM with alpha=0 for asset using first 4 years of data
+  # Estimating CAPM with alpha=0 for asset using first 5 years of data
 capm.tstats = function(r,mkrt) {
   # Fiting CAPM
   capm.fit = lm(r~mkrt)  	
@@ -130,11 +130,11 @@
 @
 \subsection{Estimate Significance and Test Beta Results}
 <<ex6>>=
-# Retrieve tstats from function for 2 assets: WFC & AAPL
+# # Retrieve tstats from function for assets
   # Filter out rf and market before running
-colnames(exReturns.mat[,-c(1,6)])
-tstats = apply(exReturns.mat[1:48,-c(1,6)],2, capm.tstats,
-               exReturns.mat[1:48,"MARKET"])
+colnames(exReturns.mat[,-c(1,6,7)])
+tstats = apply(exReturns.mat[1:60,-c(1,6,7)],2, capm.tstats,
+               exReturns.mat[1:60,"MARKET"])
 tstats
 
 # Test Hypothesis for 5% CI: H0: alpha=0
@@ -145,11 +145,11 @@
 \subsection{Estimate Expect Returns and Plot}
 <<ex7>>=
 # Plot expected return versus beta
-# Estimate expected returns over first 4 years
-mu.hat = colMeans(exReturns.mat[1:48,-c(1,6)])
+# Estimate expected returns over first 5 years
+mu.hat = colMeans(exReturns.mat[1:60,-c(1,6,7)])
 mu.hat
 
-# Compute beta over first 4 years
+# Compute beta over first 5 years
 capm.betas = function(r,market) {
   capm.fit = lm(r~market)  				
   # Fit capm regression
@@ -158,14 +158,42 @@
   capm.beta
 }
 
-betas = apply(exReturns.mat[1:48,-c(1,6)],2,
+betas = apply(exReturns.mat[1:60,-c(1,6,7)],2,
               
               FUN=capm.betas,
-              market=exReturns.mat[1:48,"MARKET"])
+              market=exReturns.mat[1:60,"MARKET"])
 betas
 
 # Plot expected returns versus betas
 plot(betas,mu.hat,main="Expected Return vs. Beta")
 @
 
+\section{Consumption-Oriented CAPM}
+\subsection{Fitting C-CAPM}
+<<ex8>>=
+# Run C-CAPM regression for CONS (Consumption) using first 5 years
+# 60 months divided by 12 months in a years = 5 years
+capm.fit = lm(CONS~MARKET,data=exReturns.df,subset=190:250)
+summary(capm.fit)
+
+# Plot data with regression line
+plot(exReturns.df$MARKET,exReturns.df$CONS, main="CAPM for CONS",
+     
+     ylab="Excess Return: CONS",
+     xlab="Excess Return: MARKET")
+# Plot C-CAPM regression estimate
+abline(capm.fit)    
+# Create Axis 
+abline(h=0,v=0,lty=3)
+# Placing beta & tstat values on the plot for APPL
+cbeta = coef(summary(capm.fit))[2,1]
+text(x=-.165, y=1.2, paste("Beta=", round(cbeta,dig=2)))
+tstat = coef(summary(capm.fit))[1,3]
+text(x=-.165, y=1.0, paste("tstat=", round(tstat,dig=2)))
+# NOTE: Specific problems with CCAPM is that it suffers from two puzzles: the 
+# equity premium puzzle (EPP) and the risk-free rate puzzle (RFRP). EPP implies 
+# that investors are extremely risk averse to explain the existence of a market 
+# risk premium. While RFRP stipulates that investors save in TBills despite the 
+# low rate of return.
+@
 \end{document}



More information about the Uwgarp-commits mailing list