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

From |
Richard Williams <[email protected]> |

To |
[email protected] |

Subject |
st: ml command and chi-square tests |

Date |
Fri, 25 Mar 2005 13:51:32 -0500 |

According to the documentation, the -ml- command will provide a Wald test (rather than an LR test) when you specify robust, cluster or pweights. However, I am finding that it also provides a Wald test when you use the -constraint- option. Why? This isn't mentioned in the documentation. Is there some mathematical reason for this, or is it a bug/limitation of the software, or what? The log likelihood is being reported for the constrained model (not a pseudo log likelihood) so I don't understand why it can't give me a LR chi-square instead of a Wald chi-square for the model.

Here is a simple example. The program for the likelihood function is

program define mylogit

args lnf Xb

replace `lnf' = -ln(1+exp(-`Xb')) if $ML_y1==1

replace `lnf' = -`Xb' - ln(1+exp(-`Xb')) if $ML_y1==0

end

Using this program, I

(a) estimate a constant only model. This gives me the info the subsequent model needs to compute a LR chi-square

(b) run an unconstrained model. LR chi-square is reported

(c) run the constant-only model again

(d) run a constrained model where the effect of 1 variable is constrained to be 0. It reports Wald chi-square instead of LR chi-square. Why? I can get an LR chi-square by rerunning the variable dropped, and LL is being reported (and it is correct) so why can't I get LR chi-square in the output? (A workaround is to use -estimates store- and -lrtest- but I'd rather save all that trouble.)

------------------------

. webuse auto

(1978 Automobile Data)

. * Null model

. ml model lf mylogit (foreign=)

. quietly ml maximize

. * Unconstrained Model

. ml model lf mylogit (foreign=mpg weight), continue

. ml maximize, nolog

Number of obs = 74

LR chi2(2) = 35.72

Log likelihood = -27.175156 Prob > chi2 = 0.0000

------------------------------------------------------------------------------

foreign | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

mpg | -.1685869 .0919175 -1.83 0.067 -.3487418 .011568

weight | -.0039067 .0010116 -3.86 0.000 -.0058894 -.001924

_cons | 13.70837 4.518709 3.03 0.002 4.851859 22.56487

------------------------------------------------------------------------------

. * Null model again

. ml model lf mylogit (foreign=)

. quietly ml maximize

. * Constrained Model

. constraint define 1 mpg=0

. ml model lf mylogit (foreign=mpg weight), continue constraint(1)

. ml maximize, nolog

Number of obs = 74

Wald chi2(1) = 18.03

Log likelihood = -29.054002 Prob > chi2 = 0.0000

( 1) [eq1]mpg = 0

------------------------------------------------------------------------------

foreign | Coef. Std. Err. z P>|z| [95% Conf. Interval]

-------------+----------------------------------------------------------------

mpg | (dropped)

weight | -.0025874 .0006094 -4.25 0.000 -.0037817 -.001393

_cons | 6.282599 1.603967 3.92 0.000 3.138882 9.426317

------------------------------------------------------------------------------

*

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

- Prev by Date:
**st: Post-estimation commands** - Next by Date:
**Re: st:** - Previous by thread:
**st: RE: adding text to "by graphs"** - Next by thread:
**Re: st: ml command and chi-square tests** - Index(es):

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