Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 580

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 583

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 586

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 589

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 592

Warning: Cannot modify header information - headers already sent by (output started at /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php:580) in /home/calcul9/public_html/wp-includes/feed-rss2-comments.php on line 8
Comments on: Screencast: Fama-French Regression Tutorial Using R https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/ Tue, 28 Apr 2020 16:38:11 +0000 hourly 1 https://wordpress.org/?v=5.8.9 By: Dr.K.Dhanasekaran,Ph.D., https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-406453 Tue, 28 Apr 2020 16:38:11 +0000 http://www.calculatinginvestor.com/?p=2605#comment-406453 very useful

]]>
By: Sajad https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-331431 Mon, 18 Dec 2017 05:30:43 +0000 http://www.calculatinginvestor.com/?p=2605#comment-331431 In reply to Nefertiti.

at first use setwd() function to set your directory where you saved ur file
the use read.csv(” your file name.csv”) to read it

]]>
By: Peter Gregory https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-321349 Fri, 13 Jan 2017 15:39:54 +0000 http://www.calculatinginvestor.com/?p=2605#comment-321349 In reply to calcinv.

Thanks for your comment on percentages. I am having difficulty reproducing the results because nowhere have I found whether the monthly FF data is percentages (which you confirm, thank you), but is it annualized percentages or percentages on the month, and if annualized, is it compounded or not. Very frustrating that an academic site does not define precisely what the data represents!

Thanks, in anticipation!

]]>
By: Shuhua https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-305930 Thu, 03 Dec 2015 04:42:57 +0000 http://www.calculatinginvestor.com/?p=2605#comment-305930 Hi, sir

Thanks for your helpful tutorial. We all download these factor from French’s data library. But how does he construct these 25 portfolios? Since I’m trying to construct the 3 factors using Chinese stock market’s data, I have to construct these portfolios by myself. Could you give me some help on constructing FF’s 25 portfolios? Thanks in advance.

Kind Regards,
Shuhua

]]>
By: Alex https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-288161 Wed, 08 Jul 2015 16:43:56 +0000 http://www.calculatinginvestor.com/?p=2605#comment-288161 I am testing the a couple of CAPM based models for my dissertation, and I have a healthy amount of stocks to regress, 5000 according to my last calculations, they’d have to be done as 75 stocks at a time, (in a portfolio). The number makes it an unrealistic task to accomplish manually, I have tried to build on the scipts Ive found here, which were of extreme use, however I lack the skills to make it actually work, I can post a copy of my modified script and if possible I can send you a copy of one of my excel sheets to figure out if that is the root of the problem.
my script, its probably primitive and vulgar. Any help is greatly appreciated.
Thank you in advanced.
Hameedalmaa@gmail.com

# Fama-French Regression example in R

# Load CSV file into R
ff_data <- read.table("ffdata.csv",header=TRUE,sep=",")

# Extract Fama-French Factors and Fund Returns
rmrf <- ff_data[,1]
smb <- ff_data[,2]
hml <- ff_data[,3]
rf <- ff_data[,4]
fund1 <- ff_data[,5]
fund2 <- ff_data[,6]
fund3 <- ff_data[,7]
fund4 <- ff_data[,8]
fund5 <- ff_data[,9]
fund6 <- ff_data[,10]
fund7 <- ff_data[,11]
fund8 <- ff_data[,12]
fund9 <- ff_data[,13]
fund10 <- ff_data[,14]
fund11 <- ff_data[,15]
fund12 <- ff_data[,16]
fund13 <- ff_data[,17]
fund14 <- ff_data[,18]
fund15 <- ff_data[,17]
fund16 <- ff_data[,20]
fund17 <- ff_data[,21]
fund18 <- ff_data[,22]
fund19 <- ff_data[,23]
fund20 <- ff_data[,24]
fund21 <- ff_data[,25]
fund22 <- ff_data[,26]
fund23 <- ff_data[,27]
fund24 <- ff_data[,28]
fund25 <- ff_data[,29]
fund26 <- ff_data[,30]
fund27 <- ff_data[,31]
fund28 <- ff_data[,32]
fund29 <- ff_data[,33]
fund30 <- ff_data[,34]
fund31 <- ff_data[,35]
fund32 <- ff_data[,36]
fund33 <- ff_data[,37]
fund34 <- ff_data[,38]
fund35 <- ff_data[,39]
fund36 <- ff_data[,40]
fund37 <- ff_data[,41]
fund38 <- ff_data[,42]
fund39 <- ff_data[,43]
fund40 <- ff_data[,44]
fund41 <- ff_data[,45]
fund42 <- ff_data[,46]
fund43 <- ff_data[,47]
fund44 <- ff_data[,48]
fund45 <- ff_data[,49]
fund46 <- ff_data[,50]
fund47 <- ff_data[,51]
fund48 <- ff_data[,52]
fund49 <- ff_data[,53]
fund50 <- ff_data[,54]
fund51 <- ff_data[,55]
fund52 <- ff_data[,56]
fund53 <- ff_data[,57]
fund54 <- ff_data[,58]
fund55 <- ff_data[,59]
fund56 <- ff_data[,60]
fund57 <- ff_data[,61]
fund58 <- ff_data[,62]
fund59 <- ff_data[,63]
fund60 <- ff_data[,64]
fund61 <- ff_data[,65]
fund62 <- ff_data[,66]
fund63 <- ff_data[,67]
fund64 <- ff_data[,68]
fund65 <- ff_data[,69]
fund66 <- ff_data[,70]
fund67 <- ff_data[,71]
fund68 <- ff_data[,72]
fund69 <- ff_data[,73]
fund70 <- ff_data[,74]
fund71 <- ff_data[,75]
fund72 <- ff_data[,76]
fund73 <- ff_data[,77]

ffregression <- lm(fund1 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

ffregression <- lm(fund2 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

ffregression <- lm(fund3 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

ffregression <- lm(fund4 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

ffregression <- lm(fund5 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

ffregression <- lm(fund6 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

ffregression <- lm(fund7 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

ffregression <- lm(fund8 ~ rmrf + smb + hml)
# Print summary of regression results
print(summary(ffregression))}

]]>
By: Trinhngoc https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-267272 Mon, 23 Mar 2015 07:30:35 +0000 http://www.calculatinginvestor.com/?p=2605#comment-267272 Hello, thanks for your helpfull document. I’m vietnamese. Now I would like to apply fama french model in Viet Nam market . Apply for Hose martket with 298 company and time to study form 2009 to2013. There is something i dont understand : what is fund in your code ? “. As I mean is that average return of stocks in each year. Is that right? And would you please give me some codes in R for testing estimate model? Thank you very much

]]>
By: Alex https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-252242 Mon, 19 Jan 2015 23:32:27 +0000 http://www.calculatinginvestor.com/?p=2605#comment-252242 Here is another alternative. I’m using of the same regression using GLS, AR(1,1) and Maximum Likelyhood. I’m including Fraziini BAB and QMJ return factors together with Fama and French 5 factors. The parameters can be added or removed according to preference and type of investment strategy used.


# Load data into R
setwd("/Users/alexbadoi/Desktop/College/Postgrad/Master/Seminar Pc/R")
ff_data = read.csv("ff5_bab_qmj.csv", header = TRUE, sep=",")
library(nlme)

# Extract Fama-French Factors + Momentum + Franziini Factors
rmrf <- ff_data[,2]/100
rf <- ff_data[,7]/100
smb <- ff_data[,3]/100
hml <- ff_data[,4]/100

rmw <- ff_data[,5]/100
cma <- ff_data[,6]/100

umd <- ff_data[,8]
bab <- ff_data[,9]/100
qmj <- ff_data[,10]/100

for(i in 11:18){ #Loop across rows of assets
fund <- ff_data[,i]/100
fund.xcess <- fund - rf
ffgls <- gls(fund.xcess ~ rmrf + smb + hml + rmw + cma,
correlation=corARMA(p=1, q=1), method='ML')
print(summary(ffgls))
}

]]>
By: Moritz https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-214438 Tue, 08 Jul 2014 15:52:28 +0000 http://www.calculatinginvestor.com/?p=2605#comment-214438 In reply to amir.

Thanks for the updated code, really helpful! I have a further question, however: How can you export all of the regression outputs and how do you see which regression summary corresponds to which fund?

Cheers,
M

]]>
By: Leo https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-206766 Thu, 10 Apr 2014 21:59:01 +0000 http://www.calculatinginvestor.com/?p=2605#comment-206766 Thank you very much! It worked! It is just that it didn’t read the file until I rewrote the first line:

# Load CSV file into R
df <- read.table("ffdata.csv",header=TRUE,sep=",")

# Extract Fama-French Factors and Fund Returns
rmrf <- df[,2]
smb <- df[,3]
hml <- df[,4]
rf <- df[,5]
fund <- df[,6]

]]>
By: Roy https://www.calculatinginvestor.com/2011/04/19/fama-french-tutorial/#comment-180244 Sat, 04 May 2013 14:46:19 +0000 http://www.calculatinginvestor.com/?p=2605#comment-180244 Hi,
I am very happy with this tutorial 🙂
For my research, it is essential to know how you get the returns of firms like FMAGX.

Via my University I get access to CRSP, CRSP has a lot of possible variables to use. I was wondering which variable to use to get the monthly return of a firm. The variable called ‘holding period return’ seems like the most compared to your data. Please could someone give their opinion.

Thanks in advance!

]]>