In: Statistics and Probability
Total Labor Hours = Beta0 + Beta1 Number of Cases Shipped + Beta2 Indirect Costs of Total Labor Hours + Beta3 Holiday + E where E is assumed normal with mean 0 and constant variance. Assume that the regression model here is appropriate. A new shipment is to be received with x1=250,000; x2=6.70; x3=0. Obtain a 95% confidence interval for the mean response for this shipment. Interpret this interval.
y | x1 | x2 | x3 |
4325 | 301995 | 6.88 | 0 |
4110 | 269334 | 7.23 | 0 |
4111 | 267631 | 6.27 | 0 |
4161 | 296350 | 6.49 | 0 |
4560 | 277223 | 6.37 | 0 |
4401 | 269189 | 7.05 | 0 |
4251 | 277133 | 6.34 | 0 |
4222 | 282892 | 6.94 | 0 |
4063 | 306639 | 8.56 | 0 |
4343 | 328405 | 6.71 | 0 |
4833 | 321773 | 5.82 | 1 |
4453 | 272319 | 6.82 | 0 |
4195 | 293880 | 8.38 | 0 |
4394 | 300867 | 7.72 | 0 |
4099 | 296872 | 7.67 | 0 |
4816 | 245674 | 7.72 | 1 |
4867 | 211944 | 6.45 | 1 |
4114 | 227996 | 7.22 | 0 |
4314 | 248328 | 8.5 | 0 |
4289 | 249894 | 8.08 | 0 |
4269 | 302660 | 7.26 | 0 |
4347 | 273848 | 7.39 | 0 |
4178 | 245743 | 8.12 | 0 |
4333 | 267673 | 6.75 | 0 |
4226 | 256506 | 7.79 | 0 |
4121 | 271854 | 7.89 | 0 |
3998 | 293225 | 9.01 | 0 |
4475 | 269121 | 8.01 | 0 |
4545 | 322812 | 7.21 | 0 |
4016 | 252225 | 7.85 | 0 |
4207 | 261365 | 6.14 | 0 |
4148 | 287645 | 6.76 | 0 |
4562 | 289666 | 7.92 | 0 |
4146 | 270051 | 8.19 | 0 |
4555 | 265239 | 7.55 | 0 |
4365 | 352466 | 6.94 | 0 |
4471 | 426908 | 7.25 | 0 |
5045 | 369989 | 9.65 | 1 |
4469 | 472476 | 8.2 | 0 |
4408 | 414102 | 8.02 | 0 |
4219 | 302507 | 6.72 | 0 |
4211 | 382686 | 7.23 | 0 |
4993 | 442782 | 7.61 | 1 |
4309 | 322303 | 7.39 | 0 |
4499 | 290455 | 7.99 | 0 |
4186 | 411750 | 7.83 | 0 |
4342 | 292087 | 7.77 | 0 |
I have coplete this problem by using R software as well as Manually
first i will give the r codes
data=read.csv(file.choose())
> data
y x1 x2 x3
1 4325 301995 6.88 0
2 4110 269334 7.23 0
3 4111 267631 6.27 0
4 4161 296350 6.49 0
5 4560 277223 6.37 0
6 4401 269189 7.05 0
7 4251 277133 6.34 0
8 4222 282892 6.94 0
9 4063 306639 8.56 0
10 4343 328405 6.71 0
11 4833 321773 5.82 1
12 4453 272319 6.82 0
13 4195 293880 8.38 0
14 4394 300867 7.72 0
15 4099 296872 7.67 0
16 4816 245674 7.72 1
17 4867 211944 6.45 1
18 4114 227996 7.22 0
19 4314 248328 8.50 0
20 4289 249894 8.08 0
21 4269 302660 7.26 0
22 4347 273848 7.39 0
23 4178 245743 8.12 0
24 4333 267673 6.75 0
25 4226 256506 7.79 0
26 4121 271854 7.89 0
27 3998 293225 9.01 0
28 4475 269121 8.01 0
29 4545 322812 7.21 0
30 4016 252225 7.85 0
31 4207 261365 6.14 0
32 4148 287645 6.76 0
33 4562 289666 7.92 0
34 4146 270051 8.19 0
35 4555 265239 7.55 0
36 4365 352466 6.94 0
37 4471 426908 7.25 0
38 5045 369989 9.65 1
39 4469 472476 8.20 0
40 4408 414102 8.02 0
41 4219 302507 6.72 0
42 4211 382686 7.23 0
43 4993 442782 7.61 1
44 4309 322303 7.39 0
45 4499 290455 7.99 0
46 4186 411750 7.83 0
47 4342 292087 7.77 0
y=data$y
> y
[1] 4325 4110 4111 4161 4560 4401 4251 4222 4063 4343 4833 4453
4195 4394 4099 4816 4867 4114 4314 4289 4269 4347 4178 4333
4226
[26] 4121 3998 4475 4545 4016 4207 4148 4562 4146 4555 4365 4471
5045 4469 4408 4219 4211 4993 4309 4499 4186 4342
> x1=data$x1
> x1
[1] 301995 269334 267631 296350 277223 269189 277133 282892 306639
328405 321773 272319 293880 300867 296872 245674 211944
227996
[19] 248328 249894 302660 273848 245743 267673 256506 271854 293225
269121 322812 252225 261365 287645 289666 270051 265239
352466
[37] 426908 369989 472476 414102 302507 382686 442782 322303 290455
411750 292087
> x2=data$x2
> x2
[1] 6.88 7.23 6.27 6.49 6.37 7.05 6.34 6.94 8.56 6.71 5.82 6.82
8.38 7.72 7.67 7.72 6.45 7.22 8.50 8.08 7.26 7.39 8.12 6.75
7.79
[26] 7.89 9.01 8.01 7.21 7.85 6.14 6.76 7.92 8.19 7.55 6.94 7.25
9.65 8.20 8.02 6.72 7.23 7.61 7.39 7.99 7.83 7.77
> x3=data$x3
> x3
[1] 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0
model=lm(y~x1+x2+x3)
> model
Call:
lm(formula = y ~ x1 + x2 + x3)
Coefficients:
(Intercept) x1 x2 x3
4.137e+03 8.077e-04 -1.242e+01 6.094e+02
> summary(model)
Call:
lm(formula = y ~ x1 + x2 + x3)
Residuals:
Min 1Q Median 3Q Max
-263.65 -112.15 -16.26 80.20 297.83
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.137e+03 2.236e+02 18.503 < 2e-16 ***
x1 8.077e-04 3.917e-04 2.062 0.0453 *
x2 -1.242e+01 2.827e+01 -0.439 0.6627
x3 6.094e+02 7.055e+01 8.639 6.03e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
1
Residual standard error: 148.3 on 43 degrees of
freedom
Multiple R-squared: 0.6604, Adjusted R-squared: 0.6367
F-statistic: 27.87 on 3 and 43 DF, p-value:
3.611e-10
> x=matrix(c(x1,x2,x3),byrow=F,ncol=3)
> x
[,1] [,2] [,3]
[1,] 301995 6.88 0
[2,] 269334 7.23 0
[3,] 267631 6.27 0
[4,] 296350 6.49 0
[5,] 277223 6.37 0
[6,] 269189 7.05 0
[7,] 277133 6.34 0
[8,] 282892 6.94 0
[9,] 306639 8.56 0
[10,] 328405 6.71 0
[11,] 321773 5.82 1
[12,] 272319 6.82 0
[13,] 293880 8.38 0
[14,] 300867 7.72 0
[15,] 296872 7.67 0
[16,] 245674 7.72 1
[17,] 211944 6.45 1
[18,] 227996 7.22 0
[19,] 248328 8.50 0
[20,] 249894 8.08 0
[21,] 302660 7.26 0
[22,] 273848 7.39 0
[23,] 245743 8.12 0
[24,] 267673 6.75 0
[25,] 256506 7.79 0
[26,] 271854 7.89 0
[27,] 293225 9.01 0
[28,] 269121 8.01 0
[29,] 322812 7.21 0
[30,] 252225 7.85 0
[31,] 261365 6.14 0
[32,] 287645 6.76 0
[33,] 289666 7.92 0
[34,] 270051 8.19 0
[35,] 265239 7.55 0
[36,] 352466 6.94 0
[37,] 426908 7.25 0
[38,] 369989 9.65 1
[39,] 472476 8.20 0
[40,] 414102 8.02 0
[41,] 302507 6.72 0
[42,] 382686 7.23 0
[43,] 442782 7.61 1
[44,] 322303 7.39 0
[45,] 290455 7.99 0
[46,] 411750 7.83 0
[47,] 292087 7.77 0
>a=solve(t(x)%*%x)
>a
[,1] [,2] [,3]
[1,] 6.065369e-12 -2.419043e-07 -1.292230e-07
[2,] -2.419043e-07 1.007298e-02 1.986474e-03
[3,] -1.292230e-07 1.986474e-03 2.263496e-01
[1] 25000.0 6.7 0.0
> x0=c(250000,6.7,0)
> x0
ycap= 4.137e+03 + 8.077e-04 *250000 -1.242e+01 *6.7 +
6.094e+02 *0
> ycap
sqrt(t(x0)%*%a%*%x0)*148.3*qt(0.975,43)
[,1]
[1,] 43.2184
qt(0.975,43)
[1] 2.016692
ycap+sqrt(t(x0)%*%a%*%x0)*148.3*qt(0.975,43)
[,1]
[1,] 4298.929
> ycap-sqrt(t(x0)%*%a%*%x0)*148.3*qt(0.975,43)
[,1]
[1,] 4212.493