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

# Re: st: xtlogit postestimation with predict

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: xtlogit postestimation with predict Date Sat, 13 Jul 2013 07:22:05 -0700

```Dave:

I have to correct my original explanation.  Subsetting -predict- after -clogit- or -xtlogit fe- could lead to groups with no positive outcomes, but predictions will still
be made for those groups.

The  formula for pc1 in the meanual entry for -clogit- postestimation contains a sum
of terms for all members of a group. Subsetting the -predict- statement will omit the contributions from the excluded members.

. webuse lowbirth2
. clogit low lwt smoke ptd, group(pairid)
. predict p1
. predict p2 if race==1
. sum p1  p2 if race==1

About your first question:  To quote the manual  entry for -clogit- (p. 283, Stata 13 Manual, paragraph "Fixed Effects Logit"): "This conditional probability does not involve the (intercepts) so they are never estimated when the resulting conditional likelihood is used."

Steve

The answers to your questions are contained in the Manual entry for -clogit- and in the Methods and Formulas section of the Manual entry for -clogit postestimation-.

On Jul 12, 2013, at 8:42 AM, Dave Ohls wrote:

Thanks for the comments, Steve, this is helpful - particularly point
1.  To follow-up briefly, if anyone has thoughts:

re #1) Is Stata not estimating individual group intercepts at all, or
is it using them to estimate coefficients but not retaining them in
any way?  I'm using the -xtlogit- command out of convenience -
specification requires some 20,000 fixed effects which none of the
other commands seem able to handle - rather than out of specific
theoretical motivation (though estimating conditional on one positive
outcome within group is consistent with what I'm trying to do).  My
understanding is that this is still doing individual intercepts - is
that mistaken?  If so, is there any better way to do this, or is it
simply impossible to get 'real' predicted probabilities in Stata?

re #2) Thinking that the restricted set of cases might be altering how
probabilities were computed was my initial supposition as well, and I
tried to test it.  However, three things lead me to think this was not
causing the problem:
a) As long as there was one already positive outcome within the group,
changing the composition of any such group isn't changing which groups
have a positive outcome or not.
b) The DV is set to missing in all the duplicate cases, so they were
ignored in the model estimation (which yield the exact same
coefficients/N as before) and don't affect any ratio/proportion of
positive outcomes.  Given that, why isn't Stata using the same
information in estimating probabilities as it was before?  I would
have assumed that the restriction  was saying 'only bother doing this
command for these cases' rather than 'do this command in a certain way
because you're only looking at these cases' - is that incorrect here?
c) I tried separately estimating probabilities using -predict p4 if
dummy==1 & group==1, -predict p5 if dummy==1 & group==2-, etc, and in
each case I got exactly the same results (for those observations) as I
got with the general -predict p2 if dummy==1-.  If the specific
subsample is changing the way it estimates probabilities, wouldn't
these change at least slightly?

Much appreciated if anyone can clear this up, or tell me what I'm
misunderstanding.

On Fri, Jul 12, 2013 at 1:37 AM, Steve Samuels <sjsamuels@gmail.com> wrote:
> Dave Ohls <daveohls@gmail.com>:
>
> Two misunderstandings here:
>
> 1. -xtlogit, fe- is  conditional logistic regression, -clogit- in
> Stata- (Manual). Conditional logistic regression does not
> estimate the group specific intercepts. Without those intercepts, you
> cannot estimate the "real" (i.e. unconditional) probabilities of events.
>
> 2. The default "pc1"  prediction after -xtlogit- is, according to the -help-,
> the "probability of a positive outcome conditional on one positive
> outcome within group." Thus it is a characteristic of the observed
> group, not just of the individual covariate values. If you subset the
> -predict- command, the composition of some groups may  change. If
> a group is left with no positive outcomes, subsequent predictions  for
> that group will be missing. So, there is no reason after
>
> . predict p1
> . predict p2 if dummy==1
>
> to expect that p1 and p2 will be identical.
>
>
> Steve
> sjsamuels@gmail.com
>
> On Jul 9, 2013, at 1:34 PM, Richard Herron wrote:
>
> I don't really understand the question, but I will offer that panel
> logit with fixed effects is not the same as a logit model with
> indicator variables.
>
> To estimate the model there must be within individual variation in the
> dependent variable, so -xtlogit, fe- drops any individuals that don't
> change state.
>
> Do you have many individuals that don't change state?
>
> On Tue, Jul 9, 2013 at 3:27 PM, Dave Ohls <daveohls@gmail.com> wrote:
>> I am getting inconsistent sets of results using the -predict- command
>> for postestimation predicted probabilities after -xtlogit- models.
>> I'm using Stata/IC 11.2 for Windows.
>>
>> I am estimating fixed effects logit models using code of the form:
>> -xtlogit DV IV1 IV2 CV1 CV2 if CV3==1, fe-
>> and want to interpret substantive results on continuous IV1 in terms
>> of predicted probabilities at different values.  Because effects are
>> non-linear and dependent on values of the FE/other vars, I'm
>> considering these within specific substantively-important cases.
>>
>> To do so, I create 5-10 dummy copies (labeled with a 1 in a variable
>> called dummy) of a particular case and delete the dependent variable
>> so as not to include it in the estimation of the model itself.  I keep
>> all variable values as they are in the real case, except altering IV1
>> to set it at its minimum for one of the copies, mean in another, max
>> in another, mean plus 1 SD in another, etc.  I then estimate the
>> model, followed by postestimation commands.
>>
>> The problem is that I get very different sets of results when I run:
>> -predict p1 if dummy==1-
>> than when I run:
>> -predict p2-
>> The numbers aren't the same even within those cases (dummy==1) where I
>> get a predicted probability in each.  I assume this is something to do
>> with how it handles the fixed effects, but I can't tell from the
>> manual/past forum topics/etc what it is, or which is correct.
>>
>> Also, I get a totally different (third) set of results when I run:
>> -predict p3, pu0-
>> Given info in the manual I interpret this set as the predicted
>> probabilities when the FEs are set to 0, which is not substantively
>> correct for what I'm trying to do - I include it here only to show
>> that that's not what's happening in either set of results above.
>>
>> I have tried replicating this on other datasets and can't get the same
>> inconsistency.  Any ideas?
>>
>> Thanks so much for your time.
>>
>> -Dave
>> *
>> *   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/
> *
> *   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/
>
> *
> *   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/
*
*   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/

*
*   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/
```