Question

r code Load the “star” data from the “faraway” package, and model “temp” using “light”. library(faraway)...

r code

Load the “star” data from the “faraway” package, and model “temp” using “light”.

library(faraway)
data(star)

fit = lm(temp ~ light, data = star)

One may also suspect that the residuals (use all the data) follow a t distribution instead of normal. Using the same logic that we produced the QQ plot for comparing to the normal distribution, produce a QQ plot for comparing to a t distribution. You need to decide the degrees of freedom yourself (consider df no more than 10). Does the errors seem to come from a t-distribution? Explain your reason. You must write your own code for this question and cannot use any existing package.

Homework Answers

Answer #1

library(faraway)
data("star")
star


# fit the regression

fit <- lm(temp~light,data=star)
summary(fit)


## plot

par(mfrow=c(2,2))
plot(fit)

The results ar e

summary(fit)

Call:

lm(formula = temp ~ light, data = star)

Residuals:

Min 1Q Median 3Q Max

-0.74310 -0.09414 0.06371 0.17744 0.37512

Coefficients:

Estimate Std. Error t value Pr(>|t|)   

(Intercept) 4.84691 0.37422 12.952 <2e-16 ***

light -0.10712 0.07419 -1.444 0.156 ## not signficant as the p value is not less than 0.05

---

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2875 on 45 degrees of freedom

Multiple R-squared: 0.04427, Adjusted R-squared: 0.02304 ## r2 is almost close to zero , hence no variation is explained by the model

F-statistic: 2.085 on 1 and 45 DF, p-value: 0.1557

we that in the qq plot the points are somewhat deviated from the line , hence we can say that the normal distribution variation seems to be violated for the fitted data

we also see that there is a pattern in the residual vs fitted value as the line shows a downward trend

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions