Hello everyone,
I have a total of 202 observations for the US on a monthly basis from 2004-2017. I want to regress the monthly search volume (DSVI_country) on one independent variable (total_c), including year_month fixed effects.
I declared my data as panel data:
Originally, I wanted to run the regression using xtreg. However, stata returns an error:
I confirmed that I have no missing values and all values are non-string. Could it be that I have too few observations? Or is xtreg not working since I have a T>N panel dataset?
I tried using xtregar as an alternative, however, it does not seem to work either:
Running the code above without "i.year_month" worked, but I am not sure whether in this case I am still including my year-month fixed effects?
I would be very glad if someone could provide me with a hint on how I could run this regression including year-month fixed effects.
Thank you so much in advance for your time!
Samuel
I have a total of 202 observations for the US on a monthly basis from 2004-2017. I want to regress the monthly search volume (DSVI_country) on one independent variable (total_c), including year_month fixed effects.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str13 country float(country_id year_month DSVI_country total_c) "united states" 1 529 12.667176 140 "united states" 1 530 9.074037 162 "united states" 1 531 -18.523067 205 "united states" 1 532 13.853467 565 "united states" 1 533 -6.838091 549 end format %tm year_month
Code:
. xtset country_id year_month Panel variable: country_id (strongly balanced) Time variable: year_month, 2004m2 to 2020m11 Delta: 1 month . xtdes country_id: 1, ., ..., 1 n = 1 year_month: 2004m2, 2004m3, ..., 2020m11 T = 202 Delta(year_month) = 1 month Span(year_month) = 202 periods (country_id*year_month uniquely identifies each observation) Distribution of T_i: min 5% 25% 50% 75% 95% max 202 202 202 202 202 202 202 Freq. Percent Cum. | Pattern* ---------------------------+-------------------------------------------------------------------------------------------------------- 1 100.00 100.00 | 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 ---------------------------+-------------------------------------------------------------------------------------------------------- 1 100.00 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ------------------------------------------------------------------------------------------------------------------------------------ *Each column represents 2 periods.
Code:
. xtreg DSVI_country total_c i.year_month, fe no observations r(2000);
I tried using xtregar as an alternative, however, it does not seem to work either:
Code:
. xtregar DSVI_country total_c i.year_month, fe time variable may not be included in varlist r(198);
I would be very glad if someone could provide me with a hint on how I could run this regression including year-month fixed effects.
Thank you so much in advance for your time!
Samuel
Comment