A firm that prints automobile bumper stickers conducts a study to investigate the relation between the direct cost of producing an order of bumper stickers (TOTCOST) and the number of stickers (RunSize, in 1000s of Stickers) in a particular order. The data are as follows:
RunSize = c(2.6,5.0,10,2,0.8,4,2.5,0.6,0.8,1,2,3,0.4,0.5,5,20,5,2,1,1.5,0.5,1,1,0.6,2.0,
1.5,3,6.5,2.2,1)
TOTCOST = c(230,341,629,187,159,327,206,124,155,147,209,247,135,125,366,1146,
339,208,150,179,128,155,143,131,219,171,258,415,226,159)
plot(RunSize,TOTCOST)
lines(lowess(RunSize,TOTCOST))
regression = lm(TOTCOST~RunSize)
summary(regression)
##
## Call:
## lm(formula = TOTCOST ~ RunSize)
##
## Residuals:
## Min 1Q Median 3Q Max
## -23.572 -6.859 1.805 7.726 19.552
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 99.7770 2.8273 35.29 <2e-16 ***
## RunSize 51.9179 0.5865 88.53 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 12.21 on 28 degrees of freedom
## Multiple R-squared: 0.9964, Adjusted R-squared: 0.9963
## F-statistic: 7837 on 1 and 28 DF, p-value: < 2.2e-16
#For every additional thousand stickers the company produces, the cost of the batch of stickers increases by $51.91
prod5= data.frame(RunSize = c(5))
predict(regression,prod5)
## 1
## 359.3663
# $359.37
sum(regression$residuals^2)/28
## [1] 148.9994
confint(regression)
## 2.5 % 97.5 %
## (Intercept) 93.98557 105.56848
## RunSize 50.71656 53.11916
predict(regression,prod5,interval = 'confidence')
## fit lwr upr
## 1 359.3663 354.1888 364.5438
predict(regression,prod5,interval = 'predict')
## fit lwr upr
## 1 359.3663 333.8319 384.9007