Hello,
I am writing my master's thesis; however, I have not reached a standstill regarding running my statistical tests. This is my first post on the forum and my last resort to progress further my the statistical part of my thesis.
I am studying the relationship between ESG ratings and abnormal stock returns. My methodology is to test this through i)CAPM, ii) Fama-French 3-Factor and iii) Carhart 4-Factor by sorting ESG rating changes into three portfolios (1 - low ESG to 5- high ESG). Thus I will test this using portfolio sorting and testing each portfolio against each capital asset pricing model presented above. I aim to have a table output as the following:
My data is sorted in a panel format like the following:
comp_code comp_name year MktRf RF excess_return ESGScore_5
Since my data is oriented in this format, each firm will have 11 observations between 2010 and 2021. As such, the years 2010-2021 are reoccurring during many instances in the year's column.
I sorted the ESG scores into portfolios using the following command:
#Create 5 equally sized portfolioes formed on ESG_Score
xtile ESGScore_5 = ESG_Score, nq(5)
Initially, I thought that I could run the regression in this format using the xtfmb command. Still, I am running into issues here: I also wanted to understand if I can run the regression using the xtfmb command for my separate portfolios (1-5) from the column ESG_Score.
xtfmb excess_return MktRf
time variable not set, use tsset varname ...
r(111);
. tsset year
repeated time values in sample
r(451);
Having struggled with this, I spoke to a fellow student who suggested I take a different approach (code presented below).
#Create 5 equal weighted portfolios
collapse excess_return [aweight = 1], by(year ESGScore_5)
#Reshape data
reshape wide excess_return, i(year) j(ESGScore_5)
#merge with 3-factor
merge 1:1 year using "/Users/sebastiansardal/Documents/General/Finance & Investment Rotterdam School of Management/Master Thesis/STATA/Europe_Factors.dta"
#merge with MOM-factor
merge 1:1 year using "/Users/sebastiansardal/Documents/General/Finance & Investment Rotterdam School of Management/Master Thesis/STATA/ Europe_MOM_Factor.dta"
#Drop unmatched variables
drop if missing(excess_return1)
#drop _merge variable
drop _merge
#CAPM regression (needs to be done for each portfolio [1-5])
reg excess_return1 mktrf
reg excess_return2 mktrf
reg excess_return3 mktrf
reg excess_return4 mktrf
reg excess_return5 mktrf
#Long-short portfolio
gen LS = excess_return5-excess_return1
#Regression for long-short portfolio
reg LS mktrf
#Multilinear regression (needs to be done to all portfolio s[1-5]) -> 3-factor
reg excess_return1 mktrf smb hml
reg excess_return2 mktrf smb hml
reg excess_return3 mktrf smb hml
reg excess_return4 mktrf smb hml
reg excess_return5 mktrf smb hml
#Multilinear regression (needs to be done to all portfolio s[1-5]) -> 4-factor
reg excess_return1 mktrf smb hml wml
reg excess_return2 mktrf smb hml wml
reg excess_return3 mktrf smb hml wml
reg excess_return4 mktrf smb hml wml
reg excess_return5 mktrf smb hml wml
I would be immensely helpful for some guidance on this matter.
0 Response to Issues with regression on Asset pricing Models (Panel data)
Post a Comment