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

Random / varying effects are labelled incorrectly using tidy #86

Open
richramsey opened this issue Mar 4, 2020 · 4 comments
Open

Random / varying effects are labelled incorrectly using tidy #86

richramsey opened this issue Mar 4, 2020 · 4 comments

Comments

@richramsey
Copy link

richramsey commented Mar 4, 2020

I am new to broom.mixed, so this may be an elementary mistake on my part. I want to plot the random effects / varying effects as caterpillar plots following a model run in brms. However, when I get the output of tidy, the varying effects for intercepts are labelled correctly, but the varying effects for slopes are not. Specifically, the 'level' and 'term' columns are incorrect for the random slopes. The levels for participant should be the same for all varying effects of interest, but once it goes beyond the intercept things seem to get messed up. Model and table below. Item has 80 levels, participant has 11 levels. Any ideas on the problem/solution?

brms: 2.11.6
broom.mixed: 0.2.4

b4 <- brm(rating ~ 1 + painting_type_dev * motion_dev * load_dev +
          (1 + painting_type_dev * motion_dev * load_dev|participant) +
          (1|item),
        data = data_aes_dev, family = cumulative("probit"),
        prior = c(prior(normal(0, 5), class = Intercept),
                prior(cauchy(0, 2), class = b)),
        iter = 6000, warmup = 1000, cores = 4, chains = 4,
        control = list(adapt_delta = 0.99),
        inits = 0)

tidy(b4, effects = "ran_vals", robust=T, conf.method = "HPDinterval")
head(tidy_b4_ran_vals)

ran_vals.pdf

@bbolker
Copy link
Owner

bbolker commented Mar 7, 2020

Not sure yet, will look into it ... A reproducible example would help a lot.

@richramsey
Copy link
Author

Hi, thanks for your response. I found the problem. It was the way I was labelling factors. Once I removed "_" from factor labels, everything seemed to work fine. Thanks again for repsonding.
Rich

@bbolker
Copy link
Owner

bbolker commented Mar 8, 2020

thanks, you saved me a bunch of time. I should (a) document this limitation and (b) check names and give a warning if they contain "_" (if possible).

@richramsey
Copy link
Author

Yes, that sounds good. Thanks. Fantastic package by the way.

bbolker added a commit that referenced this issue Mar 8, 2020
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