Hey there,
I want to fit a multiple membership model using the R2MLwiN package and get the error in R:
Error in combchains[, FP.names, drop = FALSE] : subscript out of bounds
The model is estimated correctly in MLwiN as far as I can see (using debugmode = T).
Hence, I get the feeling it has to with the R2MLwiN package itself. I tried to debug it myself but can't find a solution.
The code I specified in R is:
data.wide <- readRDS("mm.rds")
runMLwiN(y ~ 1 + country.x + gov.het.sum + (1 | id.country) + (1 | p) + (1 | id.gov),
estoptions = list(EstM = 1, debugmode = T, mm = list(NA, list(mmvar = list("p", "p2", "p3", "p4"), weights = list("w1", "w2", "w3", "w4")), NA)),
data = data.wide)
Please find the data attached. I had to zip it before uploading it.
I am very grateful for any help!
Kind regards,
Benjamin
Multiple membership model: Error in combchains[, FP.names, drop = FALSE] : subscript out of bounds
-
- Posts: 8
- Joined: Thu Nov 03, 2016 11:17 am
Multiple membership model: Error in combchains[, FP.names, drop = FALSE] : subscript out of bounds
- Attachments
-
- mm.zip
- (65.05 KiB) Downloaded 527 times
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Multiple membership model: Error in combchains[, FP.names, drop = FALSE] : subscript out of bounds
This error is due to a mismatch between the parameter names and the chains when bringing the data back to R. In the parameter names any "." characters have been replaced with "_" (e.g. country.x becomes country_x), whereas this is not the case for the parameter chains. This means that R2MLwiN cannot match them back together when loading the results. I will try to determine which naming is correct and fix this for a later version of R2MLwiN, however in the mean time the workaround would be to rename your variables so that they do not contain any "." characters.
-
- Posts: 8
- Joined: Thu Nov 03, 2016 11:17 am
Re: Multiple membership model: Error in combchains[, FP.names, drop = FALSE] : subscript out of bounds
Thanks a lot. That indeed solved the problem. For the sake of completeness, this code works:
data.wide <- readRDS("mm.rds")
runMLwiN(y ~ 1 + country_x + gov_het_sum + (1 | id_country) + (1 | p) + (1 | id_gov),
estoptions = list(EstM = 1, debugmode = T, mm = list(NA, list(mmvar = list("p", "p2", "p3", "p4"), weights = list("w1", "w2", "w3", "w4")), NA)),
data = data.wide)
data.wide <- readRDS("mm.rds")
runMLwiN(y ~ 1 + country_x + gov_het_sum + (1 | id_country) + (1 | p) + (1 | id_gov),
estoptions = list(EstM = 1, debugmode = T, mm = list(NA, list(mmvar = list("p", "p2", "p3", "p4"), weights = list("w1", "w2", "w3", "w4")), NA)),
data = data.wide)
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Multiple membership model: Error in combchains[, FP.names, drop = FALSE] : subscript out of bounds
Thanks for confirming this. I have added it to the list of known bugs:
http://www.bristol.ac.uk/cmm/software/r ... nbugs.html
http://www.bristol.ac.uk/cmm/software/r ... nbugs.html