gen gr_rate = D.lnuclms
reg lnunclms ez y1982-y1988
Given this model, either the within transformation or the FD transformation could be applied to difference out the fixed effects for cities. But it is inappropriate to apply –cluster- to make standard errors robust to within group (within city) correlation of the error terms because the number of groups is small, just 22 cities. That we do not have a number of groups sufficiently large to apply –cluster- makes the choice of estimation methods, within transformation or FD transformation, especially important. Which transformation is preferable here?
* Example generated by -dataex-. To install: ssc install dataex
clear
input int year long uclms byte(ez city) float(lnuclms gr_rate) byte(y1980 y1981 y1982 y1983 y1984 y1985 y1986 y1987 y1988) float u_hat
1980 166746 0 1 12.024227 . 1 0 0 0 0 0 0 0 0 .
1981 83561 0 1 11.333332 -.6908951 0 1 0 0 0 0 0 0 0 -.3692632
1982 158146 0 1 11.971274 .6379423 0 0 1 0 0 0 0 0 0 .1808147
1983 83572 0 1 11.333464 -.6378107 0 0 0 1 0 0 0 0 0 -.2830596
1984 45949 1 1 10.735288 -.598176 0 0 0 0 1 0 0 0 0 -.07752831
1985 48848 1 1 10.79647 .06118107 0 0 0 0 0 1 0 0 0 .05973202
1986 46570 1 1 10.748712 -.04775715 0 0 0 0 0 0 1 0 0 -.018279206
1987 47205 1 1 10.762255 .01354313 0 0 0 0 0 0 0 1 0 .28122693
1988 37953 1 1 10.544104 -.2181511 0 0 0 0 0 0 0 0 1 .12053338
1980 115279 0 2 11.65511 . 1 0 0 0 0 0 0 0 0 .
1981 78278 0 2 11.268022 -.3870888 0 1 0 0 0 0 0 0 0 -.06545687
1982 126389 0 2 11.74712 .4790983 0 0 1 0 0 0 0 0 0 .021970706
1983 79666 0 2 11.285598 -.4615221 0 0 0 1 0 0 0 0 0 -.106771
1984 41376 0 2 10.630456 -.6551418 0 0 0 0 1 0 0 0 0 -.3163717
1985 53905 0 2 10.894979 .26452255 0 0 0 0 0 1 0 0 0 .2630735
1986 42037 0 2 10.646305 -.24867344 0 0 0 0 0 0 1 0 0 -.2191955
1987 44151 0 2 10.69537 .04906559 0 0 0 0 0 0 0 1 0 .3167494
1988 27088 0 2 10.206846 -.4885244 0 0 0 0 0 0 0 0 1 -.14983997
1980 61046 0 3 11.019383 . 1 0 0 0 0 0 0 0 0 .
1981 60959 0 3 11.017957 -.0014266968 0 1 0 0 0 0 0 0 0 .3202052
1982 90064 0 3 11.408276 .3903189 0 0 1 0 0 0 0 0 0 -.066808745
1983 61609 0 3 11.028563 -.3797121 0 0 0 1 0 0 0 0 0 -.024960995
1984 41869 0 3 10.6423 -.3862629 0 0 0 0 1 0 0 0 0 -.04749275
1985 49353 0 3 10.806754 .1644535 0 0 0 0 0 1 0 0 0 .16300446
1986 38632 0 3 10.561836 -.24491787 0 0 0 0 0 0 1 0 0 -.21543993
1987 37350 0 3 10.52809 -.033747673 0 0 0 0 0 0 0 1 0 .23393613
1988 31182 0 3 10.347596 -.1804924 0 0 0 0 0 0 0 0 1 .15819207
1980 91152 0 4 11.420283 . 1 0 0 0 0 0 0 0 0 .
1981 47337 0 4 10.765047 -.6552362 0 1 0 0 0 0 0 0 0 -.3336043
1982 102228 0 4 11.53496 .7699137 0 0 1 0 0 0 0 0 0 .3127861
1983 59709 0 4 10.997238 -.5377226 0 0 0 1 0 0 0 0 0 -.18297148
1984 30062 0 4 10.311017 -.6862211 0 0 0 0 1 0 0 0 0 -.347451
1985 41624 0 4 10.636433 .3254156 0 0 0 0 0 1 0 0 0 .3239666
1986 33688 0 4 10.424897 -.21153545 0 0 0 0 0 0 1 0 0 -.1820575
1987 23357 0 4 10.058652 -.3662453 0 0 0 0 0 0 0 1 0 -.09856146
1988 17190 0 4 9.752083 -.3065691 0 0 0 0 0 0 0 0 1 .032115374
1980 183095 0 5 12.11776 . 1 0 0 0 0 0 0 0 0 .
1981 100892 0 5 11.521806 -.5959549 0 1 0 0 0 0 0 0 0 -.274323
1982 121593 0 5 11.708435 .1866293 0 0 1 0 0 0 0 0 0 -.2704983
1983 61597 0 5 11.028368 -.6800671 0 0 0 1 0 0 0 0 0 -.32531595
1984 63997 0 5 11.06659 .03822327 0 0 0 0 1 0 0 0 0 .3769934
1985 82141 1 5 11.316193 .24960136 0 0 0 0 0 1 0 0 0 .4300299
1986 54092 1 5 10.89844 -.4177513 0 0 0 0 0 0 1 0 0 -.3882734
1987 37084 1 5 10.52094 -.3775005 0 0 0 0 0 0 0 1 0 -.10981672
1988 28978 1 5 10.274292 -.2466488 0 0 0 0 0 0 0 0 1 .09203568
1980 117090 0 6 11.670698 . 1 0 0 0 0 0 0 0 0 .
1981 131495 0 6 11.786724 .11602592 0 1 0 0 0 0 0 0 0 .4376578
1982 190727 0 6 12.158598 .3718739 0 0 1 0 0 0 0 0 0 -.08525376
1983 172074 0 6 12.05568 -.10291767 0 0 0 1 0 0 0 0 0 .25183344
1984 113250 1 6 11.637353 -.4183273 0 0 0 0 1 0 0 0 0 .10232036
1985 112460 1 6 11.630353 -.00699997 0 0 0 0 0 1 0 0 0 -.008449022
1986 95065 1 6 11.462317 -.16803646 0 0 0 0 0 0 1 0 0 -.13855852
1987 112507 1 6 11.63077 .16845417 0 0 0 0 0 0 0 1 0 .436138
1988 73704 1 6 11.207812 -.4229584 0 0 0 0 0 0 0 0 1 -.0842739
1980 172782 0 7 12.059786 . 1 0 0 0 0 0 0 0 0 .
1981 161154 0 7 11.990116 -.06966972 0 1 0 0 0 0 0 0 0 .25196218
1982 356613 0 7 12.784407 .7942905 0 0 1 0 0 0 0 0 0 .3371629
1983 255142 0 7 12.449575 -.3348312 0 0 0 1 0 0 0 0 0 .01991987
1984 125848 1 7 11.74283 -.7067451 0 0 0 0 1 0 0 0 0 -.18609746
1985 124783 1 7 11.73433 -.0084991455 0 0 0 0 0 1 0 0 0 -.009948198
1986 106736 1 7 11.578114 -.15621758 0 0 0 0 0 0 1 0 0 -.12673964
1987 95935 1 7 11.471426 -.10668755 0 0 0 0 0 0 0 1 0 .16099626
1988 72338 1 7 11.189105 -.28232098 0 0 0 0 0 0 0 0 1 .0563635
1980 123567 0 8 11.72454 . 1 0 0 0 0 0 0 0 0 .
1981 84035 0 8 11.338988 -.3855505 0 1 0 0 0 0 0 0 0 -.06391859
1982 121736 0 8 11.70961 .3706217 0 0 1 0 0 0 0 0 0 -.08650593
1983 85812 0 8 11.359914 -.3496962 0 0 0 1 0 0 0 0 0 .005054951
1984 83180 0 8 11.328762 -.03115177 0 0 0 0 1 0 0 0 0 .3076184
1985 55967 1 8 10.932517 -.396245 0 0 0 0 0 1 0 0 0 -.2158165
1986 68651 1 8 11.13679 .20427418 0 0 0 0 0 0 1 0 0 .2337521
1987 33909 1 8 10.431436 -.7053556 0 0 0 0 0 0 0 1 0 -.4376718
1988 19190 1 8 9.862144 -.5692911 0 0 0 0 0 0 0 0 1 -.23060665
1980 164996 0 9 12.013677 . 1 0 0 0 0 0 0 0 0 .
1981 139598 0 9 11.846522 -.1671543 0 1 0 0 0 0 0 0 0 .1544776
1982 215534 0 9 12.280874 .4343519 0 0 1 0 0 0 0 0 0 -.022775693
1983 148060 0 9 11.905373 -.3755016 0 0 0 1 0 0 0 0 0 -.02075052
1984 107105 0 9 11.581565 -.3238077 0 0 0 0 1 0 0 0 0 .014962432
1985 86550 1 9 11.368478 -.2130871 0 0 0 0 0 1 0 0 0 -.03265859
1986 87191 1 9 11.375856 .007378578 0 0 0 0 0 0 1 0 0 .03685652
1987 50279 1 9 10.825343 -.55051327 0 0 0 0 0 0 0 1 0 -.28282946
1988 30843 1 9 10.336665 -.488678 0 0 0 0 0 0 0 0 1 -.1499935
1980 533598 0 10 13.187398 . 1 0 0 0 0 0 0 0 0 .
1981 435754 0 10 12.984833 -.2025652 0 1 0 0 0 0 0 0 0 .11906672
1982 667208 0 10 13.410857 .4260244 0 0 1 0 0 0 0 0 0 -.031103177
1983 545625 0 10 13.209687 -.20116997 0 0 0 1 0 0 0 0 0 .15358114
1984 340092 0 10 12.736972 -.4727154 0 0 0 0 1 0 0 0 0 -.13394523
1985 325797 0 10 12.69403 -.04294205 0 0 0 0 0 1 0 0 0 -.0443911
1986 303724 0 10 12.623875 -.070155144 0 0 0 0 0 0 1 0 0 -.0406772
1987 262512 0 10 12.478052 -.14582253 0 0 0 0 0 0 0 1 0 .12186129
1988 209103 0 10 12.250583 -.22746944 0 0 0 0 0 0 0 0 1 .11121503
1980 169747 0 11 12.042065 . 1 0 0 0 0 0 0 0 0 .
1981 95962 0 11 11.471707 -.5703573 0 1 0 0 0 0 0 0 0 -.2487254
1982 157129 0 11 11.964823 .4931154 0 0 1 0 0 0 0 0 0 .03598781
1983 67341 0 11 11.117524 -.8472986 0 0 0 1 0 0 0 0 0 -.4925475
1984 32549 0 11 10.390502 -.7270222 0 0 0 0 1 0 0 0 0 -.388252
1985 36576 0 11 10.507148 .11664581 0 0 0 0 0 1 0 0 0 .11519676
1986 65114 0 11 11.083895 .57674694 0 0 0 0 0 0 1 0 0 .6062249
1987 45005 0 11 10.71453 -.3693657 0 0 0 0 0 0 0 1 0 -.10168188
1988 29916 0 11 10.306149 -.4083805 0 0 0 0 0 0 0 0 1 -.06969604
1980 74306 0 12 11.215947 . 1 0 0 0 0 0 0 0 0 .
end
[/CODE]
Related Posts with Fixed effect or first difference
Python: Importing pandas (and other packages) into STATA 16I am running STATA 16 and installed Anaconda to be able to run python code from STATA. The installat…
"Reshape" problems: non-constant number of variables over timeDear all, I looked for similar queries and couldn't find any, but of course, if you know of other "…
residual diagnostics using mixedDear all, I'm having some problems with the residual diagnostics of my multilevel model in Stata (u…
Expand dataDear Statalist Members, I am looking for help with expanding my dataset below to include a categori…
Why no vIf in binary logistic RegressionDear Statalist, in my pursuit to asses whether there is multicollinearity in my model or not, I rea…
Subscribe to:
Post Comments (Atom)
0 Response to Fixed effect or first difference
Post a Comment