Use R to do this problem. Dataset is \'sat\' and is found in the downloadable fa
ID: 3182510 • Letter: U
Question
Use R to do this problem. Dataset is 'sat' and is found in the downloadable faraway package. I need number 2 answered, it says to use the bullet points from number 1 to answer it. Also need the certain code used to answer each bullet.Thanks!! Dataset: sat Library: faraway l believe i have the correct answer for part 1 so i mainly need part 2 answered with the r codes used to find the answers! Using R! Part 2 uses the bulleted questions in part 1. If you have time to work out part 1 as well so i can check my work that would be great but mainly worried about part 2!! Using the sat dataset, fit a model with the total SAT score as the response and expend, salary, ratio, and takers as predictors. Perform regression diagnostic on this model to answer the following questions. Display any plots that are relevant. Do not provide any plots about which you have nothing to say. (a) Check the constant variance assumption for the erros; (b) Check the normality assumption; (c) Check for large leverage points: (d) Check for outliers; (e) Check for influential points. 2. For the prostate data, fit a model with lpsa as the response and the other variables as predictors, Answer the questions posted in the first question.
Explanation / Answer
library(faraway)
attach(prostate)
data=prostate
data
lm=lm(data$lpsa~pgg45+gleason+ lcp+ svi+lbph+age +lweight+lcavol)
lm
summary(lm)
lmtest::bptest(lm) #question a
##answer p value= 0.25. variance is constant
# Normality of Residuals
# qq plot for studentized resid
resid=rstandard(lm)
qqnorm(resid,ylab="Standardized Residuals",xlab="Normal Scores",main="qqplot")
qqline(eruption.stdres)
## yes, normal. from the plot.
leveragePlots(lm)
plot(resid)
##from the plot we can see the outliers, levarage points.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.