-------------------------------------------------------------------------------------------------------------------- log: C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\results\ex4.log log type: text opened on: 1 Sep 2005, 07:29:13 . do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" . /*----------------------------------------------------------- > get unweighted estimate of proportion of > workplaces with an equal opportunities policy (EOP) > but allowing for stratification > -------------------------------------------------------------*/ . gen const=1 . svyset [pweight=const], strata(strata) pweight is const strata is strata . svyprop eo ------------------------------------------------------------------------------ pweight: const Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 Population size = 2184 ------------------------------------------------------------------------------ Survey proportions estimation +------------------------------------+ | eo Obs Est. Prop. Std. Err. | |------------------------------------| | 0 412 0.188645 0.007745 | | 1 1772 0.811355 0.007745 | +------------------------------------+ . . /*---------------------------------------------------------- > now get weighted estimate - strata remain from previous call > ------------------------------------------------------------*/ . svyset [pweight=est_wt] pweight is est_wt strata is strata . svyprop eo ------------------------------------------------------------------------------ pweight: est_wt Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 Population size = 2159.0837 ------------------------------------------------------------------------------ Survey proportions estimation +------------------------------------+ | eo Obs Est. Prop. Std. Err. | |------------------------------------| | 0 412 0.324695 0.018071 | | 1 1772 0.675305 0.018071 | +------------------------------------+ . /*-------------------------------------------------------------- > now weighted table of proportions woth EOP by size of workplace > ------------------------------------------------------------*/ . svytab eo nempsize, column pweight: est_wt Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 Population size = 2159.0837 ------------------------------------------------------------------------- equal | opps | policy | recoded | nemp size to 0 1 | 1 2 3 4 5 6 7 8 Total ----------+-------------------------------------------------------------- 0 | .3627 .343 .2934 .1847 .1294 .1126 .0196 .0227 .3247 1 | .6373 .657 .7066 .8153 .8706 .8874 .9804 .9773 .6753 | Total | 1 1 1 1 1 1 1 1 1 ------------------------------------------------------------------------- Key: column proportions Pearson: Uncorrected chi2(7) = 44.5838 Design-based F(2.33, 4945.51)= 6.6138 P = 0.0007 . /*-------------------------------------------------------------- > now unweighted linear models to get effect of factors on EOP > ------------------------------------------------------------*/ . svyset [pweight=const] pweight is const strata is strata . svyregress female eo Survey linear regression pweight: const Number of obs = 2169 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2169 Population size = 2169 F( 1, 2103) = 57.87 Prob > F = 0.0000 R-squared = 0.0232 ------------------------------------------------------------------------------ female | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | 11.12066 1.461883 7.61 0.000 8.253773 13.98755 _cons | 40.65796 1.278403 31.80 0.000 38.15089 43.16503 ------------------------------------------------------------------------------ . svyregress disab eo Survey linear regression pweight: const Number of obs = 2074 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2074 Population size = 2074 F( 1, 2008) = 4.29 Prob > F = 0.0385 R-squared = 0.0010 ------------------------------------------------------------------------------ disab | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | .2120406 .1023986 2.07 0.039 .0112221 .4128592 _cons | .7256245 .0757176 9.58 0.000 .5771312 .8741178 ------------------------------------------------------------------------------ . svyregress ethnic eo Survey linear regression pweight: const Number of obs = 2063 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2063 Population size = 2063 F( 1, 1997) = 17.52 Prob > F = 0.0000 R-squared = 0.0062 ------------------------------------------------------------------------------ ethnic | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | 2.104745 .5027954 4.19 0.000 1.118686 3.090803 _cons | 3.190257 .4276565 7.46 0.000 2.351557 4.028956 ------------------------------------------------------------------------------ . /*-------------------------------------------------------------- > now weighted linear models > ------------------------------------------------------------*/ . svyset [pweight=est_wt] pweight is est_wt strata is strata . svyregress female eo Survey linear regression pweight: est_wt Number of obs = 2169 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2169 Population size = 2153.8422 F( 1, 2103) = 37.86 Prob > F = 0.0000 R-squared = 0.0704 ------------------------------------------------------------------------------ female | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | 17.63143 2.865355 6.15 0.000 12.0122 23.25065 _cons | 42.40965 2.474206 17.14 0.000 37.55751 47.2618 ------------------------------------------------------------------------------ . svyregress disab eo Survey linear regression pweight: est_wt Number of obs = 2074 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2074 Population size = 2131.5835 F( 1, 2008) = 0.22 Prob > F = 0.6424 R-squared = 0.0004 ------------------------------------------------------------------------------ disab | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | .1026639 .2210432 0.46 0.642 -.3308341 .5361618 _cons | .7534789 .1829337 4.12 0.000 .3947191 1.112239 ------------------------------------------------------------------------------ . svyregress ethnic eo Survey linear regression pweight: est_wt Number of obs = 2063 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2063 Population size = 2126.2916 F( 1, 1997) = 14.14 Prob > F = 0.0002 R-squared = 0.0166 ------------------------------------------------------------------------------ ethnic | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | 2.74197 .72911 3.76 0.000 1.312074 4.171866 _cons | 2.373978 .4754587 4.99 0.000 1.441531 3.306425 ------------------------------------------------------------------------------ . /*-------------------------------------------------------------- > now unweighted multivariate logistic models > ------------------------------------------------------------*/ . svyset [pweight=const] pweight is const strata is strata . svylogit eo female disab ethnic Survey logistic regression pweight: const Number of obs = 2024 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2024 Population size = 2024 F( 3, 1956) = 21.89 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0139578 .0019384 7.20 0.000 .0101562 .0177593 disab | .032551 .0316652 1.03 0.304 -.02955 .0946519 ethnic | .0245636 .0097939 2.51 0.012 .005356 .0437713 _cons | .6657324 .1027319 6.48 0.000 .4642571 .8672078 ------------------------------------------------------------------------------ . /*-------------------------------------------------------------- > now weighted multivariate logistic models > ------------------------------------------------------------*/ . svyset [pweight=est_wt] pweight is est_wt strata is strata . svylogit eo female disab ethnic Survey logistic regression pweight: est_wt Number of obs = 2024 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2024 Population size = 2119.4079 F( 3, 1956) = 13.83 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0190382 .0032781 5.81 0.000 .0126093 .0254671 disab | -.0047271 .0358489 -0.13 0.895 -.0750331 .0655789 ethnic | .0372057 .0143067 2.60 0.009 .0091477 .0652637 _cons | -.3738791 .1798482 -2.08 0.038 -.726593 -.0211651 ------------------------------------------------------------------------------ . /*-------------------------------------------------------------- > now unweighted multivariate logistic model with NEMPSIZE > need to use xi: to code up dummy variables then run analyses > ------------------------------------------------------------*/ . svyset [pweight=const] pweight is const strata is strata . xi: svylogit eo female disab ethnic i.nempsize i.nempsize _Inempsize_1-8 (naturally coded; _Inempsize_1 omitted) note: _Inempsize_7 != 0 predicts success perfectly _Inempsize_7 dropped and 55 obs not used note: _Inempsize_8 != 0 predicts success perfectly _Inempsize_8 dropped and 29 obs not used Survey logistic regression pweight: const Number of obs = 1940 Strata: strata Number of strata = 66 PSU: Number of PSUs = 1940 Population size = 1940 F( 8, 1867) = 19.28 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0176531 .0020094 8.79 0.000 .0137121 .021594 disab | .019558 .021002 0.93 0.352 -.0216319 .0607478 ethnic | .0170366 .0088342 1.93 0.054 -.0002892 .0343625 _Inempsize_2 | .1417863 .179564 0.79 0.430 -.2103801 .4939528 _Inempsize_3 | .585323 .1878167 3.12 0.002 .216971 .9536749 _Inempsize_4 | 1.155253 .2091719 5.52 0.000 .7450186 1.565487 _Inempsize_5 | 1.668426 .2202926 7.57 0.000 1.236381 2.10047 _Inempsize_6 | 1.415234 .2846374 4.97 0.000 .8569947 1.973474 _cons | -.2367999 .1762974 -1.34 0.179 -.5825597 .1089599 ------------------------------------------------------------------------------ . /*-------------------------------------------------------------- > same thing weighted > ------------------------------------------------------------*/ . svyset [pweight=est_wt] pweight is est_wt strata is strata . xi: svylogit eo female disab ethnic i.nempsize i.nempsize _Inempsize_1-8 (naturally coded; _Inempsize_1 omitted) note: _Inempsize_7 != 0 predicts success perfectly _Inempsize_7 dropped and 55 obs not used note: _Inempsize_8 != 0 predicts success perfectly _Inempsize_8 dropped and 29 obs not used Survey logistic regression pweight: est_wt Number of obs = 1940 Strata: strata Number of strata = 66 PSU: Number of PSUs = 1940 Population size = 2111.6086 F( 8, 1867) = 12.51 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0209044 .0033645 6.21 0.000 .0143058 .0275031 disab | -.0116614 .03635 -0.32 0.748 -.0829521 .0596293 ethnic | .03552 .0139514 2.55 0.011 .008158 .0628819 _Inempsize_2 | .1070193 .2177569 0.49 0.623 -.3200522 .5340909 _Inempsize_3 | .5146863 .2121884 2.43 0.015 .098536 .9308367 _Inempsize_4 | 1.161438 .2323457 5.00 0.000 .7057545 1.617121 _Inempsize_5 | 1.671919 .2585829 6.47 0.000 1.164779 2.17906 _Inempsize_6 | 1.709645 .3174224 5.39 0.000 1.087106 2.332184 _cons | -.6780242 .2313491 -2.93 0.003 -1.131753 -.2242953 ------------------------------------------------------------------------------ . /*-------------------------------------------------------------- > now mean of eo and by size group allowing for finite population > correction > Stata requires two things to get the finite population correct > 1. A variable with the number of PSUs in the startum > 2. Weights that add to the population size > ------------------------------------------------------------*/ . svyset [pweight=est_wt], strata(strata) clear(fpc) pweight is est_wt strata is strata . svymean eo ,deff deft Survey mean estimation pweight: est_wt Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 Population size = 2159.0837 ------------------------------------------------------------------------------ Mean | Estimate Std. Err. Deff Deft ---------+-------------------------------------------------------------------- eo | .675305 .0180714 3.251329 1.803144 ------------------------------------------------------------------------------ . gen gweight=199952/2191 gweight already defined r(110); end of do-file r(110); . summarize gweight, detail gweight ------------------------------------------------------------- Percentiles Smallest 1% 1.783383 1.108175 5% 5.909047 1.45427 10% 7.195612 1.55033 Obs 2191 25% 14.84469 1.556492 Sum of Wgt. 2191 50% 34.45 Mean 90.81243 Largest Std. Dev. 148.5939 75% 103.8679 943.0228 90% 187.7403 971.3157 Variance 22080.16 95% 536.1915 1005.397 Skewness 2.956636 99% 659.6015 1048.867 Kurtosis 11.75395 . do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" . summarize gweight Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- gweight | 2191 90.81243 148.5939 1.108175 1048.867 . end of do-file . edit - preserve . edit - preserve . do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" . svyset [pweight=est_wt], strata(strata) clear(fpc) pweight is est_wt strata is strata . svymean eo ,deff deft Survey mean estimation pweight: est_wt Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 Population size = 2159.0837 ------------------------------------------------------------------------------ Mean | Estimate Std. Err. Deff Deft ---------+-------------------------------------------------------------------- eo | .675305 .0180714 3.251329 1.803144 ------------------------------------------------------------------------------ . svyset [pweight=gweight] ,fpc(sampfrac) strata(strata) pweight is gweight strata is strata fpc is sampfrac . svymean eo, deff deft Survey mean estimation pweight: gweight Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 FPC: sampfrac Population size = 197039.3 ------------------------------------------------------------------------------ Mean | Estimate Std. Err. Deff Deft ---------+-------------------------------------------------------------------- eo | .675305 .0180352 3.274607 1.799531 ------------------------------------------------------------------------------ Finite population correction (FPC) assumes simple random sampling without replacement of PSUs within each stratum with no subsampling within PSUs. Weights must represent population totals for deff to be correct when using an FPC. Note: deft is invariant to the scale of weights. . svymean eo, deff deft by(nempsize) Survey mean estimation pweight: gweight Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 FPC: sampfrac Population size = 197039.3 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. Deff Deft ---------------+-------------------------------------------------------------- eo | nempsize==1 | .6372691 .0327904 5.057827 2.236463 nempsize==2 | .6569982 .0336212 2.954724 1.709378 nempsize==3 | .7066216 .0274155 1.004 .9964295 nempsize==4 | .8153292 .0234403 .5039093 .7059206 nempsize==5 | .8705853 .0193861 .2867007 .5324687 nempsize==6 | .8873518 .0243676 .1160561 .3387768 nempsize==7 | .9804053 .0129455 .0598481 .2432792 nempsize==8 | .9772813 .0209365 .0728607 .2684271 ------------------------------------------------------------------------------ Finite population correction (FPC) assumes simple random sampling without replacement of PSUs within each stratum with no subsampling within PSUs. Weights must represent population totals for deff to be correct when using an FPC. Note: deft is invariant to the scale of weights. . svymean eo, deff deft by(nempsize)srssubpop Survey mean estimation pweight: gweight Number of obs = 2184 Strata: strata Number of strata = 66 PSU: Number of PSUs = 2184 FPC: sampfrac Population size = 197039.3 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. Deff Deft ---------------+-------------------------------------------------------------- eo | nempsize==1 | .6372691 .0327904 1.203282 1.095477 nempsize==2 | .6569982 .0336212 1.996388 1.407605 nempsize==3 | .7066216 .0274155 1.432954 1.187579 nempsize==4 | .8153292 .0234403 1.454236 1.186835 nempsize==5 | .8705853 .0193861 1.613657 1.231968 nempsize==6 | .8873518 .0243676 1.207879 1.039773 nempsize==7 | .9804053 .0129455 .7018998 .7870028 nempsize==8 | .9772813 .0209365 .9019691 .8886551 ------------------------------------------------------------------------------ Finite population correction (FPC) assumes simple random sampling without replacement of PSUs within each stratum with no subsampling within PSUs. Weights must represent population totals for deff to be correct when using an FPC. Note: deft is invariant to the scale of weights. . end of do-file . edit - preserve . log close log: C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\results\ex4.log log type: text closed on: 1 Sep 2005, 07:52:19 ------------------------------------------------------------------------------------------------------------------