Hi,
I have data with level 1 as individuals, clustered within three different residential areas (at three different ages). There are approx 4000 people, and ~1000 areas per timepoint. I am trying to fit a cross-classified model, starting with only including two of the areas.
I have:
matrix b = (1.,0.33,0.33,0.5)
runmlwin newbalance cons, level3(cons: s1-s1001, diagonal) level2(area2: cons) level1(id: cons) constraints(1/1000) mcmc(cc) initsb(b)
where s1-s1001 are the individual variables for each category of area 1 (calculated using the example from the runmlwin documentation) and the constraints are also calculated using that example:
tabu area1, gen(s)
forvalues i = 1(1)1000 {
constraint define `i' [RP3]var(s1) = [RP3]var(s`i'+1)
}
When I run the model, it just says "too many macros".
Any help would be much appreciated (and I haven't even tried the three-way cross-classification yet!).
Thanks
Kate
trouble fitting cross-classified model
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: trouble fitting cross-classified model
This is a usually caused by a Stata limit, see http://www.cmm.bristol.ac.uk/forum/view ... ?f=3&t=176 for a possible workaround. Note, you should not longer need to increase the MLwiN maximum number of explanatory variables as indicated in the solution because runmlwin now sets this based on your model specification.
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: trouble fitting cross-classified model
Hi Kate,
You have a two-way cross-classified data structure whereby measurements are nested within both individuals and areas.
There are two ways to fit cross-classified (CC) models in MLwiN
(1) IGLS (via a cumbersome constrained hierarchcial model)
(2) MCMC
The IGLS approach is only feasible when you have a small number of higher level units. You have many higher-level units so use MCMC.
To fit a cross-classified model using MCMC, all you need is the following...
Where we have specified intial values for the four model parameters in the matrix a.
An alternative way to obtain initial values is to simply fit the naive three-level hierarchical model to these data using IGLS.
Best wishes
George
You have a two-way cross-classified data structure whereby measurements are nested within both individuals and areas.
There are two ways to fit cross-classified (CC) models in MLwiN
(1) IGLS (via a cumbersome constrained hierarchcial model)
(2) MCMC
The IGLS approach is only feasible when you have a small number of higher level units. You have many higher-level units so use MCMC.
To fit a cross-classified model using MCMC, all you need is the following...
Code: Select all
. matrix a = (1,0.33,0.33,0.33)
. runmlwin response cons, ///
leve3(individual: cons) ///
level2(area: cons) ///
level1(measurment: cons) ///
mcmc(cc) initsb(a)
An alternative way to obtain initial values is to simply fit the naive three-level hierarchical model to these data using IGLS.
Best wishes
George
-
- Posts: 5
- Joined: Fri Nov 11, 2011 2:37 pm
Re: trouble fitting cross-classified model
Thank you both! All running fine now (even the three-way model). Thanks again for your help.