subject
Mathematics, 11.03.2020 01:55 smartie80

For this exercise use the prostate dataset from the faraway package. Use ?prosate to learn about the dataset. The goal of this exercise is to fit a model with lpsa as the response and the remaining variables as predictors.

(a) Obtain the estimated regression coefficients without the use of lm() or any other built-in functions for regression. That is, you should use only matrix operations. Store the results in a vector beta_hat_no_lm. To ensure this is a vector, you may need to use as. vector(). Return this vector as well as the results of sum (beta_hat_no_lm).
(b) Obtain the estimated regression coefficients with the use of lm(). Store the results in a vector beta_hat_lm. To ensure this is a vector, you may need to use as. vector (). Return this vector as well as the results of sum (beta_hat_lm).
(c) Use the all. equal() function to verify that the results are the same. You may need to remove the names of one of the vectors. The as. vector() function will do this as a side effect, or you can directly use unname().
(d) Calculate se without the use of lm(). That is, continue with your results from (a) and perform additional matrix operations to obtain the result. Output this result. Also, verify that this result is the same as the result obtained from lm().
(e) Calculate R² without the use of lm(). That is, continue with your results from (a) and (d) and perform additional operations to obtain the result. Output this result. Also, verify that this result is the same as the result obtained from lm().

ansver
Answers: 1

Another question on Mathematics

question
Mathematics, 21.06.2019 17:30
What is the shape of the height and weight distribution
Answers: 2
question
Mathematics, 21.06.2019 20:00
Find the value of x. round the length to the nearest tenth
Answers: 1
question
Mathematics, 21.06.2019 21:00
The functions below show the amount of money bella and sweet t had saved after earning money for doing chores. which description best compares the two functions?
Answers: 1
question
Mathematics, 21.06.2019 23:00
Match the vocabulary to the proper definition. in probability, two events in which 1. conditional probability the outcome of one event is independent of the outcome of a second event. 2. dependent events in probability, two events in which the outcome of one event is dependent on the outcome of a second event. the probability of an event in which the outcome of the event is conditional on the outcome of one or more different events. 3. independent events
Answers: 2
You know the right answer?
For this exercise use the prostate dataset from the faraway package. Use ?prosate to learn about the...
Questions
question
Mathematics, 12.03.2020 21:25
Questions on the website: 13722367