Closed vdquadros closed 5 years ago
Hi Victoria,
If you are already doing things within eclass x xclass then it is not possible to control for eclass x xclass cell (since each regression only has one of the eclass xclass cells). So you need to drop the eclass and xclass references from the right hand side.
Also, the reason the R2 are lower in these regressions than I expected is that there is substantial systematic variation in earnings that is explained by education. Then within education bin the regression explains less of the variance in earnings than a Mincerian regression across the whole population.
isaac
Hi Isaac,
That makes sense.
Just for reference, the SAS code is this
proc glm data=nm;
class eclass xclass homey;
model logwage2=exp exp2 exp3 educ eclass*xclass inschool advanced
ft lowhrs hisp_ed hisp_coll black_ed black_coll asian_ed asian_coll
homey*eclass rmsa0 rmsa1 / solution;
output out=nm2 predicted=pred residual=res;
weight wt;
But maybe it deals differently with the regressor if we are already "filtering" the data before.
Thanks
Hi Victoria,
Oh, the class statement in SAS is just declaring that these are factor variables. So its not doing a regression by group. So the equivalent in Stata would be to just do:
reg logwage2 exp exp2 exp3 educ eclass#xclass inschool advanced ft lowhrs hisp_ed hisp_coll black_ed black_coll asian_ed asian_coll nonmover#eclass rczone0 [fweight=wt]
Also think that you want eclass##xclass and nonmover##eclass, so that you also include main effects of the categories.
isaac
reg logwage2 exp exp2 exp3 educ eclass#xclass inschool advanced ft lowhrs hisp_ed hisp_coll black_ed black_coll asian_ed asian_coll nonmover#eclass rczone0 [fweight=wt]
====> R-squared = 0.2516
Great. That seems about right.
The full SAS script for table 6 can be found here. The regression code starts around line 470.
The full Stata script for table 6 can be found here. The regression code starts around line 510.
SAS code
model resgap4=colliv;
model resgap=rels;
model rels=inflall;
model resgap=inflall;
model resgap2 =relshs;
model resgap2 =relshs logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80
mfg90;
model resgap2 =relshs resgap902;
model resgap2 =relshs resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
model resgap4 =relscoll;
model resgap4 =relscoll logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80
mfg90;
model resgap4 =relscoll resgap904;
model resgap4 =relscoll resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
Stata code
reg resgap4 colliv [fweight = round(count90)]
reg resgap rels [fweight = round(count90)]
reg rels inflall [fweight = round(count90)]
reg resgap inflall [fweigh t = round(count90)]
/************/
/* OLS */
* Dependent variable is the difference in mean wage residual between native and immigrant.
/************/
/* High school equivalent regression. Without the lagged dependent variable resgap902 */
reg resgap2 relshs [fweight = round(count90)]
reg resgap2 relshs logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
estimates store m1, title(1)
/* High school equivalent regression. With the lagged dependent variable resgap902 */
reg resgap2 relshs resgap902 [fweight = round(count90)]
reg resgap2 relshs resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
estimates store m2, title(2)
/* College equivalent regression. Without the lagged dependent variable resgap904 */
reg resgap4 relscoll [fweight = round(count90)]
reg resgap4 relscoll logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
estimates store m3, title(5)
/* College equivalent regression. With the lagged dependent variable resgap904 */
reg resgap4 relscoll resgap904 [fweight = round(count90)]
reg resgap4 relscoll resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
estimates store m4, title(6)
estout m1 m2 m3 m4, cells(b(star fmt(3)) se(par fmt(2))) ///
legend label varlabels(_cons constant) ///
stats(r2)
Output
------------------------------------------------------------------------------------
1 2 5 6
b/se b/se b/se b/se
------------------------------------------------------------------------------------
Log rel supply of ~e -0.030*** -0.042***
(0.00) (0.00)
Log czone size ~1980 0.009** 0.008* -0.011* -0.008*
(0.00) (0.00) (0.00) (0.00)
Log czone size ~1990 -0.015*** -0.011** -0.032*** -0.041***
(0.00) (0.00) (0.00) (0.00)
Share of people wi~ 0.008 -0.006 -0.057 -0.024
(0.05) (0.05) (0.05) (0.05)
Share of people wi~ 0.011 0.025 0.052 0.017
(0.05) (0.05) (0.05) (0.05)
Res wage native~1980 -0.361*** -0.440*** 1.202*** 1.344***
(0.02) (0.02) (0.02) (0.02)
Res wage imm me~1980 -0.161*** -0.131*** -0.018 0.002
(0.01) (0.01) (0.01) (0.01)
Mfg share in 1980 0.536*** 0.402*** -1.734*** -1.494***
(0.07) (0.07) (0.08) (0.08)
Mfg share in 1990 0.256** 0.409*** 1.397*** 1.423***
(0.08) (0.08) (0.10) (0.10)
Diff between avg w~ -0.440***
(0.01)
Log rel supply of ~r -0.082*** -0.202***
(0.00) (0.00)
Diff between avg w~l -0.907***
(0.01)
constant -0.230*** -0.282*** -0.060*** -0.416***
(0.01) (0.01) (0.01) (0.01)
------------------------------------------------------------------------------------
r2 0.038 0.050 0.037 0.080
------------------------------------------------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001
------------------------------------------------------------------------------------
3 4 7 8
b/se b/se b/se b/se
------------------------------------------------------------------------------------
Log rel supply of ~e 0.065*** 0.060*** -0.096*** -0.184***
(0.01) (0.01) (0.01) (0.01)
Log czone size ~1980 0.016*** 0.015*** -0.014*** -0.009*
(0.00) (0.00) (0.00) (0.00)
Log czone size ~1990 -0.049*** -0.048*** -0.018*** -0.035***
(0.00) (0.00) (0.01) (0.01)
Share of people wi~ -0.021 -0.032 -0.057 -0.017
(0.05) (0.05) (0.05) (0.05)
Share of people wi~ 0.037 0.046 0.053 0.010
(0.05) (0.05) (0.05) (0.05)
Res wage native~1980 -0.750*** -0.813*** 1.256*** 1.297***
(0.03) (0.03) (0.04) (0.04)
Res wage imm me~1980 -0.012 0.011 -0.111*** -0.110***
(0.01) (0.01) (0.02) (0.02)
Mfg share in 1980 1.201*** 1.199*** -1.002*** -0.772***
(0.04) (0.04) (0.04) (0.04)
Diff between avg w~ -0.272***
(0.02)
Diff between avg w~l -1.099***
(0.03)
constant -0.050*** -0.076*** -0.030 -0.285***
(0.01) (0.01) (0.02) (0.03)
------------------------------------------------------------------------------------
r2 0.004 0.012 0.037 0.087
------------------------------------------------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001
SAS code
model relshs =hsiv;
model resgap2 =hsiv;
model relshs =hsiv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90;
model resgap2 =hsiv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90;
model relshs =hsiv resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
model resgap2 =hsiv resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
model relscoll=colliv;
model resgap4 =colliv;
model relscoll=colliv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80
mfg90;
model resgap4 =colliv logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
model relscoll=colliv resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
model resgap4= colliv resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
Stata code
reg relshs hsiv [fweight = round(count90)]
reg resgap2 hsiv [fweight = round(count90)]
reg relshs hsiv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
reg resgap2 hsiv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
reg relshs hsiv resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 ///
mfg90 [fweight = round(count90)]
reg resgap2 hsiv resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 ///
mfg90 [fweight = round(count90)]
reg relscoll colliv [fweight = round(count90)]
reg resgap4 colliv [fweight = round(count90)]
reg relscoll colliv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
reg resgap4 colliv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90 [fweight = round(count90)]
reg relscoll colliv resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 ///
mfg90 [fweight = round(count90)]
reg resgap4 colliv resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 ///
mfg90 [fweight = round(count90)]
SAS Code
proc syslin 2sls;
where (rmsa > 3);
endogenous relshs;
instruments hsiv;
model resgap2=relshs;
weight count90;
proc syslin 2sls;
where (rmsa > 3);
endogenous relshs;
instruments hsiv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90;
model resgap2=relshs logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80
mfg90;
weight count90;
proc syslin 2sls;
where (rmsa > 3);
endogenous relshs;
instruments hsiv resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80
mfg90;
model resgap2=relshs resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
weight count90;
proc syslin 2sls;
where (rmsa > 3);
endogenous relscoll;
instruments colliv;
model resgap4=relscoll;
weight count90;
proc syslin 2sls;`
where (rmsa > 3);
endogenous relscoll;
instruments colliv logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 mfg90;
model resgap4=relscoll logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80
mfg90;
weight count90;
proc syslin 2sls;
where (rmsa > 3);
endogenous relscoll;
instruments colliv resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
model resgap4=relscoll resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80
mfg80 mfg90;
weight count90;
Stata Code
/* HS regs */
ivregress 2sls resgap2 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 ///
(relshs = hsiv) [fweight = round(count90)]
estimates store m5, title(3)
/* with lagged dep var */
ivregress 2sls resgap2 resgap902 logsize80 logsize90 coll80 coll90 nres80 ires80 ///
mfg80 (relshs = hsiv) [fweight = round(count90)]
estimates store m6, title(4)
/* Coll regs */
ivregress 2sls resgap4 logsize80 logsize90 coll80 coll90 nres80 ires80 mfg80 ///
(relshs = hsiv) [fweight = round(count90)]
estimates store m7, title(7)
/* with lagged dep var */
ivregress 2sls resgap4 resgap904 logsize80 logsize90 coll80 coll90 nres80 ires80 ///
mfg80 (relshs = hsiv) [fweight = round(count90)]
estimates store m8, title(8)
estout m5 m6 m7 m8, cells(b(star fmt(3)) se(par fmt(2))) ///
legend label varlabels(_cons constant) ///
stats(r2)
Output
------------------------------------------------------------------------------------
3 4 7 8
b/se b/se b/se b/se
------------------------------------------------------------------------------------
Log rel supply of ~e 0.065*** 0.060*** -0.096*** -0.184***
(0.01) (0.01) (0.01) (0.01)
Log czone size ~1980 0.016*** 0.015*** -0.014*** -0.009*
(0.00) (0.00) (0.00) (0.00)
Log czone size ~1990 -0.049*** -0.048*** -0.018*** -0.035***
(0.00) (0.00) (0.01) (0.01)
Share of people wi~ -0.021 -0.032 -0.057 -0.017
(0.05) (0.05) (0.05) (0.05)
Share of people wi~ 0.037 0.046 0.053 0.010
(0.05) (0.05) (0.05) (0.05)
Res wage native~1980 -0.750*** -0.813*** 1.256*** 1.297***
(0.03) (0.03) (0.04) (0.04)
Res wage imm me~1980 -0.012 0.011 -0.111*** -0.110***
(0.01) (0.01) (0.02) (0.02)
Mfg share in 1980 1.201*** 1.199*** -1.002*** -0.772***
(0.04) (0.04) (0.04) (0.04)
Diff between avg w~ -0.272***
(0.02)
Diff between avg w~l -1.099***
(0.03)
constant -0.050*** -0.076*** -0.030 -0.285***
(0.01) (0.01) (0.02) (0.03)
------------------------------------------------------------------------------------
r2 0.004 0.012 0.037 0.087
------------------------------------------------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001
As discussed in the meeting yesterday, all of the regressions in the comment above are groundless since I was running them on way more observations than I should (due to multiple observations per CZ in the merged files).
After our discussion in #6, I changed the way some of the datasets were collapsed so that the CZs uniquely identify the observations.
I ran the regressions again on the top 100 CZs.
The results are below.
estout m1 m2 m5 m6, cells(b(star fmt(3)) se(par fmt(2))) ///
> legend label varlabels(_cons constant) ///
> stats(r2)
------------------------------------------------------------------------------------
1 2 3 4
b/se b/se b/se b/se
------------------------------------------------------------------------------------
Log rel supply imm~e 0.042*** 0.042*** 0.031*** 0.030***
(0.00) (0.00) (0.00) (0.00)
Log czone size 1980 0.014*** 0.011** 0.004 0.001
(0.00) (0.00) (0.00) (0.00)
Log czone size 1990 -0.100*** -0.099*** -0.079*** -0.078***
(0.00) (0.00) (0.00) (0.00)
College share 1980 -2.488*** -2.499*** -2.218*** -2.244***
(0.06) (0.06) (0.06) (0.06)
College share 1990 1.844*** 1.851*** 1.689*** 1.706***
(0.04) (0.04) (0.04) (0.04)
Wage res native 1980 1.108*** 1.096*** 1.103*** 1.087***
(0.01) (0.01) (0.01) (0.01)
Wage res imm 1980 -0.963*** -0.943*** -0.986*** -0.959***
(0.01) (0.01) (0.01) (0.01)
Mfg share in 1980 -1.258*** -1.252*** -1.309*** -1.299***
(0.03) (0.03) (0.03) (0.03)
Mfg share in 1990 1.916*** 1.905*** 1.956*** 1.940***
(0.03) (0.03) (0.03) (0.03)
Lagged dep var -0.064*** -0.082***
(0.01) (0.01)
constant 0.589*** 0.602*** 0.475*** 0.497***
(0.01) (0.01) (0.01) (0.01)
------------------------------------------------------------------------------------
r2 0.175 0.176 0.173 0.174
------------------------------------------------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001
.
.
. estout m3 m4 m7 m8, cells(b(star fmt(3)) se(par fmt(2))) ///
> legend label varlabels(_cons constant) ///
> stats(r2)
------------------------------------------------------------------------------------
5 6 7 8
b/se b/se b/se b/se
------------------------------------------------------------------------------------
Log rel supply imm~e 0.036*** 0.040***
(0.00) (0.00)
Log czone size 1980 0.020*** 0.027*** 0.006* 0.012***
(0.00) (0.00) (0.00) (0.00)
Log czone size 1990 -0.083*** -0.081*** -0.049*** -0.046***
(0.00) (0.00) (0.00) (0.00)
College share 1980 0.954*** 1.077*** 1.190*** 1.288***
(0.04) (0.04) (0.05) (0.05)
College share 1990 -0.120*** -0.216*** -0.230*** -0.306***
(0.03) (0.03) (0.03) (0.03)
Wage res native 1980 0.342*** 0.336*** 0.351*** 0.348***
(0.01) (0.01) (0.01) (0.01)
Wage res imm 1980 -0.078*** -0.106*** -0.094*** -0.116***
(0.01) (0.01) (0.01) (0.01)
Mfg share in 1980 -0.007 -0.030 -0.055** -0.072***
(0.02) (0.02) (0.02) (0.02)
Mfg share in 1990 0.412*** 0.406*** 0.418*** 0.410***
(0.02) (0.02) (0.02) (0.02)
Lagged dep var 0.149*** 0.125***
(0.01) (0.01)
Log rel supply imm~e 0.004*** 0.005***
(0.00) (0.00)
constant 0.229*** 0.186*** 0.012 -0.031**
(0.01) (0.01) (0.01) (0.01)
------------------------------------------------------------------------------------
r2 0.118 0.124 0.104 0.109
------------------------------------------------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001
Looks promising.
Are you sure that your dependent variable is defined correctly? (immigrants - native wages, i believe, rather than vice versa). This would account for the sign flip.
Also, can you create tables that report the N, just to make it easy to catch things as before.
Thanks!
Hi @econisaac ,
Now that we have Tables 1-3 up and running (as per our conversation on issue #5 and in our meeting earlier today), I spent the last few hours writing the code for Table 6 using the MSAs instead of the Commuting Zones. However, the coefficients are still positive, so overestimating the wages and not dealing properly with missing values was not the only problem with the code.
Just giving you this update to let you know I did some more work on this but it will require more scrutiny before we get approximate results.
Just so you know, here's the current output
------------------------------------------------------------------------------------
1 2 3 4
b/se b/se b/se b/se
------------------------------------------------------------------------------------
Log rel supply imm~e 0.029*** 0.033*** 0.022*** 0.029***
(0.00) (0.00) (0.00) (0.00)
Log msa size 1980 -0.120*** -0.141*** -0.125*** -0.143***
(0.00) (0.00) (0.00) (0.00)
Log msa size 1990 0.092*** 0.122*** 0.102*** 0.128***
(0.00) (0.00) (0.00) (0.00)
College share 1980 -1.580*** -1.494*** -1.563*** -1.484***
(0.05) (0.05) (0.05) (0.05)
College share 1990 1.071*** 1.024*** 1.056*** 1.015***
(0.04) (0.04) (0.04) (0.04)
Wage res native 1980 0.524*** 0.601*** 0.561*** 0.623***
(0.02) (0.02) (0.02) (0.02)
Wage res imm 1980 -0.520*** -0.599*** -0.562*** -0.623***
(0.02) (0.02) (0.02) (0.02)
Mfg share in 1980 -0.806*** -0.774*** -0.847*** -0.798***
(0.04) (0.04) (0.04) (0.04)
Mfg share in 1990 0.620*** 0.624*** 0.652*** 0.643***
(0.05) (0.04) (0.05) (0.04)
Lagged dep var 0.327*** 0.326***
(0.01) (0.01)
constant 0.310*** 0.243*** 0.265*** 0.217***
(0.01) (0.01) (0.01) (0.01)
------------------------------------------------------------------------------------
r2 0.093 0.118 0.093 0.118
------------------------------------------------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001
.
.
. estout m3 m4 m7 m8, cells(b(star fmt(3)) se(par fmt(2))) ///
> legend label varlabels(_cons constant) ///
> stats(r2)
------------------------------------------------------------------------------------
5 6 7 8
b/se b/se b/se b/se
------------------------------------------------------------------------------------
Log rel supply imm~e 0.001 0.005***
(0.00) (0.00)
Log msa size 1980 -0.048*** -0.044*** -0.045*** -0.039***
(0.00) (0.00) (0.00) (0.00)
Log msa size 1990 0.020*** 0.019*** 0.013*** 0.012***
(0.00) (0.00) (0.00) (0.00)
College share 1980 -0.219*** -0.223*** -0.231*** -0.239***
(0.04) (0.04) (0.04) (0.04)
College share 1990 0.398*** 0.393*** 0.409*** 0.405***
(0.03) (0.03) (0.03) (0.03)
Wage res native 1980 0.295*** 0.322*** 0.271*** 0.309***
(0.01) (0.02) (0.02) (0.02)
Wage res imm 1980 0.198*** 0.161*** 0.226*** 0.176***
(0.01) (0.01) (0.01) (0.01)
Mfg share in 1980 -0.722*** -0.740*** -0.691*** -0.699***
(0.03) (0.03) (0.03) (0.03)
Mfg share in 1990 0.816*** 0.824*** 0.792*** 0.785***
(0.03) (0.03) (0.03) (0.03)
Lagged dep var 0.107*** 0.158***
(0.01) (0.01)
Log rel supply imm~e 0.006*** 0.011***
(0.00) (0.00)
constant 0.106*** 0.098*** 0.136*** 0.124***
(0.01) (0.01) (0.01) (0.01)
------------------------------------------------------------------------------------
r2 0.069 0.071 0.067 0.068
------------------------------------------------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001
Thanks.
Can you add the N to the table?
Hi Isaac,
As we talked about it before, N for the table above was 124 (the top 124 MSAs in 2000).
I am going to close this issue as we are done with the Card replication for now.
To recap: In this issue we were still using data downloaded from IPUMS instead of using the Census data directly from ICPSR. As we discovered, IPUMS and ICPSR have different MSAs for the 1980/1990/2000 censuses, so the mapping of MSAs and PUMAs that Card wrote for his paper (since he used ICPSR data) was not working for the IPUMS dataset we had when doing the exercises above.
After switching from IPUMS to ICPSR, we could match Tables 2-3 exactly and get closer with Table 6, as per issue #9
Best, Victoria
Just want to let you know that I don’t have the regressions yet because there’s something strange in the regressions to get the residuals:
If I do:
then the display window says:
But if I tab those variables, I get:
So I don't know what's going on, and the residuals are very low (like .1, and not .3)