Math 664 - Methods for Statistical Consulting

HW-02

Student Name: Yao Zhang (31250772)

Question 1: fit the model

## 
## Call:
## lm(formula = logY ~ logX1 + logX2 + logX3, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.3987 -0.1264  0.0138  0.1118  0.2937 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   3.8646     2.2334   1.730    0.097 .  
## logX1         4.9504     0.2557  19.363 9.78e-16 ***
## logX2        -5.6537     0.3858 -14.656 3.72e-13 ***
## logX3        -3.5030     0.3858  -9.081 4.56e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1827 on 23 degrees of freedom
## Multiple R-squared:  0.9669, Adjusted R-squared:  0.9626 
## F-statistic: 224.1 on 3 and 23 DF,  p-value: < 2.2e-16

Question 2: full model with the quadratic and interaction terms

## 
## Call:
## lm(formula = logY ~ logX1 + logX2 + logX3 + logX2_and_logX3 + 
##     logX1_and_logX3 + logX1_and_logX2 + logX1_quadratic + logX2_quadratic + 
##     logX3_quadratic, data = data)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.304034 -0.112395 -0.005587  0.116521  0.266156 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)
## (Intercept)     -239.1097   157.2494  -1.521    0.147
## logX1             29.4930    34.6778   0.850    0.407
## logX2             16.8684    36.9321   0.457    0.654
## logX3             74.6512    52.3750   1.425    0.172
## logX2_and_logX3   -1.6384     4.4973  -0.364    0.720
## logX1_and_logX3   -3.4905     2.9806  -1.171    0.258
## logX1_and_logX2   -2.1849     2.9806  -0.733    0.474
## logX1_quadratic   -0.5695     2.8232  -0.202    0.843
## logX2_quadratic   -0.8791     6.3898  -0.138    0.892
## logX3_quadratic   -7.1965     6.3898  -1.126    0.276
## 
## Residual standard error: 0.1941 on 17 degrees of freedom
## Multiple R-squared:  0.9724, Adjusted R-squared:  0.9578 
## F-statistic: 66.52 on 9 and 17 DF,  p-value: 1.776e-11
Question 3: ANOVA table of the fullModel
Df Sum Sq Mean Sq F value Pr(>F)
logX1 1 12.51 12.51 332.04 0.0000
logX2 1 7.17 7.17 190.23 0.0000
logX3 1 2.75 2.75 73.03 0.0000
logX2_and_logX3 1 0.01 0.01 0.13 0.7201
logX1_and_logX3 1 0.05 0.05 1.37 0.2577
logX1_and_logX2 1 0.02 0.02 0.54 0.4735
logX1_quadratic 1 0.00 0.00 0.04 0.8425
logX2_quadratic 1 0.00 0.00 0.02 0.8922
logX3_quadratic 1 0.05 0.05 1.27 0.2757
Residuals 17 0.64 0.04

Question 4: residual VS. fitted value

Question 5: Box-Cox test for response variable

From the plot above, we can see that the 95% interval of lambda contains 0, and the upper bond and lower bond are very close to 0. So the value of lambda should be approximately 0, which suggests that the natural log transformation should be taken for the respone variable.

Question 6: Box-Tidwell test for x1

##  Score Statistic   p-value MLE of lambda
##       -0.3145565 0.7530984    -0.2304977
## 
## iterations =  2

From the result above, we can see the p-value is 0.75 > 0.05, which suggests no transformation needed.

Question 7: two-way tables

Two-way table of Load and Amplitude of Loading Cycle
low 0 high mean
low 7.32 6.70 6.09 6.70
0 7.02 6.33 5.79 6.38
high 6.58 5.92 5.26 5.92
mean 6.97 6.32 5.71 6.33
Two-way table of Load and Length of Test Specimen
low 0 high mean
low 5.82 6.76 7.53 6.70
0 5.42 6.44 7.28 6.38
high 5.17 5.98 6.61 5.92
mean 5.47 6.39 7.14 6.33
Two-way table of Amplitude of Loading Cycle and Length of Test Specimen
low 0 high mean
low 6.03 6.93 7.96 6.97
0 5.58 6.48 6.89 6.32
high 4.80 5.76 6.57 5.71
mean 5.47 6.39 7.14 6.33