I have data at the physician-hospital-ym level (ym=year/month). A given physician may work in multiple hospitals at the same year/month.
I started off by running FE regressions (using -reghdfe- command) absorbing physician FE as well as hospital-ym FE. I could estimate the model but thought I was absorbing too much of the variation. Then, I ran the same regression specification but now absorbing hospital FE and ym FE instead of hospital-ym FE. To my surprise I got the following message "Warning: variance matrix is nonsymmetric or highly singular" and Stata did not output the coefficients SEs. I thought the first model was more restrictive than the second model so I did not quite understand what happened.
Then, I ran the same regression model but now only including one FE at a time. I did not get any warning message when estimating the regressions with physician FE and that with hospital FE. However, I got the warning message when estimating the regression with ym FE. When I run this same model using -areg- instead of -reghdfe- I am able to estimate the model and get no warning message.
Among the explanatory variables in my model, I have a categorical variable (physician age brackets) for which I would like the coefficients to be estimated so I specify it as i.age. What is also strange is that when I use -reghdfe- and absorb this variable together with the ym FE, I don't get the warning anymore.
I have read that this message "It is most likely due to one or more sparse indicator variables." (source: https://www.stata.com/statalist/arch.../msg00980.html). In my context, none of these variables seem sparse.
Could anyone help me understand what is going on?
Many thanks
Paula
I started off by running FE regressions (using -reghdfe- command) absorbing physician FE as well as hospital-ym FE. I could estimate the model but thought I was absorbing too much of the variation. Then, I ran the same regression specification but now absorbing hospital FE and ym FE instead of hospital-ym FE. To my surprise I got the following message "Warning: variance matrix is nonsymmetric or highly singular" and Stata did not output the coefficients SEs. I thought the first model was more restrictive than the second model so I did not quite understand what happened.
Then, I ran the same regression model but now only including one FE at a time. I did not get any warning message when estimating the regressions with physician FE and that with hospital FE. However, I got the warning message when estimating the regression with ym FE. When I run this same model using -areg- instead of -reghdfe- I am able to estimate the model and get no warning message.
Among the explanatory variables in my model, I have a categorical variable (physician age brackets) for which I would like the coefficients to be estimated so I specify it as i.age. What is also strange is that when I use -reghdfe- and absorb this variable together with the ym FE, I don't get the warning anymore.
I have read that this message "It is most likely due to one or more sparse indicator variables." (source: https://www.stata.com/statalist/arch.../msg00980.html). In my context, none of these variables seem sparse.
Code:
. tab age_int, m age_int | Freq. Percent Cum. ----------------+----------------------------------- 15 to 20 years | 12 0.00 0.00 20 to 25 years | 59,820 0.77 0.77 25 to 30 years | 705,128 9.09 9.87 30 to 35 years | 1,349,585 17.41 27.27 35 to 40 years | 1,301,711 16.79 44.06 40 to 45 years | 992,859 12.81 56.87 45 to 50 years | 838,942 10.82 67.68 50 to 55 years | 770,032 9.93 77.62 55 to 60 years | 679,585 8.76 86.38 60 to 65 years | 540,148 6.97 93.35 65 to 70 years | 298,706 3.85 97.20 70 to 75 years | 100,118 1.29 98.49 75 to 80 years | 32,761 0.42 98.91 80 to 85 years | 8,130 0.10 99.02 85 to 90 years | 1,718 0.02 99.04 90 to 95 years | 232 0.00 99.04 95 to 100 years | 63 0.00 99.04 . | 74,099 0.96 100.00 ----------------+----------------------------------- Total | 7,753,649 100.00 . tab ym, m ym | Freq. Percent Cum. ------------+----------------------------------- 2012m7 | 80,083 1.03 1.03 2012m8 | 84,123 1.08 2.12 2012m9 | 84,122 1.08 3.20 2012m10 | 84,856 1.09 4.30 2012m11 | 83,738 1.08 5.38 2012m12 | 82,253 1.06 6.44 2013m1 | 82,590 1.07 7.50 2013m2 | 82,954 1.07 8.57 2013m3 | 85,525 1.10 9.68 2013m4 | 86,280 1.11 10.79 2013m5 | 86,475 1.12 11.90 2013m6 | 86,116 1.11 13.01 2013m7 | 86,593 1.12 14.13 2013m8 | 87,516 1.13 15.26 2013m9 | 87,089 1.12 16.38 2013m10 | 87,210 1.12 17.51 2013m11 | 86,015 1.11 18.62 2013m12 | 84,463 1.09 19.71 2014m1 | 84,895 1.09 20.80 2014m2 | 86,245 1.11 21.91 2014m3 | 86,835 1.12 23.03 2014m4 | 87,393 1.13 24.16 2014m5 | 87,926 1.13 25.30 2014m6 | 87,029 1.12 26.42 2014m7 | 87,814 1.13 27.55 2014m8 | 88,418 1.14 28.69 2014m9 | 87,829 1.13 29.82 2014m10 | 87,942 1.13 30.96 2014m11 | 86,755 1.12 32.08 2014m12 | 85,190 1.10 33.17 2015m1 | 84,384 1.09 34.26 2015m2 | 84,763 1.09 35.36 2015m3 | 87,585 1.13 36.49 2015m4 | 86,593 1.12 37.60 2015m5 | 86,715 1.12 38.72 2015m6 | 86,351 1.11 39.83 2015m7 | 86,634 1.12 40.95 2015m8 | 86,882 1.12 42.07 2015m9 | 86,259 1.11 43.19 2015m10 | 86,020 1.11 44.29 2015m11 | 85,106 1.10 45.39 2015m12 | 83,765 1.08 46.47 2016m1 | 83,209 1.07 47.55 2016m2 | 84,800 1.09 48.64 2016m3 | 86,612 1.12 49.76 2016m4 | 86,360 1.11 50.87 2016m5 | 86,778 1.12 51.99 2016m6 | 87,197 1.12 53.11 2016m7 | 86,779 1.12 54.23 2016m8 | 86,804 1.12 55.35 2016m9 | 86,256 1.11 56.47 2016m10 | 85,978 1.11 57.57 2016m11 | 85,318 1.10 58.67 2016m12 | 84,445 1.09 59.76 2017m1 | 84,406 1.09 60.85 2017m2 | 85,309 1.10 61.95 2017m3 | 87,622 1.13 63.08 2017m4 | 87,101 1.12 64.21 2017m5 | 88,483 1.14 65.35 2017m6 | 88,306 1.14 66.49 2017m7 | 88,013 1.14 67.62 2017m8 | 88,518 1.14 68.76 2017m9 | 87,554 1.13 69.89 2017m10 | 87,883 1.13 71.03 2017m11 | 87,257 1.13 72.15 2017m12 | 86,551 1.12 73.27 2018m1 | 85,759 1.11 74.37 2018m2 | 85,897 1.11 75.48 2018m3 | 88,152 1.14 76.62 2018m4 | 88,081 1.14 77.75 2018m5 | 88,533 1.14 78.90 2018m6 | 88,131 1.14 80.03 2018m7 | 88,612 1.14 81.18 2018m8 | 89,467 1.15 82.33 2018m9 | 88,535 1.14 83.47 2018m10 | 89,151 1.15 84.62 2018m11 | 88,416 1.14 85.76 2018m12 | 86,829 1.12 86.88 2019m1 | 86,534 1.12 88.00 2019m2 | 87,314 1.13 89.12 2019m3 | 88,371 1.14 90.26 2019m4 | 88,608 1.14 91.41 2019m5 | 89,513 1.15 92.56 2019m6 | 88,294 1.14 93.70 2019m7 | 88,680 1.14 94.84 2019m8 | 88,586 1.14 95.98 2019m9 | 87,608 1.13 97.11 2019m10 | 84,472 1.09 98.20 2019m11 | 77,577 1.00 99.20 2019m12 | 61,661 0.80 100.00 ------------+----------------------------------- Total | 7,753,649 100.00
Many thanks
Paula
Comment