Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstepAIC regression fails when model formula contains inline functions #11
Comments
|
> library(olsrr)
> library(caret)
> data("Sacramento")
> lm_fit1 <- lm(log(price) ~ . - city, data = Sacramento)
> ols_stepaic_both(lm_fit1)
No more variables to be added or removed.
Stepwise Summary
---------------------------------------------------------------------------
Variable Method AIC RSS Sum Sq R-Sq Adj. R-Sq
---------------------------------------------------------------------------
sqft addition 740.189 119.967 137.191 0.533 0.533
zip addition 470.175 77.767 179.391 0.698 0.674
type addition 421.418 73.487 183.671 0.714 0.691
baths addition 419.514 73.18 183.978 0.715 0.692
---------------------------------------------------------------------------
> lm_fit2 <- lm(price ~ beds + baths + log(sqft), data = Sacramento)
> ols_stepaic_both(lm_fit2)
No more variables to be added or removed.
Stepwise Summary
----------------------------------------------------------------------------------------
Variable Method AIC RSS Sum Sq R-Sq Adj. R-Sq
----------------------------------------------------------------------------------------
log(sqft) addition 23833.104 6917101778647.02 9090748642827.41 0.568 0.567
beds addition 23784.59 6552176660177.97 9455673761296.46 0.591 0.59
---------------------------------------------------------------------------------------- |
ols_stepaic_both()returns an error when model formula contains inline functions.Session Info