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

error from tab_model function #385

Closed
JM-RG opened this issue Jul 20, 2018 · 9 comments
Closed

error from tab_model function #385

JM-RG opened this issue Jul 20, 2018 · 9 comments
Labels

Comments

@JM-RG
Copy link

JM-RG commented Jul 20, 2018

Hi,
sjPlot package is fascinating so first of all thank you for this amazing contribution to R users community.

I would like to create an lmer output table using the tab_model function. However I get this (btw not so informative) error: Error: Column 6 must be named

The model is in the format
mod <-lmer( y ~ (-1) + Sex + (1|ID) + (1|Year), data = df, REML = TRUE, verbose=TRUE, na.action="na.fail", control=lmerControl(optimizer="Nelder_Mead"))

I get all the common outputs from the model without problems. Also, using tidy_lmer function I can get a more simple output table of the model without problems.

I have inspecting some time the tab_model function inside, trying to find where the fix is comming but with no luck.

Do you have some idea where the problem could be?

I have no reproduccible example but the output of the model can be found here:

https://www.dropbox.com/s/29922nqycgjbst7/mod.Rdata?dl=1

and I can provide more information if needed.

Thank you so much in advance.

@strengejacke
Copy link
Owner

I think the (-1) on your formula is causing troubles. Maybe with a function from sjstats, like sjstats:: model_frame() or sjstats::pred_vars(). I'm currently traveling, but will look into this after I'm back.
Maybe you can check if the same issue occurs due the example model in lme4::lmer(), with (-1) in the formula?

@JM-RG
Copy link
Author

JM-RG commented Jul 20, 2018

Hi Daniel,

thanks for your quick reply. Surprisingly to me I´ve tried tab_model with the example models provided in lme4::lmer() and got the same error with both intercept structure sintax (with and without (-1)) .
I also checked out with my own model without (-1) and same problem pops up: Error: Column 6 must be named

I was initially thinking the problem may came from my data but looks like the problem comes from other aspect since it also happens with different data.

I hope you can provide help with this issue in the next days.

thank you again

@JM-RG
Copy link
Author

JM-RG commented Jul 20, 2018

Hi again,

I have tried the same approach in another computer with different R sessions and got the same error.
In case it is informative you can find my session info here:
https://www.dropbox.com/s/bwzyv4q8jjyfu8k/sessionInfo.txt?dl=0

In another computer with a different session (see sessionInfo document linked), the function worked out well with the example data from lme4, restarting the session and charging only regression-modeling related libraries lme4 and sjPlot:
https://www.dropbox.com/s/bjhwee4c3idai8g/sessionInfo_zz.txt?dl=0

However, runing my model especifying lme4::lmer give me this error:

Computing p-values via Wald-statistics approximation (treating t as Wald z).
Error in UseMethod("family") : 
  no applicable method for 'family' applied to an object of class "logical"

Whereas the class of the object model with mi initial session was lmerModLmerTest (from lmerTest), the class of the model launching this new error is lmerMod (from lme4)
So it may be related to interaction among packages or something similar? Just to trying to give you as much information as possible....

@strengejacke
Copy link
Owner

When I re-fit the model user lme4::lmer(), it works for me. The error lies in the broom-package:

broom::tidy(mod)
#> Error: Column 6 must be named

@strengejacke strengejacke added invalid and removed bug labels Jul 23, 2018
@strengejacke
Copy link
Owner

I opened an issue: tidymodels/broom#446

@strengejacke
Copy link
Owner

Can you confirm that tab_model() works when you use lme4 to fit the model?

@JM-RG
Copy link
Author

JM-RG commented Jul 25, 2018

Yes, it does work when I run the model using lme4 ("lmerMod" class) and only have loaded in the session the packages lme4 and sjPlot. However if I load other modelling packages such as lmerTest (i.e. I need to run models with it and thus the class of the model is "lmerModLmerTest") or broom, tab_model function doesn't work.

@strengejacke
Copy link
Owner

broom should be no problem if loaded, only lmerTest, I think. I'll close this issue now, we need to wait for the broom.mixed package to be released.

@strengejacke
Copy link
Owner

I added a workaround (i.e. an own tidier) for lmerModLmerTest-Objects, so this issue should be fixed in sjPlot now. Will commit tonight.

strengejacke added a commit that referenced this issue Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants