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: comparing two mim gllamm logistic models

From   Maarten buis <>
Subject   Re: st: comparing two mim gllamm logistic models
Date   Mon, 7 Jun 2010 13:14:38 -0700 (PDT)

--- On Mon, 7/6/10, wrote:
> > For the second point, it seems to me that using the
> > one half of the p value will take care of the boundary
> > issue.

--- On Mon, 7/6/10, Maarten buis wrote:
> Unfortunately, the problem is more complicated than that,
> the boundery problem influences the sampling distribution 
> under the null hypothesis, as was discussed in the 
> help-file I refered to earlier. 

You can ofcourse explore this point using simulation. You
can look at the simulation below: it test a hypothesis that 
is true in the population, so the test statistic (chi2) 
should follow a chi square distribution, and the p-values
should follow a uniform distribution. This is tested
using -hangroot- which you need to download from SSC, type
in Stata -ssc install hangroot-. The confidence intervals
are there to take Monte Carlo error into account, i.e.
you expect some variation from the theoretical distribution
due to the fact that the simulation involves a random proces,
the "confidence interval" tells you how much variation to

*---------------- begin example ---------------------
program drop _all
program define sim, rclass
	drop _all
	set obs 100
	gen i = _n
	gen u = rnormal()
	expand 10
	gen x = rnormal()
	gen y = 1 + 1*x + u + .5*rnormal()
	xtset i
	xtmixed y x || i: x, iterate(20)
	est store a
	if e(converged) {
		xtmixed y x || i:, iterate(20)
		if e(converged) {
			est store b 
			lrtest a b
			return scalar p = r(p)
			return scalar ch2 = r(chi2)
simulate p=r(p) chi2=r(chi2), reps(500): sim
hangroot p, dist(uniform) par(0 1) susp notheor ci
hangroot chi2, dist(chi2) par(1) susp notheor ci
*------------------- end example ------------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

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


*   For searches and help try:

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