i have panel data on a monthly basis over a time span of 14 years for 26 cities. Simply speaking, each monthly observation contains information about a respective city, the date of observation (e.g. "2014m1"), the temperature (ab_temp), as well as the Google Search Volume (DSVI_city) of that city in the given month.
I want to regress DSVI_city on ab_temp. I am told to:
1) Include year-month fixed effects in the regression
2) Cluster standard errors by city and year-month
I tried the following code:
Code:
. xtset city_id date Panel variable: city_id (unbalanced) Time variable: date, 2004m1 to 2017m12, but with gaps Delta: 1 month . xtreg DSVI_city ab_temp, fe vce(cluster city_id) Fixed-effects (within) regression Number of obs = 3,588 Group variable: city_id Number of groups = 26 R-squared: Obs per group: Within = 0.0004 min = 42 Between = 0.0061 avg = 138.0 Overall = 0.0004 max = 168 F(1,25) = 3.54 corr(u_i, Xb) = 0.0010 Prob > F = 0.0716 (Std. err. adjusted for 26 clusters in city_id) ------------------------------------------------------------------------------ | Robust DSVI_city | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- ab_temp | .0038789 .0020617 1.88 0.072 -.0003673 .0081252 _cons | -.0020442 .0005277 -3.87 0.001 -.0031311 -.0009573 -------------+---------------------------------------------------------------- sigma_u | .0168631 sigma_e | .59288721 rho | .00080831 (fraction of variance due to u_i) ------------------------------------------------------------------------------
My line of reasoning was that I thought it wouldn't make sense to cluster the standard errors by city and year-month, as this would give me as many clusters as observations (as for each city, there is only one unique year-month observation)...
Given on the information provided, could anyone be so kind and provide me with some feedback whether I implemented the code correctly?
(I am still quite new to Stata and already went through many different posts and explanations, but I am not sure if I understood everything properly...)
Thanks a lot in advance for your time and support-it is highly appreciated!
Samuel
0 Response to Running regression including fixed effects and clustered standard errors
Post a Comment