Question: Write an R function that takes the vector Y and matrix X as input then calculates and returns each the followingcomponents: the least squares estimates

Write an R function that takes the vector Y and matrix X as input then calculates and returns each the followingcomponents:

  • the least squares estimates of the regressioncoefficients
  • the variance-covariance matrix of the least squaresestimates
  • the correlation between the two regressioncoefficients
  • the vector of predicted values X(X'X)-1X'Y =HY
  • the vector of residuals (I- X(X'X)-1X')Y =(I-H)Y.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!