This lab is dedicated to working with matrices. The following matrix B
can be used for exercises.
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
Show examples of element-wise operations, matrix multiplication, transposition, joining and sub-setting.
Try to find the inverse of B and find the determinant.
Modify the first element in B such that the matrix is invertible and find the inverse.
Define a matrix from the mtcars
data set and build a regression model that predicts miles per gallon based on the number of cylinders, horsepower, axle ratio, weight and acceleration time.