Announcement

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

  • Adjusted Wald test not working on Stata 17

    Hi. I am new to Stata and am doing a DHS dataset analysis (2 appended datasets from the same country) generating a new variable which i named "Period" and assigned values: 0=Pre-pandemic, 1=Pandemic.

    I have renamed the variables: for example, v012 (current age, continuous variable) was renamed "age".

    I have performed as svyset and proceeded to compute mean age by Period for a subpopulation of women who gave birth in the 2 years prior to the survey:

    svy, subpop(if childage_mos<=24): mean age, over(Period)

    Hhowever, when I performed an adjusted Wald test using:

    test [age]Pre-pandemic = [age]Pandemic

    Stata returned the following error message:

    Equation [age] not found
    r(303);

    How can i make adjusted Wald test work in this situation?

    Could this be due to mistakes in how i svyset the data?

    THank you for your help.

    Lora

  • #2
    You are not dealing with multiple equations, but levels of a categorical variable. Use the -coeflegend- option to see how to refer to the coefficients as below.

    Code:
    sysuse auto, clear
    mean mpg, over(rep78)
    mean mpg, over(rep78) coeflegend
    test _b[[email protected]]=_b[[email protected]]
    Res.:

    Code:
    . mean mpg, over(rep78)
    
    Mean estimation                             Number of obs = 69
    
    --------------------------------------------------------------
                 |       Mean   Std. err.     [95% conf. interval]
    -------------+------------------------------------------------
     c.mpg@rep78 |
              1  |         21          3      15.01359    26.98641
              2  |     19.125   1.328768      16.47348    21.77652
              3  |   19.43333   .7560991      17.92456    20.94211
              4  |   21.66667    1.16316      19.34562    23.98772
              5  |   27.36364   2.632913      22.10974    32.61753
    --------------------------------------------------------------
    
    . 
    . mean mpg, over(rep78) coeflegend
    
    Mean estimation                             Number of obs = 69
    
    ------------------------------------------------------------------------------
                 |       Mean   Legend
    -------------+----------------------------------------------------------------
     c.mpg@rep78 |
              1  |         21  _b[[email protected]]
              2  |     19.125  _b[[email protected]]
              3  |   19.43333  _b[[email protected]]
              4  |   21.66667  _b[[email protected]]
              5  |   27.36364  _b[[email protected]]
    ------------------------------------------------------------------------------
    
    . 
    . test _b[[email protected]]=_b[[email protected]]
    
     ( 1)  [email protected] - [email protected] = 0
    
           F(  1,    68) =    0.33
                Prob > F =    0.5696
    
    .

    Comment


    • #3
      Lora:
      welcome to this forum.
      Being totally unfamiliar with -survey- and survey-related methods, I tried to understand the nitty-gritty made by Stata behind the curtain:
      Code:
      . use https://www.stata-press.com/data/r18/stage5a.dta
      
      . svy, subpop(if ylogit <=0): mean stdize , over( yprobit )
      (running mean on estimation sample)
      
      Survey: Mean estimation
      
      Number of strata = 3                  Number of obs   =     11,039
      Number of PSUs   = 9                  Population size = 529,810.54
                                            Subpop. no. obs =      7,808
                                            Subpop. size    =  375,429.8
                                            Design df       =          6
      
      ------------------------------------------------------------------
                       |             Linearized
                       |       Mean   std. err.     [95% conf. interval]
      -----------------+------------------------------------------------
      c.stdize@yprobit |
                    0  |   2.978111   .0167907      2.937026    3.019197
                    1  |   2.973214   .0357534      2.885728    3.060699
      ------------------------------------------------------------------
      
      . mat list e(b)
      
      e(b)[1,2]
           c.stdize@  c.stdize@
          0.yprobit  1.yprobit
      y1   2.978111  2.9732138
      
      . test [email protected][email protected]
      
      Adjusted Wald test
      
       ( 1)  [email protected] - [email protected] = 0
      
             F(  1,     6) =    0.01
                  Prob > F =    0.9068
      
      .
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Thank you so much for your help!!!
        the "mat list e(b)" command works...even for svy:logit commands

        Truly grateful,
        Lora

        Comment

        Working...
        X