You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example code for ols_correlations() works fine for the example model with 4 predictors, as well as a model with 3, but returns an error for models with 2 predictors. It would make sense to return an error for models with a single predictor, but the function should work for models with 2 predictors. I've had similar issues with using ols_correlations() on other models with 2 predictors.
library(olsrr)
#> #> Attaching package: 'olsrr'#> The following object is masked from 'package:datasets':#> #> riversmodel.4<- lm(mpg~disp+hp+wt+qsec, data=mtcars)
ols_correlations(model.4)
#> Correlations #> -------------------------------------------#> Variable Zero Order Partial Part #> -------------------------------------------#> disp -0.848 0.048 0.019 #> hp -0.776 -0.224 -0.093 #> wt -0.868 -0.574 -0.285 #> qsec 0.419 0.219 0.091 #> -------------------------------------------model.3<- lm(mpg~disp+hp+wt, data=mtcars)
ols_correlations(model.3)
#> Correlations #> -------------------------------------------#> Variable Zero Order Partial Part #> -------------------------------------------#> disp -0.848 -0.017 -0.007 #> hp -0.776 -0.458 -0.214 #> wt -0.868 -0.559 -0.280 #> -------------------------------------------model.2<- lm(mpg~disp+hp, data=mtcars)
ols_correlations(model.2)
#> Error in terms.formula(formula, data = data): '.' in formula and no 'data' argument
The text was updated successfully, but these errors were encountered:
The example code for
ols_correlations()
works fine for the example model with 4 predictors, as well as a model with 3, but returns an error for models with 2 predictors. It would make sense to return an error for models with a single predictor, but the function should work for models with 2 predictors. I've had similar issues with usingols_correlations()
on other models with 2 predictors.The text was updated successfully, but these errors were encountered: