Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Wald test in Random Coefficient Model

From   Maarten buis <>
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)
simulate p=r(p), reps(1000) : sim
quantile p, aspect(1)
*------------------ end example ------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Gutierrez, R., S. Carter, and D. M. Drukker. 2001. On 
boundary-value likelihood-ratio tests. Stata Technical Bulletin, 
60: 15–18.

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


*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index