Re: st: Logistic using aweigths

 From rgutierrez@stata.com (Roberto G. Gutierrez, StataCorp) To statalist@hsphsun2.harvard.edu Subject Re: st: Logistic using aweigths Date Fri, 12 Aug 2005 13:18:41 -0500

```Anna Lsto <debstata@hotmail.com> writes:

> I tried to run a logistic regression using a_weight and got an error message
> back (aweigth not allowed). Is there any explanation for that? Can I
> alternatively run a logit using a_weight and then manually calculate the
> odds ratio from the logit regression coefficients? Would that give me the
> odds ratio I was looking for when I ran the logistic?

Nick Winter <nw53@cornell.edu> responds:

> The odd thing is, -logistic- calls -logit- to do the actual estimation, and
> the documentation for -logit- suggests that it does not accept aweights,
> although it does, in fact.
> So it seems like either they both should, or neither should accept aweights.

They both should not, as the concept of aweights and cell means does not
really translate well into the machinations of -logit- and -logistic-.
Although you can have a model where the response is the average number
(proportion) of "yes" respondents, the mechanics of -logistic- and -logit-
would treat the proportion as it would treat any other non-zero response -- it
would treat it just as if it were equal to one.

The model where the response is a proportion is handled by -glm- instead, and
-glm- does accept aweights.  I would advise caution when using them, however.
A -glm- Bernoulli model with aweights translates into both the response AND
the covariates being "averaged" out.  If only the response is an average and
the covariates fixed over the averaged subjects, then what you want is -glm-
with a binomial denominator, specified as -family(binom varname)-, where
varname defines how many subjects went into each average.  If you go this
route, you would also need to change the response from a proportion to the
number of positive respondents, i.e. from y to varname*y.

As for -logit-, the fact that it accepts aweights, although undocumented, is
probably a computational artifact left over from an earlier version of Stata.
For purposes of consistency in the definition of aweights, we'll change
-logit- to disallow them entirely.

--Bobby
rgutierrez@stata.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/
```