Soruma SECOND ASSEsiment Final L Reg
Soruma SECOND ASSEsiment Final L Reg
Soruma biru
2024-12-29
MATHEMATICS PROGRAM
INDIVIDUAL ASSIGNMENT 2
NAME SORUMA BIRU
ID UGR/27138/14
R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring
HTML, PDF, and MS Word documents. For more details on using R Markdown see
http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as
well as the output of any embedded R code chunks within the document. You can embed an
R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
Including Plots
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing
of the R code that generated the plot.
1. Consider the multiple regression model fit to the house price data in Problem
3.7. Table B.4
getwd()
setwd("C:/Users/pc/Desktop")
ss1=read.table("list.txt",header = T)
ss1
model<-lm(y.0~x1.0+x2.0+x3.0+x4.4+x5.0+x6+x7+x8,data=a1)
model
##
## Call:
## lm(formula = y.0 ~ x1.0 + x2.0 + x3.0 + x4.4 + x5.0 + x6 + x7 +
## x8, data = ss1)
##
## Coefficients:
## (Intercept) x1.0 x2.0 x3.0 x4.4
x5.0
## 12.75192 1.72633 8.08784 0.28738 2.28954
2.20354
## x6 x7 x8
## 0.50740 -2.87189 -0.01681
## 1 2 3 4 5
6
## -0.27374134 0.11442653 -0.08624376 -2.51638675 0.55234922
3.10974403
## 7 8 9 10 11
12
## -0.92430666 -1.67727498 2.04690505 0.39523722 -2.97708304 -
3.00751736
## 13 14 15 16 17
18
## 0.65000570 -3.64780762 2.19325103 0.64046142 3.92623087
3.69506800
## 19 20 21 22 23
24
## -1.57273553 1.28559853 0.90678561 -3.28698786 -3.02741272
3.48143442
Interpretation:
If the points closely follow the straight line in the normal probability plot, the residuals are
normally distributed. Deviations from this line indicate potential problems with the
normality assumption.
b. Construct and interpret a plot of the residuals versus the predicted response.
# Predicted values
predicted_values <- model$fitted.values
Interpretation:
Look for patterns in the residuals. Ideally, they should be randomly scattered around zero.
Patterns may indicate issues such as non-linearity or heteroscedasticity.
c. Compute the studentized residuals and the R- student residuals for this
model. What information is conveyed by these scaled residuals?
# Studentized residuals
studentized_residuals <- rstudent(model)
# R-student residuals
r_student_residuals <- rstandard(model)
## 1 2 3 4 5
6
## -0.16224730 0.05074042 -0.03286445 -0.93167989 0.19252763
1.25152089
## 7 8 9 10 11
12
## -0.39110623 -1.08482266 0.80046393 0.16313167 -1.31188138 -
1.25664178
## 13 14 15 16 17
18
## 0.28369699 -1.61926213 1.34365573 0.28495989 2.01687665
1.49843225
## 19 20 21 22 23
24
## -0.70086726 0.54261010 0.37305437 -1.37023734 -1.56356418
1.46736781
print(r_student_residuals)
## 1 2 3 4 5
6
## -0.16778424 0.05251650 -0.03401662 -0.93580567 0.19902173
1.22854473
## 7 8 9 10 11
12
## -0.40263977 -1.07848398 0.81022539 0.16869706 -1.28144409 -
1.23306299
## 13 14 15 16 17
18
## 0.29281382 -1.53822909 1.30897317 0.29410980 1.83769076
1.43985542
## 19 20 21 22 23
24
## -0.71306481 0.55584045 0.38424287 -1.33183271 -1.49330297
1.41402067
Information Conveyed:
Studentized Residuals: These are the residuals divided by an estimate of their standard
deviation. They help identify outliers; values greater than 2 or less than -2 may indicate
potential outliers. R-Student Residuals: Similar to studentized residuals but take into
account the leverage of each observation. They are useful for diagnosing the influence of
individual data points on the regression model.
## [1] "C:/Users/pc/Desktop"
setwd("C:/Users/pc/Desktop")
ss2=read.table("list11.txt",header = T)
ss2
## x1.0 x2 y.0
## 1 0.9189 −10 3.1280
## 2 0.9189 0 2.4270
## 3 0.9189 10 1.9400
## 4 0.9189 20 1.5860
## 5 0.9189 30 1.3250
## 6 0.9189 40 1.1260
## 7 0.9189 50 0.9694
## 8 0.9189 60 0.8473
## 9 0.9189 70 0.7481
## 10 0.9189 80 0.6671
## 11 0.7547 −10 2.2700
## 12 0.7547 0 1.8190
## 13 0.7547 10 1.4890
## 14 0.7547 20 1.2460
## 15 0.7547 30 1.0620
## 16 0.7547 40 0.9160
## 17 0.7547 50 0.8005
## 18 0.7547 60 0.7091
## 19 0.7547 70 0.6345
## 20 0.7547 80 0.5715
## 21 0.5685 −10 1.5930
## 22 0.5685 0 1.3240
## 23 0.5685 10 1.1180
## 24 0.5685 20 0.9576
## 25 0.5685 30 0.8302
## 26 0.5685 40 0.7282
## 27 0.5685 50 0.6470
## 28 0.5685 60 0.5784
## 29 0.5685 70 0.5219
## 30 0.5685 80 0.4735
## 31 0.3610 −10 1.1610
## 32 0.3610 0 0.9925
## 33 0.3610 10 0.8601
## 34 0.3610 20 0.7523
## 35 0.3610 30 0.6663
## 36 0.3610 40 0.5940
## 37 0.3610 50 0.5338
## 38 0.3610 60 0.4804
## 39 0.3610 70 0.4361
## 40 0.3610 80 0.4016
model<-lm(y.0 ~ x1.0+x2,data=ss2)
model
##
## Call:
## lm(formula = y.0 ~ x1.0 + x2, data = ss2)
##
## Coefficients:
## (Intercept) x1.0 x20 x210 x220
x230
## 1.1221 1.4073 -0.3974 -0.6862 -0.9025
-1.0671
## x240 x250 x260 x270 x280
## -1.1969 -1.3003 -1.3842 -1.4528 -1.5096
qqnorm(model$residuals)
qqline(model$residuals, col = "red")
#b. Identify the
most appropriate transformation for these data. Fit this model and repeat the residual
analysis.
# Fit the linear model
model <- lm(y.0 ~ x1.0 + x2, data = ss2)
#c. Perform a
thorough influence analysis of kinematic viscosity data
# Influence analysis
influence_measures <- influence.measures(model_transformed)
# Cook's Distance
cooks_distance <- cooks.distance(model_transformed)
## integer(0)
## [1] "C:/Users/pc/Desktop"
setwd("C:/Users/pc/Desktop")
ss3=read.table("list22.txt",header = T)
ss3
## automobile y x1 x2 x3 x4 x5 x6 x7 x8 x9
x10 X11
## 1 Apollo 18.90 350.0 165 260 8.0:1 2.56:1 4 3 200.3 69.9
3910 A
## 2 Omega 17.00 350.0 170 275 8.5:1 2.56:1 4 3 199.6 72.9
2860 A
## 3 Nova 20.00 250.0 105 185 8.25:1 2.73:1 1 3 196.7 72.2
3510 A
## 4 Monarch 18.25 351.0 143 255 8.0:1 3.00:1 2 3 199.9 74.0
3890 A
## 5 Duster 20.07 225.0 95 170 8.4:1 2.76:1 1 3 194.1 71.8
3365 M
## 6 Jenson 11.20 440.0 215 330 8.2:1 2.88:1 4 3 184.5 69.0
4215 A
## 7 Skyhawk 22.12 231.0 110 175 8.0:1 2.56:1 2 3 179.3 65.4
3020 A
## 8 Monza 21.47 262.0 110 200 8.5:1 2.56:1 2 3 179.3 65.4
3180 A
## 9 Scirocco 34.70 89.7 70 81 8.2:1 3.90:1 2 4 155.7 64.0
1905 M
## 10 Corolla 30.40 96.9 75 83 9.0:1 4.30:1 2 5 165.2 65.0
2320 M
## 11 Camaro 16.50 350.0 155 250 8.5:1 3.08:1 4 3 195.4 74.4
3885 A
## 12 Datsun 36.50 85.3 80 83 8.5:1 3.89:1 2 4 160.6 62.2
2009 M
## 13 CapriII 21.50 171.0 109 146 8.2:1 3.22:1 2 4 170.4 66.9
2655 A
## 14 Pacer 19.70 258.0 110 195 8.0:1 3.08:1 1 3 171.5 77.0
3375 A
## 15 Babcat 20.30 140.0 83 109 8.4:1 3.40:1 2 4 168.8 69.4
2700 A
## 16 Granada 17.80 302.0 129 220 8.0:1 3.0:1 2 3 199.9 74.0
3890 A
## 17 Eldorado 14.39 500.0 190 360 8.5:1 2.73:1 4 3 224.1 79.8
5290 A
## 18 Imperial 14.89 440.0 215 330 8.2:1 2.71:1 4 3 231.0 79.7
5185 A
## 19 NovaLN 17.80 350.0 155 250 8.5:1 3.08:1 4 3 196.7 72.2
3910 A
## 20 Valiant 16.41 318.0 145 255 8.5:1 2.45:1 2 3 197.6 71.0
3660 A
## 21 Starfire 23.54 231.0 110 175 8.0:1 2.56:1 2 3 179.3 65.4
3050 A
## 22 Cordoba 21.47 360.0 180 290 8.4:1 2.45:1 2 3 214.2 76.3
4250 M
## 23 TransAM 16.59 400.0 185 NA 7.6:1 3.08:1 4 3 196.0 73.0
3850 M
## 24 CorollaE-5 31.90 96.9 75 83 9.0:1 4.30:1 2 5 165.2 61.8
2275 A
## 25 Astre 29.40 140.0 86 NA 8.0:1 2.92:1 2 4 176.4 65.4
2150 M
## 26 MarkIV 13.27 460.0 223 366 8.0:1 3.00:1 4 3 228.0 79.8
5430 A
## 27 CelicaGT 23.90 133.6 96 120 8.4:1 3.91:1 2 5 171.5 63.4
2535 M
## 28 ChargerSE 19.73 318.0 140 255 8.5:1 2.71:1 2 3 215.3 76.3
4370 A
## 29 Cougar 13.90 351.0 148 243 8.0:1 3.25:1 2 3 215.5 78.5
4540 A
## 30 Elite 13.27 351.0 148 243 8.0:1 3.26:1 2 3 216.1 78.5
4715 A
## 31 Matador 13.77 360.0 195 295 8.25:1 3.15:1 4 3 209.3 77.4
4215 A
## 32 Corvette 16.50 350.0 165 255 8.5:1 2.73:1 4 3 185.2 69.0
3660 A
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 +
## x10, data = ss3)
##
## Coefficients:
## (Intercept) x1 x2 x3 x48.2:1
x48.25:1
## -63.790705 0.664218 1.638892 -1.468730 -34.207290
-5.167937
## x48.4:1 x48.5:1 x49.0:1 x52.56:1 x52.71:1
x52.73:1
## -18.648206 14.631714 48.517340 23.718432 6.487848
4.808748
## x52.76:1 x52.88:1 x53.0:1 x53.00:1 x53.08:1
x53.15:1
## 30.270571 16.422128 1.668195 -1.971709 12.093417
18.939563
## x53.22:1 x53.25:1 x53.26:1 x53.40:1 x53.89:1
x53.90:1
## 59.869685 -36.668134 -37.713042 53.601808 40.244262
100.525490
## x53.91:1 x54.30:1 x6 x7 x8
x9
## 52.870647 NA -27.513626 NA 0.370292
-0.435754
## x10
## 0.001101
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 +
## x10, data = ss3)
##
## Residuals:
## 1 2 3 4 5 6
7
## -1.306e-02 1.459e-02 2.515e-17 4.313e-03 -1.284e-16 8.674e-17 -
6.860e-01
## 8 9 10 11 12 13
14
## -1.644e-02 3.209e-17 -7.757e-02 8.471e-02 5.117e-17 -1.115e-16 -
1.857e-03
## 15 16 17 18 19 20
21
## -1.592e-16 -4.770e-18 4.182e-03 -1.214e-17 -8.286e-02 -3.227e-16
7.009e-01
## 22 24 26 27 28 29
30
## 1.422e-16 7.757e-02 -4.313e-03 2.776e-17 3.383e-17 1.778e-17
1.288e-16
## 31 32
## 1.995e-17 -4.182e-03
##
## Coefficients: (2 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -63.790705 360.855065 -0.177 0.889
## x1 0.664218 2.305698 0.288 0.821
## x2 1.638892 5.806356 0.282 0.825
## x3 -1.468730 5.163986 -0.284 0.824
## x48.2:1 -34.207290 112.511371 -0.304 0.812
## x48.25:1 -5.167937 10.574666 -0.489 0.711
## x48.4:1 -18.648206 83.885312 -0.222 0.861
## x48.5:1 14.631714 56.607895 0.258 0.839
## x49.0:1 48.517340 127.173356 0.382 0.768
## x52.56:1 23.718432 70.340578 0.337 0.793
## x52.71:1 6.487848 6.961025 0.932 0.522
## x52.73:1 4.808748 5.608308 0.857 0.549
## x52.76:1 30.270571 120.744832 0.251 0.844
## x52.88:1 16.422128 59.656985 0.275 0.829
## x53.0:1 1.668195 3.044162 0.548 0.681
## x53.00:1 -1.971709 12.339434 -0.160 0.899
## x53.08:1 12.093417 24.169901 0.500 0.705
## x53.15:1 18.939563 51.589316 0.367 0.776
## x53.22:1 59.869685 188.532159 0.318 0.804
## x53.25:1 -36.668134 123.779302 -0.296 0.817
## x53.26:1 -37.713042 125.680963 -0.300 0.814
## x53.40:1 53.601808 192.213381 0.279 0.827
## x53.89:1 40.244262 75.142526 0.536 0.687
## x53.90:1 100.525490 286.973736 0.350 0.785
## x53.91:1 52.870647 187.628152 0.282 0.825
## x54.30:1 NA NA NA NA
## x6 -27.513626 91.060848 -0.302 0.813
## x7 NA NA NA NA
## x8 0.370292 0.974750 0.380 0.769
## x9 -0.435754 0.373566 -1.166 0.451
## x10 0.001101 0.007734 0.142 0.910
##
## Residual standard error: 0.9944 on 1 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.9991, Adjusted R-squared: 0.9748
## F-statistic: 41.11 on 28 and 1 DF, p-value: 0.1228
print(cor_matrix)
x1 x6
## x1 1.0000000 -0.6308887
## x6 -0.6308887 1.0000000
e. Calculate the variance inflation factors and the condition number of
X’X. Is there any evidence of multicollinearity?
# Calculate VIF= values
aa=values <- (model)
aa
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 +
## x10, data = ss3)
##
## Coefficients:
## (Intercept) x1 x2 x3 x48.2:1
x48.25:1
## -63.790705 0.664218 1.638892 -1.468730 -34.207290
-5.167937
## x48.4:1 x48.5:1 x49.0:1 x52.56:1 x52.71:1
x52.73:1
## -18.648206 14.631714 48.517340 23.718432 6.487848
4.808748
## x52.76:1 x52.88:1 x53.0:1 x53.00:1 x53.08:1
x53.15:1
## 30.270571 16.422128 1.668195 -1.971709 12.093417
18.939563
## x53.22:1 x53.25:1 x53.26:1 x53.40:1 x53.89:1
x53.90:1
## 59.869685 -36.668134 -37.713042 53.601808 40.244262
100.525490
## x53.91:1 x54.30:1 x6 x7 x8
x9
## 52.870647 NA -27.513626 NA 0.370292
-0.435754
## x10
## 0.001101
print(values)
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 +
## x10, data = ss3)
##
## Coefficients:
## (Intercept) x1 x2 x3 x48.2:1
x48.25:1
## -63.790705 0.664218 1.638892 -1.468730 -34.207290
-5.167937
## x48.4:1 x48.5:1 x49.0:1 x52.56:1 x52.71:1
x52.73:1
## -18.648206 14.631714 48.517340 23.718432 6.487848
4.808748
## x52.76:1 x52.88:1 x53.0:1 x53.00:1 x53.08:1
x53.15:1
## 30.270571 16.422128 1.668195 -1.971709 12.093417
18.939563
## x53.22:1 x53.25:1 x53.26:1 x53.40:1 x53.89:1
x53.90:1
## 59.869685 -36.668134 -37.713042 53.601808 40.244262
100.525490
## x53.91:1 x54.30:1 x6 x7 x8
x9
## 52.870647 NA -27.513626 NA 0.370292
-0.435754
## x10
## 0.001101
## [1] 1.312564e+17
Coefficients:
(Intercept) x1 x2 x3 x48.2:1 x48.25:1
x48.4:1 x48.5:1
-63.790705 0.664218 1.638892 -1.468730 -34.207290 -5.167937
-18.648206 14.631714
x49.0:1 x52.56:1 x52.71:1 x52.73:1 x52.76:1 x52.88:1
x53.0:1 x53.00:1
48.517340 23.718432 6.487848 4.808748 30.270571 16.422128
1.668195 -1.971709
x53.08:1 x53.15:1 x53.22:1 x53.25:1 x53.26:1 x53.40:1
x53.89:1 x53.90:1
12.093417 18.939563 59.869685 -36.668134 -37.713042 53.601808
40.244262 100.525490
x53.91:1 x54.30:1 x6 x7 x8 x9
x10
52.870647 NA -27.513626 NA 0.370292 -0.435754
0.001101
## Start: AIC=-44.38
## y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10
forward_model
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 +
## x10, data = ss3)
##
## Coefficients:
## (Intercept) x1 x2 x3 x48.2:1
x48.25:1
## -63.790705 0.664218 1.638892 -1.468730 -34.207290
-5.167937
## x48.4:1 x48.5:1 x49.0:1 x52.56:1 x52.71:1
x52.73:1
## -18.648206 14.631714 48.517340 23.718432 6.487848
4.808748
## x52.76:1 x52.88:1 x53.0:1 x53.00:1 x53.08:1
x53.15:1
## 30.270571 16.422128 1.668195 -1.971709 12.093417
18.939563
## x53.22:1 x53.25:1 x53.26:1 x53.40:1 x53.89:1
x53.90:1
## 59.869685 -36.668134 -37.713042 53.601808 40.244262
100.525490
## x53.91:1 x54.30:1 x6 x7 x8
x9
## 52.870647 NA -27.513626 NA 0.370292
-0.435754
## x10
## 0.001101
## Start: AIC=-44.38
## y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10
##
##
## Step: AIC=-44.38
## y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9 + x10
##
## Df Sum of Sq RSS AIC
## - x10 1 0.020 1.009 -45.773
## <none> 0.989 -44.375
## - x2 1 0.079 1.068 -44.076
## - x3 1 0.080 1.069 -44.042
## - x1 1 0.082 1.071 -43.984
## - x6 1 0.090 1.079 -43.755
## - x8 1 0.143 1.131 -42.331
## - x9 1 1.345 2.334 -20.607
## - x4 4 17.417 18.405 35.343
## - x5 16 191.700 192.689 81.796
##
## Step: AIC=-45.77
## y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9
##
## Df Sum of Sq RSS AIC
## <none> 1.009 -45.773
## - x2 1 0.394 1.402 -37.890
## - x1 1 0.424 1.433 -37.245
## - x3 1 0.428 1.437 -37.154
## - x6 1 0.477 1.486 -36.161
## - x8 1 0.633 1.642 -33.165
## - x9 1 1.973 2.981 -15.264
## - x4 4 17.430 18.439 33.398
## - x5 16 191.728 192.737 79.804
backward_model
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9, data = ss3)
##
## Coefficients:
## (Intercept) x1 x2 x3 x48.2:1
x48.25:1
## -13.6102 0.3445 0.8338 -0.7516 -18.6315
-3.8767
## x48.4:1 x48.5:1 x49.0:1 x52.56:1 x52.71:1
x52.73:1
## -7.0422 6.7521 30.9711 13.9751 5.7203
4.2440
## x52.76:1 x52.88:1 x53.0:1 x53.00:1 x53.08:1
x53.15:1
## 13.5916 8.1643 1.5267 -0.2742 8.8740
11.8851
## x53.22:1 x53.25:1 x53.26:1 x53.40:1 x53.89:1
x53.90:1
## 33.8001 -19.4491 -20.2220 27.0961 29.9384
60.8380
## x53.91:1 x54.30:1 x6 x8 x9
## 26.9175 NA -14.9124 0.2381 -0.4615
## Start: AIC=-44.38
## y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10
##
##
## Step: AIC=-44.38
## y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9 + x10
##
## Df Sum of Sq RSS AIC
## - x10 1 0.020 1.009 -45.773
## <none> 0.989 -44.375
## - x2 1 0.079 1.068 -44.076
## - x3 1 0.080 1.069 -44.042
## - x1 1 0.082 1.071 -43.984
## - x6 1 0.090 1.079 -43.755
## - x8 1 0.143 1.131 -42.331
## - x9 1 1.345 2.334 -20.607
## - x4 4 17.417 18.405 35.343
## - x5 16 191.700 192.689 81.796
##
## Step: AIC=-45.77
## y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9
##
## Df Sum of Sq RSS AIC
## <none> 1.009 -45.773
## + x10 1 0.020 0.989 -44.375
## - x2 1 0.394 1.402 -37.890
## - x1 1 0.424 1.433 -37.245
## - x3 1 0.428 1.437 -37.154
## - x6 1 0.477 1.486 -36.161
## - x8 1 0.633 1.642 -33.165
## - x9 1 1.973 2.981 -15.264
## - x4 4 17.430 18.439 33.398
## - x5 16 191.728 192.737 79.804
stepwise_model
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9, data = ss3)
##
## Coefficients:
## (Intercept) x1 x2 x3 x48.2:1
x48.25:1
## -13.6102 0.3445 0.8338 -0.7516 -18.6315
-3.8767
## x48.4:1 x48.5:1 x49.0:1 x52.56:1 x52.71:1
x52.73:1
## -7.0422 6.7521 30.9711 13.9751 5.7203
4.2440
## x52.76:1 x52.88:1 x53.0:1 x53.00:1 x53.08:1
x53.15:1
## 13.5916 8.1643 1.5267 -0.2742 8.8740
11.8851
## x53.22:1 x53.25:1 x53.26:1 x53.40:1 x53.89:1
x53.90:1
## 33.8001 -19.4491 -20.2220 27.0961 29.9384
60.8380
## x53.91:1 x54.30:1 x6 x8 x9
## 26.9175 NA -14.9124 0.2381 -0.4615
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 +
## x10, data = ss3)
##
## Residuals:
## 1 2 3 4 5 6
7
## -1.306e-02 1.459e-02 2.515e-17 4.313e-03 -1.284e-16 8.674e-17 -
6.860e-01
## 8 9 10 11 12 13
14
## -1.644e-02 3.209e-17 -7.757e-02 8.471e-02 5.117e-17 -1.115e-16 -
1.857e-03
## 15 16 17 18 19 20
21
## -1.592e-16 -4.770e-18 4.182e-03 -1.214e-17 -8.286e-02 -3.227e-16
7.009e-01
## 22 24 26 27 28 29
30
## 1.422e-16 7.757e-02 -4.313e-03 2.776e-17 3.383e-17 1.778e-17
1.288e-16
## 31 32
## 1.995e-17 -4.182e-03
##
## Coefficients: (2 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -63.790705 360.855065 -0.177 0.889
## x1 0.664218 2.305698 0.288 0.821
## x2 1.638892 5.806356 0.282 0.825
## x3 -1.468730 5.163986 -0.284 0.824
## x48.2:1 -34.207290 112.511371 -0.304 0.812
## x48.25:1 -5.167937 10.574666 -0.489 0.711
## x48.4:1 -18.648206 83.885312 -0.222 0.861
## x48.5:1 14.631714 56.607895 0.258 0.839
## x49.0:1 48.517340 127.173356 0.382 0.768
## x52.56:1 23.718432 70.340578 0.337 0.793
## x52.71:1 6.487848 6.961025 0.932 0.522
## x52.73:1 4.808748 5.608308 0.857 0.549
## x52.76:1 30.270571 120.744832 0.251 0.844
## x52.88:1 16.422128 59.656985 0.275 0.829
## x53.0:1 1.668195 3.044162 0.548 0.681
## x53.00:1 -1.971709 12.339434 -0.160 0.899
## x53.08:1 12.093417 24.169901 0.500 0.705
## x53.15:1 18.939563 51.589316 0.367 0.776
## x53.22:1 59.869685 188.532159 0.318 0.804
## x53.25:1 -36.668134 123.779302 -0.296 0.817
## x53.26:1 -37.713042 125.680963 -0.300 0.814
## x53.40:1 53.601808 192.213381 0.279 0.827
## x53.89:1 40.244262 75.142526 0.536 0.687
## x53.90:1 100.525490 286.973736 0.350 0.785
## x53.91:1 52.870647 187.628152 0.282 0.825
## x54.30:1 NA NA NA NA
## x6 -27.513626 91.060848 -0.302 0.813
## x7 NA NA NA NA
## x8 0.370292 0.974750 0.380 0.769
## x9 -0.435754 0.373566 -1.166 0.451
## x10 0.001101 0.007734 0.142 0.910
##
## Residual standard error: 0.9944 on 1 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.9991, Adjusted R-squared: 0.9748
## F-statistic: 41.11 on 28 and 1 DF, p-value: 0.1228
summary(backward_model)
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9, data = ss3)
##
## Residuals:
## 1 2 3 4 5 6
7
## -1.943e-03 2.170e-03 -5.150e-18 6.418e-04 1.166e-17 2.055e-17 -
7.089e-01
## 8 9 10 11 12 13
14
## -2.447e-03 2.662e-17 -1.154e-02 1.260e-02 1.124e-16 -8.544e-17 -
2.763e-04
## 15 16 17 18 19 20
21
## -6.619e-17 -5.790e-17 6.222e-04 3.117e-17 -1.233e-02 -3.268e-16
7.111e-01
## 22 24 26 27 28 29
30
## 3.527e-16 1.154e-02 -6.418e-04 -8.625e-17 4.705e-17 3.909e-17
1.133e-17
## 31 32
## -2.206e-17 -6.222e-04
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -13.6102 55.4855 -0.245 0.829
## x1 0.3445 0.3758 0.917 0.456
## x2 0.8338 0.9438 0.883 0.470
## x3 -0.7516 0.8155 -0.922 0.454
## x48.2:1 -18.6315 18.8232 -0.990 0.427
## x48.25:1 -3.8767 3.8862 -0.998 0.424
## x48.4:1 -7.0422 14.1756 -0.497 0.669
## x48.5:1 6.7521 8.5258 0.792 0.511
## x49.0:1 30.9711 22.4744 1.378 0.302
## x52.56:1 13.9751 11.6512 1.199 0.353
## x52.71:1 5.7203 3.1461 1.818 0.211
## x52.73:1 4.2440 2.8321 1.499 0.273
## x52.76:1 13.5916 20.9489 0.649 0.583
## x52.88:1 8.1643 10.0007 0.816 0.500
## x53.0:1 1.5267 2.0552 0.743 0.535
## x53.00:1 -0.2742 2.2770 -0.120 0.915
## x53.08:1 8.8740 6.1047 1.454 0.283
## x53.15:1 11.8851 10.2827 1.156 0.367
## x53.22:1 33.8001 32.1667 1.051 0.404
## x53.25:1 -19.4491 18.8903 -1.030 0.411
## x53.26:1 -20.2220 19.0078 -1.064 0.399
## x53.40:1 27.0961 34.2471 0.791 0.512
## x53.89:1 29.9384 14.4369 2.074 0.174
## x53.90:1 60.8380 48.8455 1.246 0.339
## x53.91:1 26.9175 31.8371 0.845 0.487
## x54.30:1 NA NA NA NA
## x6 -14.9124 15.3377 -0.972 0.433
## x8 0.2381 0.2126 1.120 0.379
## x9 -0.4615 0.2334 -1.978 0.187
##
## Residual standard error: 0.7102 on 2 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.9991, Adjusted R-squared: 0.9872
## F-statistic: 83.57 on 27 and 2 DF, p-value: 0.01189
summary(stepwise_model)
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9, data = ss3)
##
## Residuals:
## 1 2 3 4 5 6
7
## -1.943e-03 2.170e-03 -5.150e-18 6.418e-04 1.166e-17 2.055e-17 -
7.089e-01
## 8 9 10 11 12 13
14
## -2.447e-03 2.662e-17 -1.154e-02 1.260e-02 1.124e-16 -8.544e-17 -
2.763e-04
## 15 16 17 18 19 20
21
## -6.619e-17 -5.790e-17 6.222e-04 3.117e-17 -1.233e-02 -3.268e-16
7.111e-01
## 22 24 26 27 28 29
30
## 3.527e-16 1.154e-02 -6.418e-04 -8.625e-17 4.705e-17 3.909e-17
1.133e-17
## 31 32
## -2.206e-17 -6.222e-04
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -13.6102 55.4855 -0.245 0.829
## x1 0.3445 0.3758 0.917 0.456
## x2 0.8338 0.9438 0.883 0.470
## x3 -0.7516 0.8155 -0.922 0.454
## x48.2:1 -18.6315 18.8232 -0.990 0.427
## x48.25:1 -3.8767 3.8862 -0.998 0.424
## x48.4:1 -7.0422 14.1756 -0.497 0.669
## x48.5:1 6.7521 8.5258 0.792 0.511
## x49.0:1 30.9711 22.4744 1.378 0.302
## x52.56:1 13.9751 11.6512 1.199 0.353
## x52.71:1 5.7203 3.1461 1.818 0.211
## x52.73:1 4.2440 2.8321 1.499 0.273
## x52.76:1 13.5916 20.9489 0.649 0.583
## x52.88:1 8.1643 10.0007 0.816 0.500
## x53.0:1 1.5267 2.0552 0.743 0.535
## x53.00:1 -0.2742 2.2770 -0.120 0.915
## x53.08:1 8.8740 6.1047 1.454 0.283
## x53.15:1 11.8851 10.2827 1.156 0.367
## x53.22:1 33.8001 32.1667 1.051 0.404
## x53.25:1 -19.4491 18.8903 -1.030 0.411
## x53.26:1 -20.2220 19.0078 -1.064 0.399
## x53.40:1 27.0961 34.2471 0.791 0.512
## x53.89:1 29.9384 14.4369 2.074 0.174
## x53.90:1 60.8380 48.8455 1.246 0.339
## x53.91:1 26.9175 31.8371 0.845 0.487
## x54.30:1 NA NA NA NA
## x6 -14.9124 15.3377 -0.972 0.433
## x8 0.2381 0.2126 1.120 0.379
## x9 -0.4615 0.2334 -1.978 0.187
##
## Residual standard error: 0.7102 on 2 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.9991, Adjusted R-squared: 0.9872
## F-statistic: 83.57 on 27 and 2 DF, p-value: 0.01189
## Influence measures of
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 +
x10, data = ss3) :
##
## dfb.1_ dfb.x1 dfb.x2 dfb.x3 dfb.x48.2. dfb.x48.25 dfb.x48.4
dfb.x48.5
## 1 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 2 -1.407 0.714 0.881 -0.724 -0.763 -2.64 -0.967
0.869
## 3 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 4 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 5 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 6 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 7 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 8 -0.053 -1.146 -0.971 0.958 0.752 -8.81 0.321 -
1.681
## 9 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 10 5.154 -4.788 -4.801 4.869 4.728 4.72 4.764 -
4.941
## 11 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 12 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 13 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 14 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 15 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 16 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 17 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 18 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 19 6.730 -6.840 -6.850 6.822 6.852 6.52 6.862 -
6.804
## 20 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 21 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 22 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 24 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 26 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 27 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 28 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 29 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 30 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 31 0.000 0.000 0.000 0.000 0.000 0.00 0.000
0.000
## 32 1.624 -4.703 -5.047 4.754 5.358 1.58 4.028 -
4.785
## dfb.x49. dfb.x52.5 dfb.x52.71 dfb.x52.73 dfb.x52.76 dfb.x52.8
dfb.x53.0.
## 1 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 2 1.11 1.24 2.26 7.49 1.08 1.353
9.84
## 3 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 4 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 5 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 6 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 7 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 8 -1.65 -1.58 -5.46 5.52 -1.14 0.452
-16.74
## 9 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 10 -4.63 -4.76 -1.26 -2.18 -4.63 -5.027
2.85
## 11 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 12 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 13 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 14 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 15 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 16 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 17 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 18 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 19 -6.92 -6.87 -6.64 -6.87 -6.90 -6.841
-5.32
## 20 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 21 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 22 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 24 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 26 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 27 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 28 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 29 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 30 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 31 0.00 0.00 0.00 0.00 0.00 0.000
0.00
## 32 -3.80 -3.70 -22.46 -14.46 -4.96 -1.532
-16.58
## dfb.x53.00 dfb.x53.08 dfb.x53.1 dfb.x53.22 dfb.x53.25 dfb.x53.26
dfb.x53.4
## 1 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 2 0.693 2.422 1.270 0.901 -0.56 -0.498
1.12
## 3 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 4 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 5 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 6 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 7 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 8 -1.276 -0.684 -0.129 -1.143 0.52 0.566
-1.04
## 9 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 10 4.844 -3.762 -4.620 -4.671 4.98 4.992
-4.59
## 11 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 12 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 13 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 14 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 15 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 16 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 17 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 18 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 19 6.509 -7.545 -7.035 -6.892 6.77 6.763
-6.94
## 20 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 21 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 22 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 24 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 26 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 27 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 28 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 29 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 30 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 31 0.000 0.000 0.000 0.000 0.00 0.000
0.00
## 32 2.581 -1.275 -3.100 -4.404 3.76 3.758
-3.91
## dfb.x53.8 dfb.x53.90 dfb.x53.91 dfb.x6 dfb.x8 dfb.x9 dfb.x10
dffit cov.r
## 1 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 2 1.11 0.905 1.01 -0.924 2.26 1.87 -5.98
68.2 4647
## 3 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 4 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 5 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 6 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 7 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 8 -1.58 -1.146 -1.10 1.071 2.26 1.87 -5.98 -
60.5 3657
## 9 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 10 -4.38 -4.676 -4.70 4.723 -4.66 -8.79 -5.98 -
12.8 164
## 11 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 12 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 13 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 14 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 15 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 16 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 17 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 18 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 19 -6.97 -6.892 -6.88 6.882 -7.16 1.87 -5.98 -
12.0 144
## 20 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 21 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 22 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 24 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 26 0.00 0.000 0.00 0.000 0.00 0.00 0.00
0.0 NaN
## 27 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 28 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 29 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 30 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 31 0.00 0.000 0.00 0.000 0.00 0.00 0.00
NaN NaN
## 32 -2.58 -4.388 -3.83 4.428 2.26 1.87 -5.98 -
237.8 56547
## cook.d hat inf
## 1 2.00e+02 1.000 *
## 2 1.60e+02 1.000 *
## 3 NaN 1.000
## 4 1.83e+03 1.000 *
## 5 NaN 1.000
## 6 NaN 1.000
## 7 3.80e-02 0.524
## 8 1.26e+02 1.000 *
## 9 NaN 1.000
## 10 5.63e+00 0.994 *
## 11 4.72e+00 0.993 *
## 12 NaN 1.000
## 13 NaN 1.000
## 14 9.89e+03 1.000 *
## 15 NaN 1.000
## 16 NaN 1.000
## 17 1.95e+03 1.000 *
## 18 NaN 1.000
## 19 4.93e+00 0.993 *
## 20 NaN 1.000
## 21 3.49e-02 0.503
## 22 NaN 1.000
## 24 5.63e+00 0.994 *
## 26 1.83e+03 1.000 *
## 27 NaN 1.000
## 28 NaN 1.000
## 29 NaN 1.000
## 30 NaN 1.000
## 31 NaN 1.000
## 32 1.95e+03 1.000 *
summary(influence_measures)