normalEqn <- function(X, y) { # Computes the closed-form solution to linear regression # # theta <- normalEqn(X, y) computes the closed-form solution to linear # regression using the normal equations. # ====================== YOUR CODE HERE ====================== # Instructions: Complete the code to compute the closed form # solution to linear regression and put the result # in theta. # # Hint: Use the function ginv in package MASS to compute # the inverse of a matrix # ============================================================ return(theta) }