rsquaredacademy / olsrr

Tools for developing OLS regression models
https://olsrr.rsquaredacademy.com/
Other
102 stars 22 forks source link

Linear mixed model support? #138

Open vasili111 opened 4 years ago

vasili111 commented 4 years ago

It will be nice to add linear mixed models support. Currently by using olsrr with lmer I am getting errors:

Code

library(lme4)
library(olsrr)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
summary(fm1)
ols_plot_resid_qq(fm1)
ols_test_normality(fm1)

Errors

> ols_plot_resid_qq(fm1)
Hmmm.. Looks like you have specified the wrong model. Follow the below steps to debug this error.

* Check if you have used the lm() function to build the model.
* If you have never used it before, you can learn more by typing ?lm or help(lm) in the Console
.

Below is an example using mtcars data:
 lm(formula = mpg ~ disp + hp + wt, data = mtcars) 
 Happy modeling :)
Error:

and

> ols_test_normality(fm1)
Error in ols_test_normality.default(fm1) : y must be numeric
aravindhebbali commented 4 years ago

Hi @vasili111, yes currently olsrr supports only OLS models but we plan to support more models including linear mixed models in future (read 2020). Will keep you posted :).