Reference no: EM133220445
All your answers should be supported with screenshots of any relevant outputs or graphs. When making conclusions, always reference specific numbers and your interpretations of them.
1. Regression with Linear Algebra In this problem, you'll manually calculate the beta coefficients of a multiple linear regression and compare the results to the output of the lm() function in R. Using the dataset "mtcars" (built-in to RStudio), do the following:
a. Create a copy of the dataset into a new variable with only these columns: cyl, disp, hp, wt, carb.
b. Add a column of 1's to your copy. Name this variable "count".
c. Convert the dataset into a matrix.
d. Compute the beta coefficients of a multiple linear regression predicting mpg using the variables in your matrix. Here's the formula: (A TA) -1A TY Include a screenshot of your results.
e. Compute the same regression in d), but this time using the lm() command in R (or whichever package you choose to use). How does your manual calculation compare to the output of the function? Include a screenshot of the coefficients.