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: test for trend in r x c tables with clustering

From   "Sheena Sullivan" <>
To   <>
Subject   st: test for trend in r x c tables with clustering
Date   Mon, 4 Mar 2013 15:13:53 +1100

I have r x c data that look something like this
X	year	cluster
4	1	100
7      	6 	209
4      	1   	200
1	2	201
2	3	404
3	2	500

There are up to 7 categories of variable X, up to 6 years, and up to 500
clusters (that complete dataset is around 250,000 observations).

I want to be able to test for trend across years.  I found some very helpful
guidance from William Sribney on the Stata website at

There, he suggests using -regress- to obtain a p-value for a test of trend.
However, I'm unsure whether it is appropriate to take this guidance one step
further and use -xtmixed- to obtain cluster-adjusted estimates for trend.
If I understand correctly, I can test for trend without clustering using
-regress- (even though X is categorical, not continuous):

. regress X year

To account for clustering, with -xtmixed-  this would change to:

. xtmixed X year || cluster

I presume then that the p-value for the model (i.e. Prob > chi2) is for the
trend across years, with standard errors adjusted for clustering.  

Could someone please advise whether this is a sensible approach?  

I am using Stata 12 on Windows 7.

Kind regards

*   For searches and help try:

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