0
$\begingroup$

I am trying to use "Cursor" , "PostCursor" and "CTLE" to predict "left", and I added interactions and quandratic in the model.

  >left_int3<-lm(Left ~ Cursor + PostCursor + CTLE + I(Cursor^2) + I
               (PostCursor^2), data = QPI)
  >summary(left_int3)

  Coefficients:
                    Estimate Std. Error t value Pr(>|t|)    
  (Intercept)     -412.58163   71.34574  -5.783 8.16e-09 ***
  Cursor            21.46885    2.85689   7.515 7.63e-14 ***
  PostCursor         2.96808    0.38768   7.656 2.62e-14 ***
  CTLE              -0.20459    0.01884 -10.858  < 2e-16 ***
  I(Cursor^2)       -0.22646    0.02837  -7.982 2.09e-15 ***
  I(PostCursor^2)    0.24471    0.04070   6.013 2.06e-09 ***
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  Residual standard error: 2.171 on 2794 degrees of freedom
  Multiple R-squared:  0.4174,  Adjusted R-squared:  0.4164 
  F-statistic: 400.4 on 5 and 2794 DF,  p-value: < 2.2e-16

Then I inspected the 4 assumptions of regression and found that normality, linearity and constant variance are violated so need to transform:

 **HOMOSCEDASTICITY**

 > ncvTest(left_int3)
 Non-constant Variance Score Test 
 Variance formula: ~ fitted.values 
 Chisquare = 3.505792    Df = 1     p = 0.06115458 
 > spreadLevelPlot(left_int3)
 Suggested power transformation:  1.12032

 **Linearity**

 > boxTidwell(Left ~ Cursor + PostCursor + CTLE + I(Cursor^2) + I
             (PostCursor^2), data = QPI)  #

                 Score Statistic   p-value MLE of lambda
 Cursor                 7.162587 0.0000000      7.123073
 PostCursor            -3.534346 0.0004088     16.129858
 CTLE                  -1.921833 0.0546268      3.891245
 I(Cursor^2)           -7.641956 0.0000000      4.145477
 I(PostCursor^2)        4.937534 0.0000008      8.687134

 **Normality**

> summary(powerTransform(QPI$Left))
bcPower Transformation to Normality 

           Est.Power Std.Err. Wald Lower Bound Wald Upper Bound
QPI$Left    3.7107   0.4409           2.8466           4.5749

Likelihood ratio tests about transformation parameters
                         LRT df         pval
LR test, lambda = (0) 72.13642  1 0.000000e+00
LR test, lambda = (1) 38.30386  1 6.054269e-10

**Independence** 

boxTidwell(Left ~ Cursor + PostCursor + CTLE + I(Cursor^2) + 
         I(PostCursor^2), data = QPI)  #
                Score Statistic   p-value MLE of lambda
Cursor                 7.162587 0.0000000      7.123073
PostCursor            -3.534346 0.0004088     16.129858
CTLE                  -1.921833 0.0546268      3.891245
I(Cursor^2)           -7.641956 0.0000000      4.145477
I(PostCursor^2)        4.937534 0.0000008      8.687134

Then I performed the transformations and fit again, but the R^2 is still low, so I am wondering my transformations are correct or not.

 >QPI$Left<-QPI$Left^3.7107  
 >QPI$Cursor<-QPI$Cursor^7.123
 >QPI$PostCursor<-QPI$PostCursor^16.129
 >QPI$CTLE<-QPI$CTLE^3.891245
 >left_int3<-lm(Left ~ Cursor + PostCursor + CTLE + I(Cursor^2) + 
             I(PostCursor^2), data = QPI)
 >summary(left_int3)
 >Coefficients:
                  Estimate Std. Error t value Pr(>|t|)    
 (Intercept)      1.455e+07  6.651e+05  21.880  < 2e-16 ***
 Cursor           2.299e-06  1.302e-06   1.766  0.07754 .  
 PostCursor       1.150e-06  2.147e-06   0.536  0.59231    
 CTLE            -4.772e+00  4.548e-01 -10.493  < 2e-16 ***
 I(Cursor^2)     -2.162e-18  6.854e-19  -3.154  0.00163 ** 
 I(PostCursor^2) -2.775e-19  5.977e-19  -0.464  0.64253    
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 Residual standard error: 1175000 on 2794 degrees of freedom
 Multiple R-squared:  0.3942,    Adjusted R-squared:  0.3932 
 F-statistic: 363.7 on 5 and 2794 DF,  p-value: < 2.2e-16
$\endgroup$
4
  • 3
    $\begingroup$ I believe you may have misinterpreted some of these diagnostics. The very first thing you should do is to make diagnostic plots instead of running these tests. After all, with so much data you likely have the ability to detect complex forms of nonlinearity and heteroscedasticity, but their magnitudes may be unimportant for prediction (and attempts to accommodate them risk creating an over-fitted, and thereby badly-predicting, model). What do these plots show you? $\endgroup$
    – whuber
    Commented Aug 19, 2015 at 12:51
  • $\begingroup$ Thanks, and I also made the diagnostic plot. They also shows the assumptions are violated. Besides, do you mean/suggest I should not use regression to predict it? $\endgroup$
    – Samoth
    Commented Aug 20, 2015 at 1:24
  • $\begingroup$ I also performed some techniques in order to detect unusual observations (outliers, high-leverage points and influential observations), and I think remove them will improve the fit of the model. $\endgroup$
    – Samoth
    Commented Aug 20, 2015 at 3:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.