Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression fails when model formula contains inline functions #21

Closed
aravindhebbali opened this issue Jun 5, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@aravindhebbali
Copy link
Member

commented Jun 5, 2017

ols_regress() returns an error when model formula contains inline functions.

> library(caret)
> data("Sacramento") 
> lm_fit2 <- lm(price  ~ beds + baths + log(sqft), data = Sacramento)
> ols_regress(lm_fit2)
Error in eval(predvars, data, env) : object 'sqft' not found
Called from: eval(predvars, data, env)

@aravindhebbali aravindhebbali added the bug label Jun 5, 2017

@aravindhebbali aravindhebbali added this to the v0.2.0 milestone Jun 5, 2017

@aravindhebbali aravindhebbali self-assigned this Jun 5, 2017

aravindhebbali added a commit that referenced this issue Jun 5, 2017

@aravindhebbali

This comment has been minimized.

Copy link
Member Author

commented Jun 5, 2017

ols_regress() does not return an error when the model formula contains inline functions.

> library(olsrr)
> library(caret)
> data("Sacramento")
> lm_fit2 <- lm(price  ~ beds + baths + log(sqft), data = Sacramento)
> ols_regress(lm_fit2)
                           Model Summary                             
--------------------------------------------------------------------
R                       0.769       RMSE                  83983.749 
R-Squared               0.591       Coef. Var                34.048 
Adj. R-Squared           0.59       MSE                7053270082.615 
Pred R-Squared          0.586       MAE                   60597.878 
--------------------------------------------------------------------
 RMSE: Root Mean Square Error 
 MSE: Mean Square Error 
 MAE: Mean Absolute Error 

                                     ANOVA                                      
-------------------------------------------------------------------------------
                        Sum of                                                 
                       Squares     DF         Mean Square       F         Sig. 
-------------------------------------------------------------------------------
Regression        9.462416e+12      3        3.154139e+12    447.188    0.0000 
Residual          6.545435e+12    928      7053270082.615                      
Total             1.600785e+13    931                                          
-------------------------------------------------------------------------------

                                            Parameter Estimates                                             
-----------------------------------------------------------------------------------------------------------
      model            Beta    Std. Error    Std. Beta       t        Sig            lower           upper 
-----------------------------------------------------------------------------------------------------------
(Intercept)    -1865620.150     79365.412                 -23.507    0.000    -2021376.643    -1709863.658 
       beds      -34469.923      4755.860       -0.233     -7.248    0.000      -43803.411      -25136.435 
      baths        5955.975      6091.903        0.033      0.978    0.328       -5999.529       17911.479 
  log(sqft)      301247.514     12725.005        0.903     23.674    0.000      276274.392      326220.635 
-----------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.