Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stratified results with svy: logistic

    I am running a multiple logistic model on complex survey data. I would like to see if the relationship between two variables, A and B, differs depending on the value of a third variable, C, but Stata doesn't allow me to use the by command with svy: logistic. Is there another way for me to get stratified results using svy: logistic? I am using Stata 13.1.

  • #2
    See http://www.ats.ucla.edu/stat/stata/f...ata_subpop.htm . Note that you should use the svy subpop option, not if qualifiers, e.g. it should be something like

    svy, subpop(health == 1): logistic ...

    As the UCLA FAQ notes, "Using the subpopulation option(s) is extremely important when analyzing survey data. If the data set is subset, meaning that observations not to be included in the subpopulation are deleted from the data set, the standard errors of the estimates cannot be calculated correctly. When the subpopulation option(s) is used, only the cases defined by the subpopulation are used in the calculation of the estimate, but all cases are used in the calculation of the standard errors."

    Steve Samuels and Austin Nichols have patiently tried to explain to me dozens of times why you need to do it this way, and if my life depended on it I would try really hard to understand their explanations, but I am willing to accept the truth of this on blind faith.

    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      I am using subpop option to identify my eligible population within the full dataset, but what I also want to do is get stratified results among subpopulations within my eligible population. To be more concrete, I am looking at whether the association between having a medical home and health care quality measures differs based on mental illness status. I know I could look at the association for each mental illness status group separately (i.e., people with serious mental illness, people with mild to moderate mental illness, people without mental illness), but I'm trying to figure out if I could run a regression on the entire eligible population and produce results stratified by mental illness status.

      Comment


      • #4
        You are looking for a test of interaction of the stratum variable and the predictor(s)
        I'll give a minimal example from the auto data set, omitting the svy details. Here rep78 plays the role of the stratum variable and headroomis the predictor. However I find little value in trying to interpret findings the logit scale alone. So: look at margins of the predicted probabilities and try a linear probability model with svy: reg. I recommend linktest as a good test for specification error.

        Code:
        sysuse auto, clear
        recode rep78 2/3=1
        logit foreign i.rep78##c.headroom
        
        Logistic regression                             Number of obs     =         69
                                                        LR chi2(5)        =      37.17
                                                        Prob > chi2       =     0.0000
        Log likelihood =  -23.81432                     Pseudo R2         =     0.4384
        
        ----------------------------------------------------------------------------------
                 foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -----------------+----------------------------------------------------------------
                   rep78 |
                      4  |   6.044999   3.385348     1.79   0.074    -.5901617    12.68016
                      5  |  -4.173359   5.967511    -0.70   0.484    -15.86947    7.522748
                         |
                headroom |  -.6725048   .7367337    -0.91   0.361    -2.116476    .7714668
                         |
        rep78#c.headroom |
                      4  |  -1.166389   1.140926    -1.02   0.307    -3.402563    1.069784
                      5  |   3.244173   2.502842     1.30   0.195    -1.661307    8.149653
                         |
                   _cons |  -.5530848    2.08178    -0.27   0.790    -4.633299    3.527129
        ----------------------------------------------------------------------------------
        
         testparm i.rep78#c.headroom
         ( 1)  [foreign]4.rep78#c.headroom = 0
         ( 2)  [foreign]5.rep78#c.headroom = 0
        
                   chi2(  2) =    3.35
                 Prob > chi2 =    0.1873
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment

        Working...
        X