Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systematic error with nested model #26

Closed
ericwol opened this issue May 5, 2022 · 2 comments
Closed

systematic error with nested model #26

ericwol opened this issue May 5, 2022 · 2 comments

Comments

@ericwol
Copy link

ericwol commented May 5, 2022

Hi, I really like this package as I find it intuitive and great for multinomial regression - thanks for building and sharing it. I am having an issue with using it for nested designs though. I have tried the following implementation (illustrated here with a toy dataset) on a number of datasets and I'm systematically getting a "Error in *tmp*[[k]] : subscript out of bounds" error (right after the statement "converged" gets printed in the trace). Is there something I'm missing, or a workaround perhaps? Best wishes, E.

set.seed(1)
country = c("france","ireland")
county = c("cork","dublin","limerick","galway")
dept = c("var","alpes-maritimes","vaucluse","bouches-du-rhone")
fake.fr = expand.grid(country[1],dept)
fake.ie = expand.grid(country[2],county)
for(i in 1:6){ # creating 512 rows of this data
fake.fr = rbind(fake.fr,fake.fr)
fake.ie = rbind(fake.ie,fake.ie)
}
fake = rbind(fake.fr,fake.ie)
n = nrow(fake)
fake$x1 = runif(n)
fake$x2 = rnorm(n)
fake$y = factor(c("coffee","tea")[sample(1:2,size=n,replace=T)])
names(fake)[1:2] = c("country","county")

level-2 random effects works:

(om = mblogit(y~x1+x2, random=~1|country, data=fake))

level-2 and level-3 random effects does not work:

(om = mblogit(y~x1+x2, random=~1|county/country, data=fake))

@melff
Copy link
Owner

melff commented May 5, 2022

This looks familiar - similar to a bug that was fixed in one of the newer releases. Which release/version are you using?
Thanks

@ericwol
Copy link
Author

ericwol commented May 5, 2022 via email

@melff melff closed this as completed May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants