Hello,
I’m hoping to use runmlwin to run some crossclassified models in Stata (data set too large for Stata to handle with normal crossclassified procedures) and was hoping that a user here may be able to help me with the syntax.
I have tried the following syntax (adapted from the runmlwin user guide) however the estimates produced are those as would be if the data followed a standard hierarchical 3level structure. Can this syntax be adapted to tell Stata to treat the data as being crossclassified?
Null model, initial estimates:
runmlwin ELITE cons, ///
> level3(SCHOOL_ID: cons) ///
> level2(LSOA_ID: cons) ///
> level1(ID:) ///
> discrete(distribution(binomial) link(logit) denominator(cons) pql2) ///
> nopause
Further fitting by MCMC:
. runmlwin ELITE cons, ///
> level3(SCHOOL_ID: cons) ///
> level2(LSOA_ID: cons) ///
> level1(ID:) ///
> discrete(distribution(binomial) link(logit) denominator(cons)) ///
> mcmc(on) initsprevious nopause nogroup
I’d be grateful for any help! Thanks very much,
Jo
Fitting a crossclassified model in Stata

 Posts: 1139
 Joined: Mon Oct 19, 2009 10:34 am
Re: Fitting a crossclassified model in Stata
This should just be a case of setting the cc flag in the mcmc option so that the specified levels are treated as classifications. For examples of this see the MCMC guide chapter 15 replication materials on https://www.bristol.ac.uk/cmm/software/ ... /examples/.

 Posts: 4
 Joined: Tue Sep 10, 2019 2:10 pm
Re: Fitting a crossclassified model in Stata
Thanks Chris! Shortly before your reply I did find the 'cc' flag and added that to my null model syntax, but didn't also add 'on'. This was my syntax, will it still have worked correctly?
runmlwin elite cons, ///
level3(schoolid: cons) ///
level2(lsoaid: cons) ///
level1(id:) ///
discrete(distribution(binomial) link(logit) denominator(cons)) ///
mcmc(cc burnin(1000) chain(30000) thinning(10)) initsprevious nopause nogroup
The model produced (please see attached) doesn't actually indicate anywhere about being 'crossclassified', is this normal? It also doesn't include a table with level variables and number of groups as the models in the link you shared do (before the burnin and chain info etc.)  do you know why this might be?
Sorry for all the questions! Thanks very much,
Jo
runmlwin elite cons, ///
level3(schoolid: cons) ///
level2(lsoaid: cons) ///
level1(id:) ///
discrete(distribution(binomial) link(logit) denominator(cons)) ///
mcmc(cc burnin(1000) chain(30000) thinning(10)) initsprevious nopause nogroup
The model produced (please see attached) doesn't actually indicate anywhere about being 'crossclassified', is this normal? It also doesn't include a table with level variables and number of groups as the models in the link you shared do (before the burnin and chain info etc.)  do you know why this might be?
Sorry for all the questions! Thanks very much,
Jo
 Attachments

 Null cc model.docx
 (2.74 MiB) Downloaded 39 times

 Posts: 1139
 Joined: Mon Oct 19, 2009 10:34 am
Re: Fitting a crossclassified model in Stata
Your syntax looks correct to me. If you remove the nogroup option from your command and then compare the extra grouping information provided between the IGLS and MCMC models you should see that the number of units within each group changes to match the crossclassification.

 Posts: 4
 Joined: Tue Sep 10, 2019 2:10 pm
Re: Fitting a crossclassified model in Stata
Hi Chris,
Thank you for getting back to me and apologies to come back with another question…
As you will have seen from my syntax, I obtained the initial starting estimates from a pql2 estimate on a standard 3level hierarchical model before using these for my crossclassified model fitted with MCMC.
This seems to be the process outlined in the MLwiN practical of the LEMMA chapter on crossclassified models, however I have seen a suggestion in another post on this forum as to manually inputting MCMC starting values rather than doing the latter. This query did relate to having received an error message about starting values for the MCMC estimation however – so I guess my question is, is it OK to proceed as I have done if no error presents or would I still be better advised inputting starting values?
Thanks very much,
Jo
Thank you for getting back to me and apologies to come back with another question…
As you will have seen from my syntax, I obtained the initial starting estimates from a pql2 estimate on a standard 3level hierarchical model before using these for my crossclassified model fitted with MCMC.
This seems to be the process outlined in the MLwiN practical of the LEMMA chapter on crossclassified models, however I have seen a suggestion in another post on this forum as to manually inputting MCMC starting values rather than doing the latter. This query did relate to having received an error message about starting values for the MCMC estimation however – so I guess my question is, is it OK to proceed as I have done if no error presents or would I still be better advised inputting starting values?
Thanks very much,
Jo

 Posts: 1139
 Joined: Mon Oct 19, 2009 10:34 am
Re: Fitting a crossclassified model in Stata
The starting values from pql2 estimation would be based on the hierarchical model, which depending on how different the structure from the crossclassified version could be quite a different model. In some cases the hierarchical model could come up with some very different estimates (or even set some to zero) in which case the MCMC estimation cannot proceed without modifying the starting values.
To test how sensitive your model is to the starting values you could try a range of different starting values to see if the model always ends up in the same place. Obviously you would want to do the normal MCMC convergence tests to ensure that the model has converged to a stable distribution.
To test how sensitive your model is to the starting values you could try a range of different starting values to see if the model always ends up in the same place. Obviously you would want to do the normal MCMC convergence tests to ensure that the model has converged to a stable distribution.

 Posts: 4
 Joined: Tue Sep 10, 2019 2:10 pm
Re: Fitting a crossclassified model in Stata
Thanks again Chris.
Would it please be possible to provide me with some template code as to how I could set these starting values within stata  within the context of a null 3level crossclassifed model say? I have run some separate 2level analyses with each of the higher levels in my models (schools and LSOAs) so am guessing that estimates from these could be used? Would really appreciate any advice in any case as this is my first real experience of multilevel modelling so am not very confident as to how I would actually go about doing so.
Thanks very much,
Jo
Would it please be possible to provide me with some template code as to how I could set these starting values within stata  within the context of a null 3level crossclassifed model say? I have run some separate 2level analyses with each of the higher levels in my models (schools and LSOAs) so am guessing that estimates from these could be used? Would really appreciate any advice in any case as this is my first real experience of multilevel modelling so am not very confident as to how I would actually go about doing so.
Thanks very much,
Jo

 Posts: 1139
 Joined: Mon Oct 19, 2009 10:34 am
Re: Fitting a crossclassified model in Stata
Chapter five of the MCMC manual (https://www.bristol.ac.uk/cmm/software/ ... nuals.html) discusses setting starting values, and you can find the Stata code to replicate this at https://www.bristol.ac.uk/cmm/software/ ... /examples/. It may be that once you investigate these you find the starting values don't make much difference and your current ones are fine.