100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

ST362 - Regression Analysis ASSIGNMENT 2

Beoordeling
-
Verkocht
-
Pagina's
19
Cijfer
A+
Geüpload op
22-08-2022
Geschreven in
2021/2022

ST362 Assignment 2 Questions + Answers from F21

Instelling
Vak










Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Studie
Vak

Documentinformatie

Geüpload op
22 augustus 2022
Aantal pagina's
19
Geschreven in
2021/2022
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

ST362A & ST562A Regression Analysis Assignment 2 Solutions
Due: Wednesday, October 6th, 2021 (11:59pm)
ST362A: Questions 1-6, with total 51 marks
ST562A: Questions 1-7, with total 61 marks
Note: The students in ST362A can work on the questions assigned to ST562A,
and receive bonus marks if the answers are correct.

Part I: R Programming
1. (12 marks) A study was made on the e↵ect of temperature on the yield of
a chemical process. The following data were collected:

x -5 -4 -3 -2 -1 0 1 2 3 4 5
Y 1 5 4 7 10 8 9 13 14 13 18
Please use R to construct a linear model, and retrieve results from the outputs
to answer the below questions. Note: R codes must be provided to this
question.
(a). (2 marks) Assuming a model Y = 0 + 1 x+✏, what are the least squares
estimates of 0 and 1 ? What is the fitted regression line?
(b). (2 marks) Construct an ANOVA table and test the hypothesis H0 : 1 =
0 with the significance level ↵ = 0.05.
(c). (2 marks) Construct a 95% confidence interval for the true mean value
of Y when x = 3. Interpret this interval.
(d). (2 marks) Construct a 95% confidence interval for the di↵erence between
the true mean value of Y when x1 = 3 and the true mean value of Y
when x2 = 2.
(e). (2 mark) Are there any indications that a better model should be tried?
(f). (2 marks) Comment on the number of levels of temperature investigated
with respect to the estimate of 1 in the assumed model.

Solution:

(a). x_temp <- c(-5:5)
y_yield <- c(1, 5, 4, 7, 10, 8, 9,13,14,13,18)

> result <- lm(y_yield~x_temp)
> summary(result)

1

, Call:
lm(formula = y_yield ~ x_temp)

Residuals:
Min 1Q Median 3Q Max
-2.0182 -1.1818 0.4182 1.1636 2.1636

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.2727 0.4632 20.021 9.00e-09 ***
x_temp 1.4364 0.1465 9.807 4.21e-06 ***
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1

Residual standard error: 1.536 on 9 degrees of freedom
Multiple R-squared: 0.9144, Adjusted R-squared: 0.9049
F-statistic: 96.18 on 1 and 9 DF, p-value: 4.207e-06
The least squares estimates for 0 and 1 are ˆ0 = 9.2727 and ˆ1 =
1.4364 respectively. The fitted line is Ŷ = 9.2727 + 1.4364 ⇥ x.
(b). > anova(result)
Analysis of Variance Table

Response: y_yield
Df Sum Sq Mean Sq F value Pr(>F)
x_temp 1 226.945 226.94 96.18 4.207e-06 ***
Residuals 9 21.236 2.36
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1

> qf(0.05, 1, 9, lower.tail = FALSE)
[1] 5.117355
Construct a F ratio, Fobs = M SE(Reg) 226.94
M SE(Res) = 2.36 = 96.16102, which is much
greater than the critical value 5.117355 at ↵ = 0.05. Therefore we reject
H0 and conclude that 1 is not equal 0.
(c). > predict(result, newdata=data.frame(x_temp=3),interval="confidence

2

, level=0.95)
fit lwr upr
1 13.58182 12.13764 15.026
The 95% confidence interval for the true mean value of Y when x = 3
is (12.13764, 15.026).
(d). > qt(0.025, 9, lower.tail=FALSE)
[1] 2.262157
> 1.4364+2.262157*0.1465
[1] 1.767806
> 1.4364-2.262157*0.1465
[1] 1.104994
The true mean value of Y when x1 = 3 is E[Y1 ] = 0 + 3 1 , and the
true mean value of Y when x2 = 2 is E[Y2 ] = 0 2 1 . The dif-
ference is E[Y1 ] E[Y2 ] = ( 0 + 3 1 ) ( 0 2 1 ) = 5 1 . Therefore,
the 95% confidence interval is 5⇥ the 95% confidence interval of 1 ,
5 ⇥ (1.104994, 1.767806) = (5.52497, 8.83903).
(e). Since R2 = 0.9144 is high enough, and this means 91.44% of the vari-
ance of the response variable can be explained by the regression line.
The scatter plot attached also indicates this strong positive linear rela-
tionship. There is no need to try a much better model.
(f). > result1 <- lm(y_yield[1:5]~x_temp[1:5])
> summary(result1)

Call:
lm(formula = y_yield[1:5] ~ x_temp[1:5])

Residuals:
1 2 3 4 5
-0.4 1.6 -1.4 -0.4 0.6

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.4000 1.3808 8.256 0.00372 **
x_temp[1:5] 2.0000 0.4163 4.804 0.01717 *
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1

3
€8,30
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
dg22
1,0
(1)

Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
dg22 Wilfrid Laurier University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
6
Lid sinds
3 jaar
Aantal volgers
2
Documenten
31
Laatst verkocht
1 week geleden

1,0

1 beoordelingen

5
0
4
0
3
0
2
0
1
1

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen