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

# Re: st: Wald test in Random Coefficient Model

 From Maarten buis To statalist@hsphsun2.harvard.edu Subject Re: st: Wald test in Random Coefficient Model Date Fri, 25 Feb 2011 09:05:54 +0000 (GMT)

```--- On Thu, 24/2/11, Joerg Luedicke wrote:
> you could do to check if the variation of the effect across
> country is sort of considerable is to do a likelihood ratio
> test in which you compare the model fit with and without the
> random coefficient (-help lrtest-).

The bahavior of this test is not quite what we would expect.
The problem is that the null hypothesis is on the boundary of
the parameter space, i.e. the null hypothesis is that the
country level variance equals 0, and a variance can only be
>= 0. There is a discussion of that in (Gutierrez et al. 2001).

In the simulation below you can see that the distribution of
the p-values for the likelihood ratio test of a true null-
hypothesis for this variance really deviate from the uniform
distribution. Remember, that a test should reject a true null-
hypothesis 5% of the samples when we choose a significance
level of 5%, 10% of the samples when we choose a significance
level of 10%, etc. This means that a good performing test
should yield p-values that follow a uniform distribution.

*-------------------- begin example --------------------
program drop _all
program define sim, rclass
drop _all
set obs 50
gen country = _n
expand 10
gen x = rnormal()
gen y = runiform() < invlogit(0 + x)

xtset country

logit y x
est store a

xtlogit y x
est store b

lrtest a b, force
return scalar p = r(p)
end
simulate p=r(p), reps(1000) : sim
quantile p, aspect(1)
*------------------ end example ------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

Gutierrez, R., S. Carter, and D. M. Drukker. 2001. On
boundary-value likelihood-ratio tests. Stata Technical Bulletin,
60: 15–18.
<http://stata-press.com/journals/stbcontents/stb60.pdf>

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```