Can runmlwin handle CAR models at two levels?

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
yransome
Posts: 12
Joined: Wed Apr 22, 2015 12:07 pm

Can runmlwin handle CAR models at two levels?

Post by yransome »

Dear runmlwin community,

I am trying to fit a spatiotemporal model using with the following code

runmlwin outcome cons year covariate1, ///
level3(POLY_ID: year cons, carids(mmid1-mmid10) carweights(carweight1-carweight10)) ///
level2(POLY_ID: cons) ///
level1(POLY_ID: ) ///
discrete(distribution(poisson) link(log) offset(logexp)) ///
mcmc( burnin (10000) chain(50000) refresh(500)) initsprevious nopause irr

* I am trying to replicate code from CARBayes (to fit a Spatiotemporal model), which assigns a CAR component both to space (POLY_ID) and the year (year). I am successful fitting the CAR component to space by removing the year variable from level 3.

However, when I try to fit the CAR component to year as well, I get the error that "only constant terms may be random at the CAR classification"
Question: Can this be fit in runmlwin? or is the program not yet capable of fitting CAR to two levels? or is there some way to manipulate the code to accommodate both?

I attached a word document with the statistical model and description of what I am trying to replicate (S1).

Thank you in advance for reviewing and any feedback you may have,
Attachments
Replicating analysis in CARBayes_Methods.docx
(14.5 KiB) Downloaded 384 times
billb
Posts: 157
Joined: Fri May 21, 2010 1:21 pm

Re: Can runmlwin handle CAR models at two levels?

Post by billb »

Hi Yransome,
The CAR modelling in MLwiN (and hence runMLwiN) is limited to only having a constant random at the CAR distributed residuals level i.e. we can't include a spatially varying random slope in a CAR model. We did extend the CAR modelling so that you could have different levels of CAR residuals e.g. having spatially correlated residuals at 2 different levels of geography but not random slopes.
Best wishes,
Bill.
yransome
Posts: 12
Joined: Wed Apr 22, 2015 12:07 pm

Re: Can runmlwin handle CAR models at two levels?

Post by yransome »

Hello Billy,

Thank you for the reply.
A follow-up question, so at best with the current program, we can specify random intercepts at levels 2 and 3.

Although it's not the same as what i was trying to accomplish with the model, would it be possible then to
treat "year" as a level, and poly ID nested in year?
But then, I would have to somehow create new mmids and carweights for year?

--
Thanks in advance for your thoughts!

Yusuf
billb
Posts: 157
Joined: Fri May 21, 2010 1:21 pm

Re: Can runmlwin handle CAR models at two levels?

Post by billb »

Hi Yusuf,
I guess you could and the dependence structure would presumably be easy with each year a neighbour of it's next and last but this is answering something completely different as this would be overall year effects and not different year effects per neighbourhood.
Best wishes,
Bill (no y!)
Post Reply