rmcelreath / rethinking

Statistical Rethinking course and book package
2.13k stars 600 forks source link

Multilevel ordered logistic regression model #43

Open AntonioMartini opened 8 years ago

AntonioMartini commented 8 years ago

For example Is there a way to extend the following example given at page 337 in the book to the multilevel case?


m11.1stan <- map2stan(
alist(
response ~ dordlogit( phi , cutpoints ),
phi <- 0,
cutpoints ~ dnorm(0,10)
) ,
data=list(response=d$response),
start=list(cutpoints=c(-2,-1,0,1,2,2.5)) ,
chains=2 , cores=2 )

Let's suppose we would like to estimate the 'cutpoints' for different education groups in a multilevel fashion. It would seem that we need to impose a hierarchical structure to 'cutpoints' .How could this be achieved within the Rethinking package? I have tried different options but none compiled for different reasons.

Thanks, Antonio

rmcelreath commented 8 years ago

I don't think this is possible with map2stan. There's no obvious way to do it, at least.

AntonioMartini commented 8 years ago

With some help I have managed to code this in Stan:

https://groups.google.com/forum/#!category-topic/stan-users/general/sgX2Edo8qiQ

This might help with supporting this feature in the Rethinking package in the future.