just question c d e please 2. Assume the simple linear regression model iid wher
ID: 3277323 • Letter: J
Question
just question c d e please
2. Assume the simple linear regression model iid where €1 , . . . , En ~ N(0, 2). Let xi-i (e.g. x,-1 , 9, n = 35. , x2 = 2, etc. ). Set A,-10, ,--25, 2- a) Randomly generate and display the n error terms. Before doing this, set a random seed b) Obtain your data set of pairs (xi,yi),..., (xn, Un). Create a scatterplot of y against a c) Estimate the regression coefficients Po and A. Use the equations we learned in class and d) Compare the estimates Ao and with the true parameters ° and A, respectively. Are e) Compute the residuals and the estimated variance. Use the equations learned in class and using the last four digits of your student id number. Comment about the main characteristics. the 1m function in R and show those results are equivalent o and B good verify your numbers using the 1m function in R. of Bo and B1? Explain why or why notExplanation / Answer
c . The formula for calculating B0 and B1 obatained theoritically and the one obtained through R giv nearabout same estimates and it is :
(Intercept) 9.64255
x -2.50294
the r code is here :
z=rnorm(35,0,3)
x=0
y=0
for( i in 1 : 35)
{
x[i]=i
y=10-2.5*x[i]+z
}
y
lm=lm(y~x)
summary(lm)
d. the estimates are close to the original B0 n B1. so, good estimates.
e. in theory we compute the R2 or residual stadard error. here the value of that is 8.631844
and By R when we calculate all residuals and compute the variance : it is 8.377586
the code is :
d=resid(lm)
d
var(d)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.