Announcement

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

  • How to get the p value of the odd ratio of the overall effect of an interaction term?

    Hello,
    im working on a logistical regression, with an interaction term, using the (simplified) following command:

    xi: svy: logistic mygoalvariable i.sex i.score i.sex*i.score, coeff

    Here is a simplified model: Logit P= B0 + B1 sex + B2 score(1/0) + B3 score (2/0) + B4 sex*score(1/0) + B5 sex*score(2/0)

    score is a categorical variable with 3 level: low level=0 (reference), mid level=1, high level=2.
    sex is a dummy variable 0=Boy 1=girl.

    I have a statistically significant effect of all my variables, including the interaction term.

    This means that the score variable have a different effect among boys or girls.

    I want to estimate the exact effect of score among girls. However, logistic provides coefficients (or odds ratio=OR) for both the score variable and the interaction term independently.

    I calculated the overall OR myself using exp(B2 + B4) for the mid level vs low.
    I also calculated the confidence interval (95%) using the variance-covariance matrix from the estat vce command: exp[ B2+B4 +/- 1.96 squareroot( variance B2 + var

    But I dont know how to calculate a p-value for this OR.
    I already know that this overall effect is not significant (OR including 1; which is the expected result: the score variable have an effect among boys but we can't show this effect among girls), but I'd like to know if it is possible to calculate a p-value from these elements.
    Note that i use survey weighted data (indicated by the svy: ) and so i dont have a population in number of subjects (only proportions) , neither a log likelihood (this said, i dont really understand why the logistic command won display the log likelihood when the pweight option that gives the exact same results can do it, but it is another question)

    This question is more about statistics than about Stata, I will be plenty satisfied with a formula if there is no easy command in Stata allowing this.

    Thank you for any help you can bring to me.
    Last edited by Gabriel Fernandez; 27 Jun 2014, 07:00.

  • #2
    The easiest way would be to use the factor variable notation instead of the outdated xi: prefix, in combination with margins especially with the new capabilities documented in help margins_contrast.

    Alternatively you could look at the tricks discussed in: M.L. Buis (2012) "Stata tip 106: With or without reference", The Stata Journal, 12(1), pp. 162-164.

    If you want to do this manually, then you can compute the standard error using the delta method, which is discussed in: M.L. Buis (2014) "Stata tip 116: Where did my p-values go? (part 3)", The Stata Journal, 14(1) pp. 218-220.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Maarten is right about using factor variable notation. I may be wrong, but it seems like the simplest thing is just to switch the reference category, so that the main effects become the effects for the group you want. Alternatively, I think you can use the test command. Something like

      Code:
      . webuse nhanes2f, clear
      
      . * Approach 1: reverse the reference category
      
      . svy: logit diabetes ib1.female weight ib1.female#c.weight
      (running logit on estimation sample)
      
      Survey: Logistic regression
      
      Number of strata   =        31                 Number of obs      =      10335
      Number of PSUs     =        62                 Population size    =  116997257
                                                     Design df          =         31
                                                     F(   3,     29)    =      21.59
                                                     Prob > F           =     0.0000
      
      ---------------------------------------------------------------------------------
                      |             Linearized
             diabetes |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      ----------------+----------------------------------------------------------------
             0.female |   .1408707   .6989928     0.20   0.842    -1.284735    1.566476
               weight |   .0268258   .0042427     6.32   0.000     .0181727    .0354788
                      |
      female#c.weight |
                   0  |  -.0093617   .0087442    -1.07   0.293    -.0271957    .0084723
                      |
                _cons |  -5.046706   .2870351   -17.58   0.000    -5.632118   -4.461294
      ---------------------------------------------------------------------------------
      
      . test weight
      
      Adjusted Wald test
      
       ( 1)  [diabetes]weight = 0
      
             F(  1,    31) =   39.98
                  Prob > F =    0.0000
      
      . * Approach 2: use the test command
      
      . svy: logit diabetes i.female weight i.female#c.weight
      (running logit on estimation sample)
      
      Survey: Logistic regression
      
      Number of strata   =        31                 Number of obs      =      10335
      Number of PSUs     =        62                 Population size    =  116997257
                                                     Design df          =         31
                                                     F(   3,     29)    =      21.59
                                                     Prob > F           =     0.0000
      
      ---------------------------------------------------------------------------------
                      |             Linearized
             diabetes |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      ----------------+----------------------------------------------------------------
             1.female |  -.1408707   .6989928    -0.20   0.842    -1.566476    1.284735
               weight |   .0174641   .0063809     2.74   0.010     .0044502    .0304779
                      |
      female#c.weight |
                   1  |   .0093617   .0087442     1.07   0.293    -.0084723    .0271957
                      |
                _cons |  -4.905835   .5569892    -8.81   0.000    -6.041822   -3.769848
      ---------------------------------------------------------------------------------
      
      . test weight + 1.female#c.weight = 0
      
      Adjusted Wald test
      
       ( 1)  [diabetes]weight + [diabetes]1.female#c.weight = 0
      
             F(  1,    31) =   39.98
                  Prob > F =    0.0000
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

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

      Comment

      Working...
      X