Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: ssm wrapper and population weights


From   A Das <[email protected]>
To   [email protected]
Subject   Re: st: ssm wrapper and population weights
Date   Fri, 29 Sep 2006 16:50:56 -0700 (PDT)

Hi Anders, 
   Here's the last line for the original data after
setting trace on:

- keep id `junk' `touse' `wgt' wt2 _pwt2;
= keep id emoprobb age harassd puberty11 firstvi
ktouch usborn2 harassd    age edim
> p milserved __000000 __000002 wt2 _pwt2;
; invalid name
    }
 
--------------------------------------------------------------
end ssm.Estimate ---
- exit _rc
-------------------------------------------------------------------------
end ssm ---
r(198);

Here's a reproduction of the problem using the
nhanes2a dataset for survey data
(http://www.stata-press.com/data/r8/svy.html), which
has sampling weights:

. ssm diabetes age sex weighthi  [pweight=finalwgt],
s(weighthi = age sex rural) adap
> t q(16) family(binom) link(logit)
; invalid name
r(198);

Setting trace on:

- keep id `junk' `touse' `wgt' wt2 _pwt2;
= keep id diabetes age sex weighthi weighthi    age
sex rural __000000 __000002 wt2
>  _pwt2;
; invalid name
    }
 
--------------------------------------------------------------
end ssm.Estimate ---
- exit _rc
-------------------------------------------------------------------------
end ssm ---
r(198);
 
Thanks again. 
            -Aniruddha

--- Anders Alexandersson <[email protected]> wrote:

> No, the ssm do file breaks before gllamm is called.
> I now suggest you
> set trace on and then re-run the ssm command to
> trace where in the ssm
> program the error occurs, as in the mentioned FAQ. I
> suspect a small
> problem with the ssm code for the pweight option but
> you need proof.
> 
> Also, can you reproduce the error for a more familar
> Stata dataset,
> e.g. auto.dta? The idea is to reproduce the problem
> without confusing
> extra information, to make it easy for the
> programmers to fix it if
> need be.
> 
> Anders Alexandersson
> [email protected]
> 
> On 9/29/06, A Das <[email protected]> wrote:
> > Thanks, Anders. Yes, I meant sampling weights.
> This is
> > what happens when I do as you suggest-
> >
> > . ssm emoprobb age harassd puberty11 firstvi
> ktouch
> > usborn2 [pweight=rweight], s(harassd = age edimp
> > milserved) adapt q(16) family(binom) link(logit)
> > commands
> >
> > *-------------------------------begin
> > do-file-----------------------------------
> >
> > * Select sample
> >
> > mark touse   [pweight= rweight]
> > markout touse emoprobb
> >
> > gen long wgt = rweight
> > * deal with probability weights
> >
> > gen _pwt2 = wgt
> > ; invalid name
> > r(198);
> >
> > So a problem with the underlying glamm code, then?
> 
> 
> >
> > --- Anders Alexandersson <[email protected]>
> wrote:
> >
> > > On 9/28/06, A Das <[email protected]> wrote:
> > > >    I'm trying to use the new ssm wrapper
> (Stata
> > > > Journal (2006), 6, 3, pp. 285-308) to fit a
> logit
> > > > model with a single endogenous dummy. The
> model
> > > does
> > > > not work when I include population weights
> > > (although
> > > > it should: p.292), but works when I do not.
> Here's
> > > the
> > > > model and the error message:
> > > >
> > > >
> > > > ssm emoprobb age harassd puberty11 firstvi
> ktouch
> > > > usborn2 if xf==1 [pweight=rweight], s(harassd
> =
> > > age
> > > > edimp milserved) adapt q(16)  family(binom)
> > > > link(logit)
> > > >
> > > > ; invalid name
> > > > r(198);
> > > >
> > > > Again, the same model runs properly when I
> remove
> > > the
> > > > population weights. Any help would be greatly
> > > > appreciated.
> > >
> > > With "population weights" I assume you mean
> sampling
> > > weights, since
> > > you refer to pweight. I remember that gllamm
> instead
> > > assumes
> > > pweight(varname) but that's maybe irrelevant
> here.
> > > Is your gllammm
> > > installation up-to-date? To have more control of
> > > what's going, I would
> > > make a backup copy of the original dataset, then
> use
> > > the commands
> > > option, as described in section 6.4 of the
> article.
> > > If you still get
> > > an error message, at least you will now if the
> error
> > > message is for
> > > the underlying gllamm code or for the commands
> > > before gllamm is
> > > called.
> > >
> > > More generally, it is a good idea to debug a
> > > problematic command with
> > > -set trace on- beforing issuing the command; see
> the
> > > FAQ at
> > >
> http://www.stata.com/support/faqs/lang/debug.html.
> > >
> > > Anders Alexandersson
> > > [email protected]
> > > *
> > > *   For searches and help try:
> > > *
> > >
> http://www.stata.com/support/faqs/res/findit.html
> > > *   http://www.stata.com/support/statalist/faq
> > > *   http://www.ats.ucla.edu/stat/stata/
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> > *
> > *   For searches and help try:
> > *  
> http://www.stata.com/support/faqs/res/findit.html
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> >
> *
> *   For searches and help try:
> *  
> http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index