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.
Related Posts with Issues with regression on Asset pricing Models (Panel data)
Weighted Tabulation by Multiple Groups -- Export to XLS or DTAHello, I am using YRBS data -- a student survey taken in each US state every other year. Each entry …
Modelling wind direction and fire spreadI'm interested in finding whether wind direction is a good predictor of the direction of fire spread…
Double Machine Learning (DML) in STATA (xporegress command)Dear all, I am trying to use the command that STATA has for DML (Cross-fit partialing-out lasso lin…
Assigning Continuous number to year and monthsHi all, I have date like this: date jan2015 jan2015 feb2015 march2015 march 2015 march2015 I want…
Question on Nick Cox's aaplotSorry for this post, but I have spent over an hour with the data and with the manual but I have a pr…
Subscribe to:
Post Comments (Atom)
0 Response to Issues with regression on Asset pricing Models (Panel data)
Post a Comment