Statalist The Stata Listserver


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

Re: st: predictnl and ologit


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: predictnl and ologit
Date   Thu, 16 Feb 2006 23:01:54 -0500

At 10:15 PM 2/16/2006, Jeff Pitblado, StataCorp LP wrote:
giacomo <[email protected]> found a bug in -predictnl- when used after -ologit-:

> I am estimating an ordered logit model and I would like to use predictnl
> to compute standard errors and confidence bounds for the estimated
> probabilities. In more detail, I first estimate:
>
> ologit y x1 x2, where y takes on three values (1,2,3)
>
> However, when I use -predictnl-, I get an error message:
>
> . predictnl phat=predict(outcome(#2)), se(phat_se)
> equation cut2 not found
> predict(outcome(#2)) invalid

This bug has been fixed, and will be available in the next ado-file update.
And if you are absolutely desperate to get it working now - download the slow but sure -oglm-. -oglm- estimates the same model as -ologit- by default but also supports the probit, cloglog and loglog links. I double-checked -oglm- versus -oprobit- and the predictnl command produced the same result in both cases. Example:

. use "http://www.indiana.edu/~jslsoc/stata/spex_data/ordwarm2.dta";
(77 & 89 General Social Survey)

. ologit warm yr89 male, nolog

Ordered logistic regression Number of obs = 2293
LR chi2(2) = 129.53
Prob > chi2 = 0.0000
Log likelihood = -2931.0051 Pseudo R2 = 0.0216

------------------------------------------------------------------------------
warm | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
yr89 | .5897259 .0784044 7.52 0.000 .436056 .7433958
male | -.6349161 .0773504 -8.21 0.000 -.7865201 -.4833122
-------------+----------------------------------------------------------------
/cut1 | -2.036695 .0809737 -2.1954 -1.877989
/cut2 | -.2968644 .0661125 -.4264425 -.1672863
/cut3 | 1.499808 .0736113 1.355533 1.644084
------------------------------------------------------------------------------

. predictnl phat=predict(outcome(#2)), se(phat_se)
equation cut2 not found
predict(outcome(#2)) invalid
r(198);

. oglm warm yr89 male

Ordered Logistic Regression Number of obs = 2293
LR chi2(2) = 129.53
Prob > chi2 = 0.0000
Log likelihood = -2931.0051 Pseudo R2 = 0.0216

------------------------------------------------------------------------------
warm | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
yr89 | .5897256 .0784044 7.52 0.000 .4360558 .7433955
male | -.6349165 .0773504 -8.21 0.000 -.7865205 -.4833125
-------------+----------------------------------------------------------------
/cut1 | -2.036696 .0809737 -25.15 0.000 -2.195401 -1.87799
/cut2 | -.2968648 .0661125 -4.49 0.000 -.4264429 -.1672867
/cut3 | 1.499808 .0736113 20.37 0.000 1.355532 1.644084
------------------------------------------------------------------------------

. predictnl phat=predict(outcome(#2)), se(phat_se)

. sum ph*

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
phat | 2293 .3145302 .0573749 .2243567 .3861832
phat_se | 2293 .0121664 .0004829 .0115066 .0130397

Or, if you happen to have -gologit2- installed, run it using the -pl- option, e.g.

gologit2 warm yr89 male, pl lrf

I'll have to add this to the documentation for my programs - "They work when the rest of Stata doesn't" :)


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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