Closed jtheog closed 1 year ago
Thanks @jtheog for filing this issue. We have pushed a fix to the development branch.
# Install development version from GitHub
# install.packages("devtools")
devtools::install_github("rsquaredacademy/olsrr@develop")
The error was the result of a bug in olsrr checking if the supplied model belonged to the lm
class. The bug has been fixed. Let us know if you face any other issues.
library(olsrr)
#>
#> Attaching package: 'olsrr'
#> The following object is masked from 'package:datasets':
#>
#> rivers
library(mixlm)
#>
#> Attaching package: 'mixlm'
#> The following objects are masked from 'package:stats':
#>
#> glm, lm
mod01 <- lm(mpg ~ disp + hp + wt, data = mtcars)
mod02 <- lm(mpg ~ disp + hp, data = mtcars)
ols_vif_tol(mod01)
#> Variables Tolerance VIF
#> 1 disp 0.1365278 7.324517
#> 2 hp 0.3654126 2.736633
#> 3 wt 0.2064146 4.844618
ols_mallows_cp(mod02, mod01)
#> [1] 14.7087
Created on 2022-12-19 by the reprex package (v0.3.0)
Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://stackoverflow.com/.
Please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.
Brief description of the problem When
olsrr
andmixlm
packages are loaded together, ols_vif_tol() and ols_mallows_cp() do not recognize linear models as linear models.The situation below throws the following error msg: "Hmmm.. Looks like you have specified the wrong model. Follow the below steps to debug this error... ..."
Whereas the situation below without the mixlm package loaded is successful. Note: if you still have the mixlm package attached from the previous situation, you must un-attach it to get the olsrr functions to work.