Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: permute with multi-level models

From   "Jessica Gottlieb" <>
To   <>
Subject   st: permute with multi-level models
Date   Tue, 11 Oct 2011 18:27:43 -0700


I am trying to run a Monte Carlo simulation on a mixed model regression to
infer standard errors and p values. 

I am using the permute command after running a multi-level model with
xtmixed (see below).  The treatment variable t has 3 values {0,1,2} and I am
interested in estimating the coefficients using i.t.  The data is
multi-level in which individuals are nested within villages which are nested
within communes (reflected in the random effects).  

program pxtmixed, rclass
	xtmixed trust i.t || commune: || village:
	matrix x=e(b)
	return scalar t1 = x[1, 2]
permute t r(t1), reps(1000): pxtmixed

I have 2 major questions: 
1. I want to permute t across communes such that the value of t is uniform
for all individuals within a given commune.  Does anyone have thoughts on
how to do this?
2. I am interested in estimating p values for 2 coefficients, but when I try
to return a matrix rather than a scalar (see below), the command doesn't go
through.  I get an error that says "weights not allowed".

program pxtmixed, rclass
	xtmixed trustcouncil i.t || commune: || village:
	matrix x=e(b)'
	return matrix coeff = x[2..3, 1]
permute t r(coeff), reps(1000): pxtmixed

Thanks for any advice on these questions, 

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index