1. In R copy the stackloss data into an object called Stack. For the 17th observation of Stack, successively replace the Water.Temp value of 19 with the values 19, 20, 21, … 29 (degrees Celsius). For...

1 answer below »
1. In R copy the stackloss data into an object called Stack. For the 17th observation of Stack, successively replace the Water.Temp value of 19 with the values 19, 20, 21, … 29 (degrees Celsius). For each instance obtain the estimated regression coefficients (a four-vector) using least-squares and least-absolute values regression. Then, for each coefficient, produce a plot of the coefficient estimate versus the value of Water.Temp that was used for the 17th observation. Plot the least-squares and least-absolute values regression estimates on the same plot (use different colors). Because there are four coefficients, you can use par(mfrow = c(2,2)) to make each one a separate subplot in a 2 × 2 plot matrix. Make sure that the subplots are properly labeled! When you are done, write a few sentences to compare the sensitivity of least-squares versus least-absolute values regression to changes in this one observation.
2. Use the pima data to produce a least-squares estimated regression for predicting insulin from diastolic, triceps, and age. Remember to use a version of the data set with missing values replacing zeros. With lm() the default is to drop all observations that have missing values, so you don’t have to take action to remove them.


3. An experiment was conducted to determine the effect of four factors on the resistivity of a semiconductor wafer. The data is found in wafer where each of the four factors is coded as − or + depending on whether the low or the high setting for that factor was used. Fit the linear model resist ∼ x1 + x2 + x3 + x4.(a) Extract the X matrix using the model.matrix function. Examine this to determine how the low and high levels have been coded in the model.(b) Compute the correlation in the X matrix. Why are there some missing values in the matrix?(c) What difference in resistance is expected when moving from the low to the high level of x1?(d) Refit the model without x4 and examine the regression coefficients and standard errors? What stayed the the same as the original fit and what changed?
Answered Same DayNov 10, 2021

Answer To: 1. In R copy the stackloss data into an object called Stack. For the 17th observation of Stack,...

Mohd answered on Nov 10 2021
116 Votes
-
-
-
11/10/2021
library(magrittr)
library(dplyr)
library(ggplot2)
library(rmarkdown)
library(skimr)
library(faraway)
library(ggeffects)
library(stargazer)
1. In R copy the stackloss data into an object called Stack. For the 17th observation of Stack, successively replace the Water.Temp value of 19 with the values 19, 20, 21, … 29 (degrees Cel
sius).
For each instance obtain the estimated regression coefficients (a four-vector) using least-squares and least-absolute values regression.
Then, for each coefficient, produce a plot of the coefficient estimate versus the value of Water.Temp that was used for the 17th observation.
Plot the least-squares and least-absolute values regression estimates on the same plot (use different colors).
Because there are four coefficients, you can use par(mfrow = c(2,2)) to make each one a separate subplot in a 2 × 2 plot matrix. Make sure that the subplots are properly labeled! When you are done,
write a few sentences to compare the sensitivity of least-squares versus least-absolute values regression to changes in this one observation.
Stack<-stackloss
mod_1<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_1)
plot(mod_1)
Stack[17,2]<-20
mod_2<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_2)
Stack[17,2]<-21
mod_3<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_3)
Stack[17,2]<-22
mod_4<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_4)
Stack[17,2]<-23
mod_5<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_6)
Stack[17,2]<-25
mod_7<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_7)
Stack[17,2]<-26
mod_8<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_8)
Stack[17,2]<-27
mod_9<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_9)
Stack[17,2]<-28
mod_10<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_10)
Stack[17,2]<-29
mod_11<-lm(stack.loss~Water.Temp,data=Stack)
#summary(mod_11)
stargazer(mod_1,mod_2,mod_3,mod_4,mod_5,type="text")
##
## ====================================================================================
## Dependent variable:
## ------------------------------------------------------
## stack.loss
## (1) (2) (3) (4) (5)
## ------------------------------------------------------------------------------------
## Water.Temp 2.817*** 2.815*** 2.786*** 2.729*** 2.647***
## (0.357) (0.370) (0.386) (0.405) (0.425)
##
## Constant -41.911*** -42.002*** -41.510*** -40.437*** -38.819***
## (7.606) (7.903) (8.273) (8.694) (9.137)
##
## ------------------------------------------------------------------------------------
## Observations 21 21 21 21 21
## R2 0.767 0.753 0.732 0.705 0.671
## Adjusted R2 0.754 0.740 0.718 0.689 0.654
## Residual Std. Error (df = 19) 5.043 5.187 5.400 5.670 5.982
## F Statistic (df = 1; 19) 62.373*** 57.922*** 51.967*** 45.360*** 38.821***
##...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here