can someone help me finding the right way (the also woks, because most of the attempts that I performed were not working) to check for autocorrelation when dealing with panel data FE? this is my work so far: //----------------------------*4. Original Model-----------------------------
*Preparation of the Work Environment
clear all
set more off
cd "/Users/catz/Desktop/Master in Finance/FEP- MÉTODOS ECONOMÉTRICOS/Assignment"
use "/Users/catz/Desktop/Master in Finance/FEP- MÉTODOS ECONOMÉTRICOS/Assignment/dataset.dta"
log using assigecon.log, replace
*Program Installation
ssc install asdoc
ssc install coefplot
net install dca, from("https://raw.github.com/ddsjoberg/dca.stata/master/")replace
*Database
use "dataset.dta", clear
global ylist firmgrowth
global xlist female_director directors_number board_size ceo_duality board_independence firmsize
describe c_id yr $ylist $xlist
summarize c_id yr $ylist $xlist
* Set data as panel data
sort c_id yr
xtset c_id yr
xtdescribe
xtsum c_id yr $ylist $xlist
///////////////////////////////*4.1.ORIGINAL MODEL//////////////////////////////////////
*Descriptive Statistics
describe c_id yr $ylist $xlist
summarize c_id yr $ylist $xlist
* Pooled OLS estimator
reg $ylist $xlist
* Population-averaged estimator
xtreg $ylist $xlist, pa
* Between estimator
xtreg $ylist $xlist, be
*Estimation of the Fixed Effects Model
xtreg $ylist $xlist, fe
estimates store fixed
*Estimation of the Random Effects Model
xtreg $ylist $xlist, re
estimates store random
* Breusch-Pagan LM test for random effects versus OLS
quietly xtreg $ylist $xlist, re
xttest0
*Hausman Test to Compare FE and RE
hausman fixed random, sigmamore
* The Hausman test shows significant differences between the coefficients for the fixed effects and random effects model. Therefore, we need to use the fixed effects model. *
Specification
xtreg $ylist $xlist, fe
predict yhat_fe, xb
gen yhat_fe2 = yhat_fe^2
gen yhat_fe3 = yhat_fe^3
xtreg $ylist $xlist yhat_fe2 yhat_fe3, fe
test yhat_fe2 yhat_fe3
////////////MULTICOLINEARITY/////////////////////////
global ylist firmgrowth
global xlist female_director board_size ceo_duality board_independence firmsize
//////////Correlation Matrix///////
pwcorr $xlist
///////////VIF////////////
regress $ylist $xlist
vif
////////////AUTOCORRELATION/////////////////////////
xtregar firmgrowth female_director directors_number board_size ceo_duality board_independence firmsize, fe
///////////////////////////////////////////////////////
* 5. HETEROSKEDASTICITY
///////////////////////////////////////////////////////
* Baseline pooled OLS
regress $ylist $xlist i.yr
* 5.1 Breusch–Pagan / Cook–Weisberg test
estat hettest
* 5.2 White's general test
estat imtest, white
* FIXED EFFECTS MODEL
xtreg $ylist $xlist i.yr, fe
* MODIFIED WALD TEST FOR GROUPWISE HETEROSKEDASTICITY
ssc install xttest3
xttest3
* MAIN FE MODEL – firm-clustered robust SE
xtreg $ylist $xlist i.yr, fe vce(cluster c_id)
*Preparation of the Work Environment
clear all
set more off
cd "/Users/catz/Desktop/Master in Finance/FEP- MÉTODOS ECONOMÉTRICOS/Assignment"
use "/Users/catz/Desktop/Master in Finance/FEP- MÉTODOS ECONOMÉTRICOS/Assignment/dataset.dta"
log using assigecon.log, replace
*Program Installation
ssc install asdoc
ssc install coefplot
net install dca, from("https://raw.github.com/ddsjoberg/dca.stata/master/")replace
*Database
use "dataset.dta", clear
global ylist firmgrowth
global xlist female_director directors_number board_size ceo_duality board_independence firmsize
describe c_id yr $ylist $xlist
summarize c_id yr $ylist $xlist
* Set data as panel data
sort c_id yr
xtset c_id yr
xtdescribe
xtsum c_id yr $ylist $xlist
///////////////////////////////*4.1.ORIGINAL MODEL//////////////////////////////////////
*Descriptive Statistics
describe c_id yr $ylist $xlist
summarize c_id yr $ylist $xlist
* Pooled OLS estimator
reg $ylist $xlist
* Population-averaged estimator
xtreg $ylist $xlist, pa
* Between estimator
xtreg $ylist $xlist, be
*Estimation of the Fixed Effects Model
xtreg $ylist $xlist, fe
estimates store fixed
*Estimation of the Random Effects Model
xtreg $ylist $xlist, re
estimates store random
* Breusch-Pagan LM test for random effects versus OLS
quietly xtreg $ylist $xlist, re
xttest0
*Hausman Test to Compare FE and RE
hausman fixed random, sigmamore
* The Hausman test shows significant differences between the coefficients for the fixed effects and random effects model. Therefore, we need to use the fixed effects model. *
Specification
xtreg $ylist $xlist, fe
predict yhat_fe, xb
gen yhat_fe2 = yhat_fe^2
gen yhat_fe3 = yhat_fe^3
xtreg $ylist $xlist yhat_fe2 yhat_fe3, fe
test yhat_fe2 yhat_fe3
////////////MULTICOLINEARITY/////////////////////////
global ylist firmgrowth
global xlist female_director board_size ceo_duality board_independence firmsize
//////////Correlation Matrix///////
pwcorr $xlist
///////////VIF////////////
regress $ylist $xlist
vif
////////////AUTOCORRELATION/////////////////////////
xtregar firmgrowth female_director directors_number board_size ceo_duality board_independence firmsize, fe
///////////////////////////////////////////////////////
* 5. HETEROSKEDASTICITY
///////////////////////////////////////////////////////
* Baseline pooled OLS
regress $ylist $xlist i.yr
* 5.1 Breusch–Pagan / Cook–Weisberg test
estat hettest
* 5.2 White's general test
estat imtest, white
* FIXED EFFECTS MODEL
xtreg $ylist $xlist i.yr, fe
* MODIFIED WALD TEST FOR GROUPWISE HETEROSKEDASTICITY
ssc install xttest3
xttest3
* MAIN FE MODEL – firm-clustered robust SE
xtreg $ylist $xlist i.yr, fe vce(cluster c_id)

Comment