sheafcoef is a post-estimation command that estimates sheaf coefficients (Heise, Sociological Methods and Research 1972). A sheaf coefficient assumes that a block of variables influence the dependent variable through a latent variable. This assumption is not tested, nor is it testable; a sheaf coefficient is just a different way of presenting the results from a model. Its main usefulness is in comparing the relative strength of the influence of several blocks of variables. For example, say we want to know what determines the probability of working non-standard hours (evenings, nights, and weekends) and we have a block of variables representing characteristics of the job and another block of variables representing the family situation of the respondent, and we want to say something about the relative importance of job characteristics versus family situation. In that case one could estimate a logit model with both blocks of variables and optionally some other control variables. After that one can use sheafcoef to display the effects of two latent variables, family background and job characteristics, which are both standardized to have a standard deviation of 1, and can thus be more easily compared.
This package can be installed by typing in Stata: ssc install sheafcoef
Example of sheafcoef after linear regression (regress).
. sysuse nlsw88, clear (NLSW, 1988 extract)
. recode occupation (11/12=4) /// > (9/10=13) (occupation: 28 changes made)
. gen ln_w = ln(wage)
. . qui xi: reg ln_w i.occupation married never_married
. sheafcoef, latent(occ:_I* ; marst:married never_married) ------------------------------------------------------------------------------ ln_w | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- main | occ | .2697449 .01076 25.07 0.000 .2486557 .2908341 marst | .0328888 .0108017 3.04 0.002 .0117178 .0540597 _cons | 2.256447 .0344297 65.54 0.000 2.188966 2.323928 -------------+---------------------------------------------------------------- on_occ | _Ioccupati~2 | -.1386235 .1570388 -0.88 0.377 -.4464138 .1691669 _Ioccupat~_3 | -1.49451 .1122457 -13.31 0.000 -1.714507 -1.274512 _Ioccupati~4 | -1.544845 .1923762 -8.03 0.000 -1.921895 -1.167794 _Ioccupati~5 | -1.443232 .2736307 -5.27 0.000 -1.979538 -.9069258 _Ioccupati~6 | -2.318603 .1308441 -17.72 0.000 -2.575052 -2.062153 _Ioccupati~7 | -4.308252 .3296375 -13.07 0.000 -4.95433 -3.662175 _Ioccupati~8 | -2.918558 .1004224 -29.06 0.000 -3.115382 -2.721734 _Ioccupat~13 | -.7463774 .1686803 -4.42 0.000 -1.076985 -.4157701 -------------+---------------------------------------------------------------- on_marst | married | -1.163971 .6699269 -1.74 0.082 -2.477004 .1490612 never_marr~d | 2.011869 1.016177 1.98 0.048 .0201975 4.00354 ------------------------------------------------------------------------------
. . sheafcoef, latent(occ:_I* ; marst:married never_married) beta ------------------------------------------------------------------------------ ln_w | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- main | occ_b | .4695516 .0187302 25.07 0.000 .4328411 .5062621 marst_b | .0572503 .0188028 3.04 0.002 .0203974 .0941031 -------------+---------------------------------------------------------------- on_occ | _Ioccupati~b | -.0447336 .0506761 -0.88 0.377 -.144057 .0545899 _Ioccupati~b | -.699891 .0525656 -13.31 0.000 -.8029177 -.5968644 _Ioccupati~b | -.3481505 .0433544 -8.03 0.000 -.4331236 -.2631774 _Ioccupati~b | -.219549 .0416256 -5.27 0.000 -.3011336 -.1379644 _Ioccupati~b | -.7255388 .0409438 -17.72 0.000 -.8057872 -.6452903 _Ioccupati~b | -.4790812 .036656 -13.07 0.000 -.5509255 -.4072368 _Ioccupati~b | -.9747901 .0335408 -29.06 0.000 -1.040529 -.9090513 _Ioccupati~b | -.2115621 .0478127 -4.42 0.000 -.3052733 -.1178508 -------------+---------------------------------------------------------------- on_marst | married_b | -.5578613 .3210786 -1.74 0.082 -1.187164 .0714412 never_marr~b | .6135245 .3098859 1.98 0.048 .0061593 1.22089 ------------------------------------------------------------------------------ (_b) indicates standardized coefficients
Example of sheafcoef after logistic regression (logit).
. sysuse nlsw88, clear (NLSW, 1988 extract)
. recode occupation (11/12=4) /// > (9/10=13) (occupation: 28 changes made)
. . qui xi: logit union i.occupation married never_married
. sheafcoef, latent( occ: _I* ; marst: married never_married) ------------------------------------------------------------------------------ union | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- main | occ | .6737403 .0690416 9.76 0.000 .5384212 .8090595 marst | .1754485 .0549909 3.19 0.001 .0676684 .2832286 _cons | -.9887016 .1719908 -5.75 0.000 -1.325797 -.6516057 -------------+---------------------------------------------------------------- on_occ | _Ioccupati~2 | -1.828541 .3288292 -5.56 0.000 -2.473034 -1.184047 _Ioccupat~_3 | .0059647 .2538843 0.02 0.981 -.4916394 .5035687 _Ioccupati~4 | -1.182669 .5093442 -2.32 0.020 -2.180966 -.1843731 _Ioccupati~5 | -.3384639 .566383 -0.60 0.550 -1.448554 .7716264 _Ioccupati~6 | 1.044078 .2996617 3.48 0.000 .4567518 1.631404 _Ioccupati~7 | -2.68244 1.447044 -1.85 0.064 -5.518595 .1537145 _Ioccupati~8 | -.6873704 .3435686 -2.00 0.045 -1.360752 -.0139883 _Ioccupat~13 | 1.713989 .3099484 5.53 0.000 1.106501 2.321477 -------------+---------------------------------------------------------------- on_marst | married | -1.709416 .5142056 -3.32 0.001 -2.71724 -.7015915 never_marr~d | .9902721 1.081978 0.92 0.360 -1.130365 3.110909 ------------------------------------------------------------------------------
. sheafcoef, latent( occ: _I* ; marst: married never_married) eform ------------------------------------------------------------------------------ union | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- main | occ_e | 1.961561 .1354294 14.48 0.000 1.696124 2.226997 marst_e | 1.191781 .065537 18.18 0.000 1.06333 1.320231 _cons_e | .3720595 .0639908 5.81 0.000 .2466398 .4974792 -------------+---------------------------------------------------------------- on_occ | _Ioccupati~2 | -1.828541 .3288292 -5.56 0.000 -2.473034 -1.184047 _Ioccupat~_3 | .0059647 .2538843 0.02 0.981 -.4916394 .5035687 _Ioccupati~4 | -1.182669 .5093442 -2.32 0.020 -2.180966 -.1843731 _Ioccupati~5 | -.3384639 .566383 -0.60 0.550 -1.448554 .7716264 _Ioccupati~6 | 1.044078 .2996617 3.48 0.000 .4567518 1.631404 _Ioccupati~7 | -2.68244 1.447044 -1.85 0.064 -5.518595 .1537145 _Ioccupati~8 | -.6873704 .3435686 -2.00 0.045 -1.360752 -.0139883 _Ioccupat~13 | 1.713989 .3099484 5.53 0.000 1.106501 2.321477 -------------+---------------------------------------------------------------- on_marst | married | -1.709416 .5142056 -3.32 0.001 -2.71724 -.7015915 never_marr~d | .9902721 1.081978 0.92 0.360 -1.130365 3.110909 ------------------------------------------------------------------------------ (_e) indicates the variables whose coefficients have been exponentiated
. sheafcoef, latent( occ: _I* ; marst: married never_married) beta (9 missing values generated) ------------------------------------------------------------------------------ union | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- main | occ_b | .3472723 .0355868 9.76 0.000 .2775235 .4170211 marst_b | .0904331 .0283445 3.19 0.001 .034879 .1459872 -------------+---------------------------------------------------------------- on_occ | _Ioccupati~b | -.5928965 .1066215 -5.56 0.000 -.8018707 -.3839222 _Ioccupati~b | .002801 .1192251 0.02 0.981 -.2308759 .236478 _Ioccupati~b | -.2505784 .1079174 -2.32 0.020 -.4620926 -.0390641 _Ioccupati~b | -.0546287 .0914152 -0.60 0.550 -.2337992 .1245419 _Ioccupati~b | .3305014 .0948575 3.48 0.000 .1445842 .5164187 _Ioccupati~b | -.2760708 .1489266 -1.85 0.064 -.5679615 .01582 _Ioccupati~b | -.2153166 .1076218 -2.00 0.045 -.4262514 -.0043818 _Ioccupati~b | .5107681 .0923645 5.53 0.000 .329737 .6917993 -------------+---------------------------------------------------------------- on_marst | married_b | -.8146458 .2450518 -3.32 0.001 -1.294938 -.3343531 never_marr~b | .3088756 .3374795 0.92 0.360 -.352572 .9703233 ------------------------------------------------------------------------------ (_b) indicates standardized coefficients
Example showing how to use sheafcoef to compare sheaf coefficients across groups
. sysuse nlsw88, clear (NLSW, 1988 extract)
. . drop if race == 3 (26 observations deleted)
. gen byte b = race == 2
. gen byte w = race == 1
. . gen bXmarried = b*married
. gen bXnever_married = b*never_married
. gen wXmarried = w*married
. gen wXnever_married = w*never_married
. . qui reg hours b w bX* wX*, nocons
. . sheafcoef, latent(b_marst: bXmarried bXnever_married if b ; /// > w_marst: wXmarried wXnever_married if w ) post ------------------------------------------------------------------------------ hours | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- main | b_marst | .1059572 .4296779 0.25 0.805 -.7361961 .9481105 w_marst | 2.028415 .2559947 7.92 0.000 1.526675 2.530156 b | 38.04926 .7262883 52.39 0.000 36.62576 39.47276 w | 39.52925 .5461474 72.38 0.000 38.45882 40.59968 -------------+---------------------------------------------------------------- on_b_marst | bXmarried | .3647793 8.929385 0.04 0.967 -17.13649 17.86605 bXnever_ma~d | 2.770892 3.400354 0.81 0.415 -3.89368 9.435463 -------------+---------------------------------------------------------------- on_w_marst | wXmarried | -1.930672 .1890921 -10.21 0.000 -2.301286 -1.560058 wXnever_ma~d | .8268037 .5178404 1.60 0.110 -.1881449 1.841752 ------------------------------------------------------------------------------
. . test [main]_b[b_marst] = [main]_b[w_marst]
( 1) [main]b_marst - [main]w_marst = 0
chi2( 1) = 14.77 Prob > chi2 = 0.0001