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
Get step-by-step solutions from verified subject matter experts
