Hi,
I have recently started using Stata for analysis and currently using Stata 16.
I have a panel dataset with N=73 and T= 40 .
I am trying to run an xtreg with fixed effects estimator and robust standard errors. Below is a small sample from my dataset.
Some explanations about the variables:
The 'BEMEclass' is a grouping variable based on the variable 'LnBEME_t'. There are 3 classes.
'company' is the numerical variable for company name 'conm'
'time' represents the year and quarter
'Dtime' is a dummy variable for US business cycle.
My dependent variable is 'LnBEME_t'
Independent variable is 'DOL_t'
Control variables are 'DFL_t' 'Size_t' and 'Dtime'
I am conducting a class effect analysis and hence would like to run the following model by my grouping variable 'BEMEclass':
but Stata returned the following error :
Stata returned a similar error when I tried to run the model using an 'if' statement:
Error message from Stata -
Could you please help me to understand what I am doing wrong and how I can correct my code?
When I do the regressions by group, I would also like to compare the slopes for my 3 groups to check whether they are statistically different from one another (My hypothesis says that 'The relationship between LnBEME_t and DOL_t are different in different classes'). Would you be able to guide me how I could achieve this?
Appreciate you help and thank you in advance for your guidance!
I have recently started using Stata for analysis and currently using Stata 16.
I have a panel dataset with N=73 and T= 40 .
I am trying to run an xtreg with fixed effects estimator and robust standard errors. Below is a small sample from my dataset.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float BEMEclass str58 conm float company int time float(LnBEME_t DOL_t DFL_t Size_t Dtime) 1 "PRIME HOSPITALITY CORP" 49 19791 -1.8245335 -1.1581018 -1.1047124 3.917138 1 1 "WRATHER CORP" 72 19791 -.8752389 -.7245747 .05811504 3.5747864 1 2 "HOLIDAY CORP" 25 19791 .1195223 -.3968062 -.6217715 6.209769 1 2 "HILTON WORLDWIDE HOLDINGS" 24 19791 -.740373 .06960483 .2070304 6.505733 1 2 "LA QUINTA INNS INC" 41 19791 -.5981131 -.775349 -.55409545 3.951555 1 2 "UNITED INNS INC" 69 19791 .036893275 -.06610228 .0005845402 3.896206 1 . "INTEGRA A HOTEL & REST" 34 19791 . . . . 1 2 "STARWOOD HOTELS&RESORTS WRLD" 61 19791 .05225944 -.2438383 .8940904 3.253161 1 3 "SONESTA INTL HOTELS -CL A" 58 19791 .607038 .6507948 .2281304 2.0617862 1 . "INTEGRA A HOTEL & REST" 34 19792 . . . . 1 3 "SONESTA INTL HOTELS -CL A" 58 19792 .4997963 .7421679 .5022304 2.2415597 1 2 "HILTON WORLDWIDE HOLDINGS" 24 19792 -.7580439 .09438264 .2898394 6.611725 1 2 "STARWOOD HOTELS&RESORTS WRLD" 61 19792 -.069438085 -.1728168 .9605785 3.462637 1 1 "PRIME HOSPITALITY CORP" 49 19792 -1.4942898 -1.1155328 -1.0496894 3.6879525 1 2 "LA QUINTA INNS INC" 41 19792 -.57335716 -.4596104 .09961627 4.029958 1 2 "UNITED INNS INC" 69 19792 .05421631 -.05443614 .0904639 3.92888 1 1 "WRATHER CORP" 72 19792 -.9886482 -.28205767 .29344016 3.703078 1 2 "HOLIDAY CORP" 25 19792 .03862377 -.3432194 -.02962402 6.325035 1 1 "WRATHER CORP" 72 19793 -.9851251 -.2139741 .2554611 3.7035215 1 . "INTEGRA A HOTEL & REST" 34 19793 . . . . 1 2 "STARWOOD HOTELS&RESORTS WRLD" 61 19793 -.13669619 -.28015187 .8684896 3.53726 1 1 "PRIME HOSPITALITY CORP" 49 19793 -1.3247973 -1.0956434 -1.2319292 3.633464 1 2 "HILTON WORLDWIDE HOLDINGS" 24 19793 -.7674752 .06290034 .3157985 6.68789 1 2 "LA QUINTA INNS INC" 41 19793 -.6475502 -.3386415 .1960283 4.166412 1 2 "HOLIDAY CORP" 25 19793 -.017402153 -.2983353 -.011736955 6.448889 1 2 "UNITED INNS INC" 69 19793 -.17868084 -.04132706 .20555335 4.177835 1 3 "SONESTA INTL HOTELS -CL A" 58 19793 .3476222 .7199947 .18339583 2.424404 1 3 "SONESTA INTL HOTELS -CL A" 58 19794 .49936935 .7884633 .3314063 2.2671385 1 . "INTEGRA A HOTEL & REST" 34 19794 . -.02301322 .4371954 . 1 2 "UNITED INNS INC" 69 19794 -.2555085 -.06454376 -.1651368 4.166851 1 end
The 'BEMEclass' is a grouping variable based on the variable 'LnBEME_t'. There are 3 classes.
'company' is the numerical variable for company name 'conm'
'time' represents the year and quarter
'Dtime' is a dummy variable for US business cycle.
My dependent variable is 'LnBEME_t'
Independent variable is 'DOL_t'
Control variables are 'DFL_t' 'Size_t' and 'Dtime'
I am conducting a class effect analysis and hence would like to run the following model by my grouping variable 'BEMEclass':
Code:
by BEMEclass: xtreg LnBEME_t DOL_t DFL_t Size_t Dtime, fe vce (robust)
Code:
the by prefix may not be used with vce() option
Code:
xtreg LnBEME_t DOL_t DFL_t Size_t Dtime, fe vce (robust) if BEMEclass ==1
Code:
option if not allowed r(198);
When I do the regressions by group, I would also like to compare the slopes for my 3 groups to check whether they are statistically different from one another (My hypothesis says that 'The relationship between LnBEME_t and DOL_t are different in different classes'). Would you be able to guide me how I could achieve this?
Appreciate you help and thank you in advance for your guidance!
Comment