In: Statistics and Probability
A lead inspector at ElectroTech, an electronics assembly shop, wants to convince management that it takes longer, on a per-component basis, to inspect large devices with many components than it does to inspect small devices because it is difficult to keep track of which components have already been inspected. To support her point, she has collected data on the inspection time in seconds (Inspection.Time) and the number of components per device (Components) from the last 25 devices. A portion of the data is shown in the accompanying table.
Components | Inspection Time |
32 | 84 |
13 | 48 |
8 | 31 |
18 | 59 |
15 | 52 |
11 | 41 |
24 | 72 |
41 | 99 |
8 | 23 |
12 | 41 |
18 | 63 |
9 | 27 |
30 | 81 |
12 | 47 |
12 | 31 |
18 | 62 |
17 | 52 |
18 | 60 |
24 | 73 |
43 | 101 |
16 | 60 |
13 | 45 |
22 | 68 |
13 | 46 |
24 | 70 |
Read the Excel file into R.
> mydata <- read.xlsx(file.choose())
> options(scipen=10, digits=10)
a-1. Estimate the linear, quadratic, and cubic regression models with Time as the response (Y) variable. Report the Adjusted R2 for each model. (Round answers to 4 decimal places.)
> fit1 <- lm(Y ~ I(X), data=mydata) where X & Y are the variable names (I is a capital letter i)
> fit2 <- lm(Y ~ I(X) + I(X^2), data=mydata) fits a quadratic model
> fit3 <- lm(Y ~ I(X) + I(X^2) + I(X^3),
data=mydata) fits a cubic model
Linear Model:
Quadratic Model:
Cubic Model:
a-2. Based on adjusted-R2, which model
has the best fit?
Quadratic model | |
Cubic model | |
Linear model |
b. Use the best model to predict the time required
to inspect a device with 39 components. (Round answer to 2
decimal places.)
> predict(fit#, data.frame(X=##))
I have used R code to solve this problem.
(a-1) SIMPLE LINEAR REGRESSION MODEL:
The adjusted R square for simple linear regression model is .
QUADRATIC MODEL:
The adjusted R square for quadratic model is .
CUBIC MODEL:
The adjusted R square for cubic model is .
(a-2) MODEL THAT HAS BEST FIT:
Since the adjusted R square for cubic model is the maximum (0.9682), the cubic model has the best fit. Thus the correct answer is Option (ii): Cubic model
(b) PREDICTED VALUE OF INSPECTION TIME USING CUBIC MODEL:
Thus the predicted time required to inspect a device with 39 components is .