Estimate the Fama and French Three Factor Model

Estimate the three-factor model for a particular portfolio

Load the data from the page on the generation of the sample with size portfolio excess returns and the three factors.

Since the data are already prepared for the estimation, you just have to choose which portfolio type you want to analyse (here I chose the portfolio with firms of the second lowest decile, Dec.2), enter the formula and specify the data set. Run the commands from below to see the results.

load("3factors_size_portfolios.RData")

lm.Dec.2<-lm(Dec.2 ~ mkt.rf + smb + hml, data=sample)
summary(lm.Dec.2)

Estimate the three-factor model for more than one portfolio

Usually we want to estimate the loadings of the three factors over a range of portfolios to compare them. For this purpose we first generate a frame with n (the amount of portfolios) columns and 10 rows for the four coefficients (intercept, market return, SMB and HML) and their t-statistics along with the number of observations and the R-squared of the regressions.

n<-19 # Number of portfolios
coeffs<-as.data.frame(matrix(nrow=2*4+2,ncol=n)) # Create the table
names(coeffs)<-names(sample)[2:(n+1)] # Specify the names of the table's columns
attributes(coeffs)$row.names<-c("Intercept","t.Intercept","mkt.rf","t.mkt.rf","smb","t.smb","hml","t.hml","Obs","R-squared") # Name the rows appropriately

The regressions are performed within a loop, where portfolio returns are estimated on the three factors like above. Then, the relevant values are extracted and pasted into the parameter frame. You might want to round the values afterwards since the estimates will include a lot of digits.

for (i in 1:n){
  lm<-lm(sample[,(i+1)] ~ mkt.rf + smb + hml, data=sample) # Estimate the model
  coeffs[c(1,3,5,7),i]<-summary(lm)$coefficients[,1] # Paste the coefficients into the right rows
  coeffs[c(2,4,6,8),i]<-summary(lm)$coefficients[,3] # Paste the t-statistics into the right rows
  coeffs[9,i]<-length(lm$model[,1]) # Paste the number of used observations into the right row
  coeffs[10,i]<-summary(lm)$r.squared # Paste the R-squared into the right row
}
coeffs<-round(coeffs,digits=3) # Round the results for better readability

Finally, look at the results.

# Quintiles
coeffs[,5:9]

# Deciles
coeffs[,10:19]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s