Stata commands in white,
output in green and yellow,
warnings are in red
Comments are in blue.
For comments on running the analyses go to the commented code file.
Equal opportunities policies weighted and unweighted - Table 4.3 E O policy by workplace size Table 4.4 Other factors by equal opportunities policy Table 4.5 Logistic regressions Table 4.6 Logistic regressions Table 4.7 Finite population corrections Table 4.8
. svyprop intuse back to top . /*----------------------------------------------------------- > Table 4.3 > 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 . /*---------------------------------------------------------- > now get weighted estimate - strata remain from previous call > using svymean to get design effect > ------------------------------------------------------------*/ . svyset [pweight=est_wt] pweight is est_wt strata is strata . svydes pweight: est_wt Strata: strata PSU:#Obs per PSU Strata ---------------------------- strata #PSUs #Obs min mean max -------- -------- -------- -------- -------- -------- 1 15 15 1 1.0 1 lines missed out 71 25 25 1 1.0 1 -------- -------- -------- -------- -------- -------- 71 2191 2191 1 1.0 1 . svyprop eo ------------------------------------------------------------------------------ pweight: est_wt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 Population size = 2238.7715 ------------------------------------------------------------------------------ Survey proportions estimation +---------------------------------------------------+ | eo Obs Est. Prop. Std. Err. | |---------------------------------------------------| | no eo policy 412 0.327215 0.018100 | | equal opps policy 1772 0.672785 0.018100 | +---------------------------------------------------+ . svymean eo,deff deft Survey mean estimation pweight: est_wt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 Population size = 2238.7715 ------------------------------------------------------------------------------ Mean | Estimate Std. Err. Deff Deft ---------+-------------------------------------------------------------------- eo | .6727851 .0181003 3.248741 1.802426 ------------------------------------------------------------------------------ . svyprop intuse back to top . /*-------------------------------------------------------------- > table 4.4 > now weighted table of proportions woth EOP by size of workplace > ------------------------------------------------------------*/ . svytab nempsize eo, row percent pweight: est_wt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 Population size = 2238.7715 ---------------------------------------- Size of | equal opps policy recoded to establish | 0 1 ment | no eo po equal op Total ----------+----------------------------- 10 thru | 36.57 63.43 100 25 to 49 | 35.2 64.8 100 50 to 99 | 28.13 71.87 100 100 to 1 | 18.75 81.25 100 200 to 4 | 13.21 86.79 100 500 or m | 8.71 91.29 100 | Total | 32.72 67.28 100 ---------------------------------------- Key: row percentages Pearson: Uncorrected chi2(5) = 46.5507 Design-based F(2.19, 4625.03)= 6.9857 P = 0.0006 back to top . /*------------------------------------------------------- > table 4.5 > factors compared between eo workplaces and others > -------------------------------------------------------*/ . svymean female,by(eo) Survey mean estimation pweight: est_wt Number of obs = 2169 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2169 Population size = 2233.6758 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. [95% Conf. Interval] Deff ---------------+-------------------------------------------------------------- female | no_eo_po | 42.73338 2.430513 37.96691 47.49985 4.495512 equal_op | 59.63827 1.266772 57.15401 62.12253 2.602532 ------------------------------------------------------------------------------ . svymean ethnic,by(eo) Survey mean estimation pweight: est_wt Number of obs = 2063 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2063 Population size = 2204.9309 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. [95% Conf. Interval] Deff ---------------+-------------------------------------------------------------- ethnic | no_eo_po | 3.337689 .4962556 2.364454 4.310923 3.743088 equal_op | 5.810197 .5521122 4.727419 6.892975 3.338979 ------------------------------------------------------------------------------ . svyprop disabgrp,by(eo) ------------------------------------------------------------------------------ pweight: est_wt Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2209.8821 ------------------------------------------------------------------------------ Survey proportions estimation -> eo=no eo policy +-------------------------------------------+ | disabgrp Obs Est. Prop. Std. Err. | |-------------------------------------------| | none 273 0.818294 0.031105 | | under 3% 89 0.079993 0.014508 | | 3% or more 32 0.101713 0.027827 | +-------------------------------------------+ -> eo=equal opps policy +-------------------------------------------+ | disabgrp Obs Est. Prop. Std. Err. | |-------------------------------------------| | none 893 0.775093 0.015699 | | under 3% 652 0.128997 0.007244 | | 3% or more 135 0.095910 0.014338 | +-------------------------------------------+ . /*-------------------------------------------------------------- > now weighted linear models to get ses of differences > ------------------------------------------------------------*/ . svyregress female eo Survey linear regression pweight: est_wt Number of obs = 2169 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2169 Population size = 2233.6758 F( 1, 2098) = 34.79 Prob > F = 0.0000 R-squared = 0.0647 ------------------------------------------------------------------------------ female | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | 16.90488 2.866258 5.90 0.000 11.28388 22.52589 _cons | 42.73338 2.430513 17.58 0.000 37.96691 47.49985 ------------------------------------------------------------------------------ . svyregress ethnic eo Survey linear regression pweight: est_wt Number of obs = 2063 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2063 Population size = 2204.9309 F( 1, 1992) = 11.13 Prob > F = 0.0009 R-squared = 0.0133 ------------------------------------------------------------------------------ ethnic | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | 2.472508 .7412694 3.34 0.001 1.018764 3.926253 _cons | 3.337689 .4962556 6.73 0.000 2.364454 4.310923 ------------------------------------------------------------------------------ . /*--------- get dummies for linear models----------*/ . tab disabgrp, gen(disab) Percentage | of | workforce | disabled, | groupe | Freq. Percent Cum. ------------+----------------------------------- none | 1,171 56.27 56.27 under 3% | 743 35.70 91.98 3% or more | 167 8.02 100.00 ------------+----------------------------------- Total | 2,081 100.00 . svyregress disab1 eo Survey linear regression pweight: est_wt Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2209.8821 F( 1, 2003) = 1.49 Prob > F = 0.2220 R-squared = 0.0025 ------------------------------------------------------------------------------ disab1 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | -.0432012 .0353675 -1.22 0.222 -.1125622 .0261597 _cons | .8182942 .0311046 26.31 0.000 .7572935 .8792949 ------------------------------------------------------------------------------ . svyregress disab2 eo Survey linear regression pweight: est_wt Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2209.8821 F( 1, 2003) = 8.53 Prob > F = 0.0035 R-squared = 0.0053 ------------------------------------------------------------------------------ disab2 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | .0490037 .0167786 2.92 0.004 .0160984 .0819091 _cons | .0799929 .0145077 5.51 0.000 .0515412 .1084446 ------------------------------------------------------------------------------ . svyregress disab3 eo Survey linear regression pweight: est_wt Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2209.8821 F( 1, 2003) = 0.03 Prob > F = 0.8539 R-squared = 0.0001 ------------------------------------------------------------------------------ disab3 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | -.0058025 .0315075 -0.18 0.854 -.0675934 .0559884 _cons | .1017129 .0278269 3.66 0.000 .0471403 .1562855 ------------------------------------------------------------------------------ . /*-------------------------------------------------------------- > same analyses unweighted > ------------------------------------------------------------*/ . svyset [pweight=const] pweight is const strata is strata . svymean female,by(eo) Survey mean estimation pweight: const Number of obs = 2169 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2169 Population size = 2169 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. [95% Conf. Interval] Deff ---------------+-------------------------------------------------------------- female | no_eo_po | 40.96654 1.281926 38.45256 43.48052 .9021551 equal_op | 51.76528 .5240641 50.73754 52.79302 .5842003 ------------------------------------------------------------------------------ . svymean ethnic,by(eo) Survey mean estimation pweight: const Number of obs = 2063 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2063 Population size = 2063 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. [95% Conf. Interval] Deff ---------------+-------------------------------------------------------------- ethnic | no_eo_po | 3.810382 .4622849 2.903769 4.716995 .9985484 equal_op | 5.616825 .26626 5.094648 6.139002 .9775552 ------------------------------------------------------------------------------ . svyprop disabgrp,by(eo) ------------------------------------------------------------------------------ pweight: const Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2074 ------------------------------------------------------------------------------ Survey proportions estimation -> eo=no eo policy +-------------------------------------------+ | disabgrp Obs Est. Prop. Std. Err. | |-------------------------------------------| | none 273 0.692893 0.022721 | | under 3% 89 0.225888 0.020503 | | 3% or more 32 0.081218 0.013680 | +-------------------------------------------+ -> eo=equal opps policy +-------------------------------------------+ | disabgrp Obs Est. Prop. Std. Err. | |-------------------------------------------| | none 893 0.531548 0.011289 | | under 3% 652 0.388095 0.010913 | | 3% or more 135 0.080357 0.006600 | +-------------------------------------------+ . svyregress disab1 eo Survey linear regression pweight: const Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2074 F( 1, 2003) = 38.49 Prob > F = 0.0000 R-squared = 0.0163 ------------------------------------------------------------------------------ disab1 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | -.1613458 .0260061 -6.20 0.000 -.2123475 -.110344 _cons | .6928934 .0227206 30.50 0.000 .6483349 .7374519 ------------------------------------------------------------------------------ . svyregress disab2 eo Survey linear regression pweight: const Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2074 F( 1, 2003) = 46.12 Prob > F = 0.0000 R-squared = 0.0176 ------------------------------------------------------------------------------ disab2 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | .1622069 .0238852 6.79 0.000 .1153646 .2090493 _cons | .2258883 .0205025 11.02 0.000 .1856798 .2660968 ------------------------------------------------------------------------------ . svyregress disab3 eo Survey linear regression pweight: const Number of obs = 2074 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2074 Population size = 2074 F( 1, 2003) = 0.00 Prob > F = 0.9549 R-squared = 0.0000 ------------------------------------------------------------------------------ disab3 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- eo | -.0008611 .0152375 -0.06 0.955 -.0307441 .0290218 _cons | .0812183 .0136803 5.94 0.000 .0543892 .1080473 ------------------------------------------------------------------------------ . back to top . /*-------------------------------------------------------------- > table 4.6 > now weighted multivariate logistic models > ------------------------------------------------------------*/ . svyset [pweight=est_wt] pweight is est_wt strata is strata . svylogit eo female disab2 disab3 ethnic Survey logistic regression pweight: est_wt Number of obs = 2024 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2024 Population size = 2197.8901 F( 4, 1950) = 12.10 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0185749 .0032457 5.72 0.000 .0122094 .0249403 disab2 | .6807342 .2116736 3.22 0.001 .2656043 1.095864 disab3 | -.1892321 .3754403 -0.50 0.614 -.9255378 .5470735 ethnic | .0287906 .0118429 2.43 0.015 .0055645 .0520168 _cons | -.4123304 .1910654 -2.16 0.031 -.787044 -.0376168 ------------------------------------------------------------------------------ . . /*-------------------------------------------------------------- > now unweighted multivariate logistic models > ------------------------------------------------------------*/ . svyset [pweight=const] pweight is const strata is strata . svylogit eo female disab2 disab3 ethnic Survey logistic regression pweight: const Number of obs = 2024 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2024 Population size = 2024 F( 4, 1950) = 24.35 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0139917 .0018713 7.48 0.000 .0103218 .0176617 disab2 | .8473436 .1355587 6.25 0.000 .5814887 1.113199 disab3 | .1089644 .2085119 0.52 0.601 -.2999648 .5178937 ethnic | .0171373 .0085307 2.01 0.045 .000407 .0338675 _cons | .4442131 .1084055 4.10 0.000 .2316106 .6568157 ------------------------------------------------------------------------------ . back to top . /*-------------------------------------------------------------- > table 4.7adjusted for workplace size > now weighted multivariate logistic models > ------------------------------------------------------------*/ . tab nempsize, gen(numemp) Size of establishment | Freq. Percent Cum. ----------------------+----------------------------------- 10 thru 24 employees | 262 11.96 11.96 25 to 49 employees | 396 18.07 30.03 50 to 99 employees | 393 17.94 47.97 100 to 199 employees | 387 17.66 65.63 200 to 499 employees | 456 20.81 86.44 500 or more employees | 297 13.56 100.00 ----------------------+----------------------------------- Total | 2,191 100.00 . svyset [pweight=est_wt] pweight is est_wt strata is strata . svylogit eo female disab2 disab3 ethnic numemp2-numemp6 Survey logistic regression pweight: est_wt Number of obs = 2024 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2024 Population size = 2197.8901 F( 9, 1945) = 11.67 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0197761 .0033316 5.94 0.000 .0132423 .0263099 disab2 | .0046995 .2246153 0.02 0.983 -.4358115 .4452104 disab3 | -.2228648 .377051 -0.59 0.555 -.9623294 .5165997 ethnic | .0293247 .0122012 2.40 0.016 .0053959 .0532535 numemp2 | .0715262 .2206386 0.32 0.746 -.3611856 .504238 numemp3 | .5539894 .2187152 2.53 0.011 .1250497 .9829292 numemp4 | 1.152938 .2508128 4.60 0.000 .6610493 1.644827 numemp5 | 1.65399 .2911786 5.68 0.000 1.082936 2.225043 numemp6 | 1.991005 .3494775 5.70 0.000 1.305617 2.676393 _cons | -.6166667 .2364682 -2.61 0.009 -1.080423 -.15291 ------------------------------------------------------------------------------ . . /*-------------------------------------------------------------- > now unweighted multivariate logistic models > ------------------------------------------------------------*/ . svyset [pweight=const] pweight is const strata is strata . svylogit eo female disab2 disab3 ethnic numemp2-numemp6 Survey logistic regression pweight: const Number of obs = 2024 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2024 Population size = 2024 F( 9, 1945) = 19.32 Prob > F = 0.0000 ------------------------------------------------------------------------------ eo | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- female | .0171235 .0019499 8.78 0.000 .0132993 .0209477 disab2 | .1770423 .1616377 1.10 0.274 -.1399582 .4940429 disab3 | .0040648 .2130104 0.02 0.985 -.4136867 .4218164 ethnic | .0159542 .0090478 1.76 0.078 -.0017902 .0336986 numemp2 | .1220072 .1794018 0.68 0.497 -.2298319 .4738462 numemp3 | .5459611 .1895193 2.88 0.004 .1742798 .9176424 numemp4 | 1.096627 .2178593 5.03 0.000 .6693654 1.523888 numemp5 | 1.575925 .2331842 6.76 0.000 1.118609 2.033242 numemp6 | 1.734561 .3051802 5.68 0.000 1.136048 2.333074 _cons | -.2072431 .1754054 -1.18 0.238 -.5512446 .1367583 ------------------------------------------------------------------------------ . svyprop intuse back to top . . /*-------------------------------------------------------------- > 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 > > first without fpc > ------------------------------------------------------------*/ . svyset [pweight=grosswt], strata(strata) clear(fpc) pweight is grosswt strata is strata . svymean eo ,deff deft Survey mean estimation pweight: grosswt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 Population size = 261888.74 ------------------------------------------------------------------------------ Mean | Estimate Std. Err. Deff Deft ---------+-------------------------------------------------------------------- eo | .6727851 .0181003 3.248741 1.802426 ------------------------------------------------------------------------------ . svymean eo, deff deft by(nempsize) Survey mean estimation pweight: grosswt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 Population size = 261888.74 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. Deff Deft ---------------+-------------------------------------------------------------- eo | 10_thru_ | .6343108 .032809 5.057802 2.248956 25_to_49 | .6480435 .0349011 3.025251 1.739325 50_to_99 | .718747 .0263963 .9300344 .9643829 100_to_1 | .8124946 .0235814 .519204 .7205581 200_to_4 | .8679404 .0204599 .3112757 .5579209 500_or_m | .9129004 .0183455 .1241133 .3522972 ------------------------------------------------------------------------------ . svymean eo, deff deft by(nempsize)srssubpop Survey mean estimation pweight: grosswt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 Population size = 261888.74 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. Deff Deft ---------------+-------------------------------------------------------------- eo | 10_thru_ | .6343108 .032809 1.197271 1.094199 25_to_49 | .6480435 .0349011 2.109514 1.452417 50_to_99 | .718747 .0263963 1.340794 1.157927 100_to_1 | .8124946 .0235814 1.408938 1.186987 200_to_4 | .8679404 .0204599 1.661722 1.289078 500_or_m | .9129004 .0183455 1.248647 1.117429 ------------------------------------------------------------------------------ . /*----------- now with fpc--------------------------------*/ . svyset [pweight=grosswt] ,fpc(sampfrac) strata(strata) pweight is grosswt strata is strata fpc is sampfrac . svymean eo, deff deft Survey mean estimation pweight: grosswt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 FPC: sampfrac Population size = 261888.74 ------------------------------------------------------------------------------ Mean | Estimate Std. Err. Deff Deft ---------+-------------------------------------------------------------------- eo | .6727851 .0180649 3.263253 1.798899 ------------------------------------------------------------------------------ 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: grosswt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 FPC: sampfrac Population size = 261888.74 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. Deff Deft ---------------+-------------------------------------------------------------- eo | 10_thru_ | .6343108 .0327519 5.0826 2.245042 25_to_49 | .6480435 .0348414 3.040257 1.736348 50_to_99 | .718747 .0262604 .9282226 .9594174 100_to_1 | .8124946 .0233453 .513138 .7133434 200_to_4 | .8679404 .0201238 .3036667 .548757 500_or_m | .9129004 .0175665 .1147547 .3373392 ------------------------------------------------------------------------------ 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: grosswt Number of obs = 2184 Strata: strata Number of strata = 71 PSU:Number of PSUs = 2184 FPC: sampfrac Population size = 261888.74 ------------------------------------------------------------------------------ Mean Subpop. | Estimate Std. Err. Deff Deft ---------------+-------------------------------------------------------------- eo | 10_thru_ | .6343108 .0327519 1.195476 1.092295 25_to_49 | .6480435 .0348414 2.11462 1.44993 50_to_99 | .718747 .0262604 1.343205 1.151964 100_to_1 | .8124946 .0233453 1.412908 1.175102 200_to_4 | .8679404 .0201238 1.682622 1.267905 500_or_m | .9129004 .0175665 1.250052 1.069984 ------------------------------------------------------------------------------ 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. . /*---------------------------------------------------- > The two analyses give the different ways that design > effects can be defined for subgroups > The second one that compares the design with simple random > samples of the same size within subgroups is more helpful > Note that design effects are much reduced within > subgroups. This is because the subgroups are so strogly > associated with the weighting factor here. > ---------------------------------------------------------*/ . . end of do-file . log close log: C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\ex4datafiles\results\satata.log log type: text closed on: 2 Sep 2005, 15:01:10 ------------------------------------------------------------------------------------------------------------------