Closed aravindhebbali closed 6 years ago
The error was due to scaling and centering all the predictors instead of only the numeric types.
library(olsrr)
#>
#> Attaching package: 'olsrr'
#> The following object is masked from 'package:datasets':
#>
#> rivers
mt <- mtcars
mt$cyl <- as.factor(mt$cyl)
ols_regress(mpg ~ disp + cyl + disp*cyl, data = mt)
#> Model Summary
#> --------------------------------------------------------------
#> R 0.933 RMSE 2.372
#> R-Squared 0.870 Coef. Var 11.804
#> Adj. R-Squared 0.845 MSE 5.624
#> Pred R-Squared 0.794 MAE 1.778
#> --------------------------------------------------------------
#> RMSE: Root Mean Square Error
#> MSE: Mean Square Error
#> MAE: Mean Absolute Error
#>
#> ANOVA
#> --------------------------------------------------------------------
#> Sum of
#> Squares DF Mean Square F Sig.
#> --------------------------------------------------------------------
#> Regression 979.813 5 195.963 34.842 0.0000
#> Residual 146.234 26 5.624
#> Total 1126.047 31
#> --------------------------------------------------------------------
#>
#> Parameter Estimates
#> ----------------------------------------------------------------------------------------
#> model Beta Std. Error Std. Beta t Sig lower upper
#> ----------------------------------------------------------------------------------------
#> (Intercept) -1.725 0.594 -2.907 0.007 -2.945 -0.505
#> disp -2.779 0.574 -2.779 -4.842 0.000 -3.959 -1.599
#> cyl6 1.696 0.639 0.712 2.655 0.013 0.383 3.009
#> cyl8 1.296 0.634 0.653 2.044 0.051 -0.008 2.600
#> disp:cyl6 2.853 0.748 0.622 3.817 0.001 1.317 4.390
#> disp:cyl8 2.375 0.608 1.451 3.909 0.001 1.126 3.624
#> ----------------------------------------------------------------------------------------