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

Error in ols_regress in presence of interaction terms #49

Closed
aravindhebbali opened this issue Jan 15, 2018 · 0 comments

Comments

Projects
1 participant
@aravindhebbali
Copy link
Member

commented Jan 15, 2018

The parameter estimates returned by ols_regress() do not match the output from lm.

Output from lm()

baseR <- lm(support ~ cond3 + female + cond3*female, data = slp_cond3)
summary(baseR)

Call:
lm(formula = support ~ cond3 + female + cond3 * female, data = slp_cond3)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.79202 -0.31472  0.01376  0.32596  1.45410 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)   2.59472    0.04870  53.278  < 2e-16 ***
cond3         1.24186    0.06724  18.470  < 2e-16 ***
female        0.28730    0.07104   4.044 6.31e-05 ***
cond3:female -0.66798    0.10112  -6.606 1.27e-10 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.5014 on 396 degrees of freedom
Multiple R-squared:  0.504, Adjusted R-squared:  0.5003 
F-statistic: 134.1 on 3 and 396 DF,  p-value: < 2.2e-16

Output from ols_regress()

ols_regress(baseR)
                        Model Summary                          
-----------------------------------------------------------
R                       0.710       RMSE                0.501 
R-Squared               0.504       Coef. Var          15.649 
Adj. R-Squared          0.500       MSE                 0.251 
Pred R-Squared          0.493       MAE                 0.389 
--------------------------------------------------------------
 RMSE: Root Mean Square Error 
 MSE: Mean Square Error 
 MAE: Mean Absolute Error 

                                ANOVA                                 
-------------------------------------------------------------------
               Sum of                                                
              Squares         DF    Mean Square       F         Sig. 
---------------------------------------------------------------------
Regression    101.180          3         33.727    134.146    0.0000 
Residual       99.562        396          0.251                      
Total         200.742        399                                     
---------------------------------------------------------------------

                                   Parameter Estimates                                    
-----------------------------------------------------------------------------------------
       model      Beta    Std. Error    Std. Beta      t        Sig      lower     upper 
-----------------------------------------------------------------------------------------
 (Intercept)    -0.013         0.035                 -0.366    0.715    -0.083     0.057 
       cond3     0.668         0.035        0.668    18.843    0.000     0.598     0.738 
      female    -0.033         0.035       -0.033    -0.923    0.356    -0.102     0.037 
cond3:female    -0.234         0.035       -0.234    -6.606    0.000    -0.304    -0.165 
-----------------------------------------------------------------------------------------

@aravindhebbali aravindhebbali added the bug label Jan 15, 2018

@aravindhebbali aravindhebbali added this to the 0.5.0 milestone Jan 15, 2018

@aravindhebbali aravindhebbali self-assigned this Jan 15, 2018

@aravindhebbali aravindhebbali added this to To Do in 0.5.0 via automation Jan 15, 2018

0.5.0 automation moved this from To Do to Done Jan 15, 2018

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.