Question

The following question can be answered in R code (using R-Studio or a program of your...

The following question can be answered in R code (using R-Studio or a program of your choice).

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

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
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...
This problem requires using R studio. This question is from Verzani (Problem 6.25) Can some write...
This problem requires using R studio. This question is from Verzani (Problem 6.25) Can some write the code for the answer to the question below: A q-q plot is an excellent way to investigate whether a distribution is approximately normal. For the symmetric distributions Uniform (0,1), Normal (0,1), and t with 3 degrees of freedom, take a random sample of size 100 and plot a quantile-normal plot using qnorm. Compare the three and comment on the curve of the plot...
Use the programming language R to code the following project.. * Make sure you turn in...
Use the programming language R to code the following project.. * Make sure you turn in your code and answers from each question. (not the raw data). 1. Generate 1000 random samples of size 40 from the normal distribution with mean µ = 3 and standard deviation σ = 2. Compute 95% the confidence interval of 1000 samples and find the rate of confidence interval contains the true mean. What did you learn from this simulation study? 2. For each...
This problem requires using R studio. This question is from Verzani (Problem 2.56) Can some write...
This problem requires using R studio. This question is from Verzani (Problem 2.56) Can some write the code for the answer to the question below: The Michelson(HistData) data set records 100 measurements by Michelson of the speed of light (in the variable velocity). Make a quantile-normal graph and discuss if the graphic shows the points falling on a straight line.
This problem requires using R studio. This question is from Verzani (Problem 2.15) Can some write...
This problem requires using R studio. This question is from Verzani (Problem 2.15) Can some write the code for the answer to the question below: The negation operator ! is used with reverse Boolean values. For example: A <- c(True, False, True, False) !A ##[1] False True False False One of De Morgan's laws in R code is ! (A & B) = !A | !B . Verify this with B <- c(False, True, False, True) and A as above.
Using R Studio: Include R Code: The following data is from IQ tests for pairs of...
Using R Studio: Include R Code: The following data is from IQ tests for pairs of twins that were separated at birth. One twin was raised by the biological parents, the other by adoptive parents. Foster:     80, 88, 75, 113, 95, 82, 97, 94, 132, 108 Biological:            90, 91, 79, 97, 97, 82, 87, 94, 131, 115 Find a 90% confidence interval for the differences of mean. What do you assume about the data? In particular, are the two samples independent?
Using R Studio: (Include the R code) The following data is from IQ tests for pairs...
Using R Studio: (Include the R code) The following data is from IQ tests for pairs of twins that were separated at birth. One twin was raised by the biological parents, the other by adoptive parents. Foster:     80, 88, 75, 113, 95, 82, 97, 94, 132, 108 Biological:            90, 91, 79, 97, 97, 82, 87, 94, 131, 115 Find a 90% confidence interval for the differences of mean. What do you assume about the data? In particular, are the two samples independent?
Could you please solve these using r code. 1. A pumpkin farmer weighed a simple random...
Could you please solve these using r code. 1. A pumpkin farmer weighed a simple random sample of size n = 20 pumpkins, with these results: 9.6, 8.8, 5.1, 9.7, 9.1, 8.9, 8, 9.2, 2.7, 9.1, 8.5, 7.3, 9.3, 9.6, 4.1, 9.9, 7.6, 9, 7.2, 8.5 (a) Create a QQ plot of the weights. Do you think it is reasonable to assume that the population distribution is normal? Explain your answer. (b) Regardless of your answer to (a), use R...
Using R programming language, complete the following. 1. Generate the bivariate normal sample of size 100...
Using R programming language, complete the following. 1. Generate the bivariate normal sample of size 100 with parameters a. marginal mean of X equal to 1, b. marginal mean of Y equal to 2, c. marginal variance of X equal to 3, d. marginal variance of Y equal to 4, e. correlation between X and Y equal to -1/2. You can use the function mvrnorm(), first installing its package by the code if (! require ("MASS")) install.packages("MASS"); library ("MASS") 2....
1. Consider the following data that represents a random sample out of a very large population:...
1. Consider the following data that represents a random sample out of a very large population: 0.43, 4.89, 5.29, 5.16, 0.59, 7.50, 4.48, 6.22 (a) Create a QQ plot of the data. Do you think it is reasonable to assume that the population distribution is normal? Explain your answer. (b) Denote µ to be the population mean. Regardless of your answer to (a), use R to perform the bootstrap with 2000 resamplings to create a 90% CI for µ. Since...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT