Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: margins, vce(unconditional) after estimation with replicate weights


From   Sam Schulhofer-Wohl <[email protected]>
To   [email protected]
Subject   st: margins, vce(unconditional) after estimation with replicate weights
Date   Mon, 5 Nov 2012 13:32:16 -0600

I get a syntax error message, r(459), when I try to use -margins,
vce(unconditional)- after estimating a linear regression in survey
data with SDR or BSR weights. There is no error when I don't specify
vce(unconditional) or when I don't use replicate weights. Some
examples are below.

I think this may be the same problem that Eva Chang mentioned at
http://www.stata.com/statalist/archive/2012-09/msg01007.html, but I
don't see any replies to Eva's message.

I also can't find any indication in the manual that -margins,
vce(unconditional)- is incompatible with replicate weights.

Any suggestions on how to avoid this error?

-- 
Sam Schulhofer-Wohl
Senior Economist
Research Department
Federal Reserve Bank of Minneapolis
90 Hennepin Ave.
Minneapolis MN 55480-0291
[email protected]


*example of the error using SDR weights

. webuse ss07ptx

. svyset

      pweight: pwgtp
          VCE: sdr
          MSE: off
    sdrweight: pwgtp1 pwgtp2 pwgtp3 pwgtp4 pwgtp5 pwgtp6 pwgtp7 pwgtp8
pwgtp9 pwgtp10 pwgtp11 pwgtp12 pwgtp13 pwgtp14 pwgtp15 pwgtp16 pwgtp17
pwgtp18 pwgtp19
               pwgtp20 pwgtp21 pwgtp22 pwgtp23 pwgtp24 pwgtp25 pwgtp26
pwgtp27 pwgtp28 pwgtp29 pwgtp30 pwgtp31 pwgtp32 pwgtp33 pwgtp34
pwgtp35 pwgtp36 pwgtp37
               pwgtp38 pwgtp39 pwgtp40 pwgtp41 pwgtp42 pwgtp43 pwgtp44
pwgtp45 pwgtp46 pwgtp47 pwgtp48 pwgtp49 pwgtp50 pwgtp51 pwgtp52
pwgtp53 pwgtp54 pwgtp55
               pwgtp56 pwgtp57 pwgtp58 pwgtp59 pwgtp60 pwgtp61 pwgtp62
pwgtp63 pwgtp64 pwgtp65 pwgtp66 pwgtp67 pwgtp68 pwgtp69 pwgtp70
pwgtp71 pwgtp72 pwgtp73
               pwgtp74 pwgtp75 pwgtp76 pwgtp77 pwgtp78 pwgtp79 pwgtp80
  Single unit: missing
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: <zero>

. svy: reg agep i.sex
(running regress on estimation sample)

SDR replications (80)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50
..............................

Survey: Linear regression                       Number of obs      =    230817
                                                Population size    =  23904380
                                                Replications       =        80
                                                Wald chi2(1)       =   1515.50
                                                Prob > chi2        =    0.0000
                                                R-squared          =    0.0021

------------------------------------------------------------------------------
             |                 SDR
        agep |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       2.sex |   1.994219   .0512265    38.93   0.000     1.893817    2.094621
       _cons |   33.24486   .0470986   705.86   0.000     33.15255    33.33717
------------------------------------------------------------------------------

. margins sex, vce(unconditional)
vce(sdr) is not supported
something that should be true of your data is not
r(459);

*margins works fine if I don't specify vce(unconditional)

. margins sex

Adjusted predictions                              Number of obs   =     230817
Model VCE    : SDR

Expression   : Linear prediction, predict()

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         sex |
          1  |   33.24486   .0470986   705.86   0.000     33.15255    33.33717
          2  |   35.23908   .0386398   911.99   0.000     35.16335    35.31481
------------------------------------------------------------------------------

*using the BSR equivalent of SDR doesn't help

. svyset [pw=pwgtp], bsrweight(pwgtp?*) bsn(4) vce(bootstrap)

      pweight: pwgtp
          VCE: bootstrap
          MSE: off
    bsrweight: pwgtp1 pwgtp2 pwgtp3 pwgtp4 pwgtp5 pwgtp6 pwgtp7 pwgtp8
pwgtp9 pwgtp10 pwgtp11 pwgtp12 pwgtp13 pwgtp14 pwgtp15 pwgtp16 pwgtp17
pwgtp18 pwgtp19
               pwgtp20 pwgtp21 pwgtp22 pwgtp23 pwgtp24 pwgtp25 pwgtp26
pwgtp27 pwgtp28 pwgtp29 pwgtp30 pwgtp31 pwgtp32 pwgtp33 pwgtp34
pwgtp35 pwgtp36 pwgtp37
               pwgtp38 pwgtp39 pwgtp40 pwgtp41 pwgtp42 pwgtp43 pwgtp44
pwgtp45 pwgtp46 pwgtp47 pwgtp48 pwgtp49 pwgtp50 pwgtp51 pwgtp52
pwgtp53 pwgtp54 pwgtp55
               pwgtp56 pwgtp57 pwgtp58 pwgtp59 pwgtp60 pwgtp61 pwgtp62
pwgtp63 pwgtp64 pwgtp65 pwgtp66 pwgtp67 pwgtp68 pwgtp69 pwgtp70
pwgtp71 pwgtp72 pwgtp73
               pwgtp74 pwgtp75 pwgtp76 pwgtp77 pwgtp78 pwgtp79 pwgtp80
          bsn: 4
  Single unit: missing
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: <zero>

. svy: reg agep i.sex
(running regress on estimation sample)

Bootstrap replications (80)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50
..............................

Survey: Linear regression                       Number of obs      =    230817
                                                Population size    =  23904380
                                                Replications       =        80
                                                Wald chi2(1)       =   1515.50
                                                Prob > chi2        =    0.0000
                                                R-squared          =    0.0021

------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
        agep |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       2.sex |   1.994219   .0512265    38.93   0.000     1.893817    2.094621
       _cons |   33.24486   .0470986   705.86   0.000     33.15255    33.33717
------------------------------------------------------------------------------

. margins sex, vce(unconditional)
vce(bootstrap) is not supported
something that should be true of your data is not
r(459);

*no problem if I don't use replicate weights

. svyset [pw=pwgtp]

      pweight: pwgtp
          VCE: linearized
  Single unit: missing
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: <zero>

. svy: reg agep i.sex
(running regress on estimation sample)

Survey: Linear regression

Number of strata   =         1                  Number of obs      =    230817
Number of PSUs     =    230817                  Population size    =  23904380
                                                Design df          =    230816
                                                F(   1, 230816)    =    350.93
                                                Prob > F           =    0.0000
                                                R-squared          =    0.0021

------------------------------------------------------------------------------
             |             Linearized
        agep |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       2.sex |   1.994219   .1064544    18.73   0.000     1.785571    2.202867
       _cons |   33.24486   .0730543   455.07   0.000     33.10168    33.38805
------------------------------------------------------------------------------

. margins sex, vce(unconditional)

Adjusted predictions                            Number of obs      =    230817

Expression   : Linear prediction, predict()

------------------------------------------------------------------------------
             |             Linearized
             |     Margin   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         sex |
          1  |   33.24486   .0730543   455.07   0.000     33.10168    33.38805
          2  |   35.23908   .0774313   455.10   0.000     35.08732    35.39084
------------------------------------------------------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index