Julia Deutsch _ HW_ Week 8
docx
keyboard_arrow_up
School
New York University *
*We aren’t endorsed by this school
Course
1305
Subject
Industrial Engineering
Date
Jan 9, 2024
Type
docx
Pages
5
Uploaded by ProfessorTeam17161
Julia Deutsch
HW: Week 7
STATISTICS AND DATA ANALYSIS
HOMEWORK EXERCISES
8. The data file file HEATING deals with the heating bill for dwelling units of various numbers of
rooms. Use R whenever possible in answering the following questions.
a. Obtain a scatter-plot of the two variables. Which variable should be on the horizontal axis?
Help: Use the R command “plot(HEATING$ROOMS, HEATING$FUELBILL)”.
IN R:
plot(HEATING$ROOMS, HEATING$FUELBILL)
b. Find the linear regression equation resulting from regression of FUELBILL on ROOMS. Give
an interpretation for the slope and the intercept.
IN R:
model <- lm(FUELBILL ~ ROOMS, data = HEATING)
summary(model)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -251.885
48.443
-5.20 6.83e-07 ***
ROOMS
136.169
7.098
19.18
< 2e-16 ***
Answer:
The equation of the regression line is
y= -251.885 + 136.169(ROOMS)
Interpretation -
●
For every additional room, the cost of heating will go up by approximately $136.17.
●
If ZERO rooms were heated, the amount of money saved would be approximately,
$251.89
c. Test the hypothesis that the true slope of the regression line is zero.
Ddf = 142
T-stat = 19.18
Q = 0.05
Null hypothesis: B(0) = 0
Alt hypothesis: B(0)
≠
0
IN R:
> qt(0.025,df=142, lower.tail=FALSE)
[1] 1.976811
Interval (-1.976811, 1.976811)
19.18 does not fall within the interval above
Answer:
We REJECT the null hypothesis
d. Predict the FUELBILL for a unit with ROOMS=6.
y= -251.885 + 136.169(ROOMS)
y= -251.885 + 136.169(6)
565.129
Answer:
FUELBILL = approximately $565.13 for a unit with 6 rooms.
e. Create a 95% confidence interval for the average FUELBILL of all dwelling units in
this population with ROOMS=6. Help: Use the following R commands:
x=HEATING$ROOMS y=HEATING$FUELBILL new=data.frame(x=6)
conf=predict(lm(y∼x),new,interval=”confidence”) conf f. Create a 95% prediction
interval for a particular dwelling unit with ROOMS variable equal to 6.
IN R:
x=HEATING$ROOMS
y=HEATING$FUELBILL
new=data.frame(x=6)
conf=predict(lm(y~x),new,interval='confidence')
conf
fit
lwr
upr
1 565.1261
539.8317 590.4206
Answer:
Confidence Interval = (539.8317, 590.4206)
g. A particular 6 room unit last year had a heating bill of $958. Do you find this amount unusually
high?
IN R:
> summary(HEATING)
ROOMS
FUELBILL
Min.
: 3.000
Min.
: 210.0
1st Qu.: 5.000
1st Qu.: 426.0
Median : 6.500
Median : 568.5
Mean
: 6.611
Mean
: 648.3
3rd Qu.: 8.000
3rd Qu.: 832.8
Max.
:11.000
Max.
:1356.0
Answer:
Yes, a FUELBILL of $958.00 for a 6 room unit is unusually high given the mean
FUELBILL for a unit with the same number of rooms would be only $648.30.
A FUELBILL of
$958.00 would conceivably be enough to heat a unit with 8+ rooms.
19. A heating contractor sends a repair person to homes in response to calls about heating
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
problems. The contractor would like to have a way to estimate how long the customer will have
to wait before the repair person can begin work. Data on the number of minutes of waiting time
(Wait.Tim) and the backlog of previous calls waiting for service (Backlog) were obtained. The
data file is available on the class website, under the name WAITTIMEBACKLOG. Answer the
questions below. You may use R for answering these questions.
(a) Find the linear regression equation resulting from regression of WaitTime on Backlog. Give
an interpretation for the slope and the intercept. Help: It makes answering this and the other
questions in this exercise easier if you issue first the following command:
attach(WAITTIMEBACKLOG) This way you can refer directly to the columns in the data file. For
example, instead of WAITTIMEBACKLOG$Backlog you can simply write Backlog.
IN R:
# Load the data
WAITTIMEBACKLOG <- read.csv("path_to_your_file.csv")
# Attach the dataframe
attach(WAITTIMEBACKLOG)
# Perform linear regression
model <- lm(Wait.Tim ~ Backlog)
# Get the summary of the model
summary(model)
Answer:
Linear regression equation of Wait Time on Backlog is…
Wait Time= 23.82+48.13×Backlog
●
Interpretation of the Slope
(48.13): This value suggests that for each additional call in
the backlog, the waiting time increases by approximately 48.13 minutes.
●
Interpretation of the Intercept
(23.82): This represents the expected waiting time when
there is no backlog, essentially a baseline waiting time.
(b) Calculate the predicted value and the 95% prediction interval for the time to respond to a call
when the backlog is 6.
IN R:
attach(WAITTIMEBACKLOG.DATA)
y=Wait.Tim
x=Backlog
new=data.frame(x=6)
conf=predict(lm(y~x),new,interval='confidence')
conf
fit
lwr
upr
312.6087 217.612
407.6054
Answer:
When the backlog is 6, the predicted response time for a call is approximately
312.6087
minutes.
95% Prediction Interval:
The 95% prediction interval for this prediction is as follows:
●
Lower Bound of Interval:
217.612
minutes
●
Upper Bound of Interval:
407.6054
minutes
This interval indicates that, with 95% confidence, the actual response time for a call with a
backlog of 6 is expected to fall within this range.