Adjusting the Massey Matrix
For our WNBA Massey Matrix model, some adjustments need to be made for a solution to our rating problem to exist and be unique. This is because the matrix we currently have is not (computationally) invertible.
One way we can change this is to add a row of 1
's on the bottom of the matrix \(M\), column of -1
's to the far right of \(M\), and a 0 to the bottom of the vector of point differentials \(\vec{f}\). In this exercise, you will actually add all of these to the matrix \(M\).
This exercise is part of the course
Linear Algebra for Data Science in R
Exercise instructions
- Add a row of
1
's to the bottom of the matrixM
using the commandrbind()
. Assign the result toM_2
. - Add a column of
-1
's to the right ofM_2
using the commandcbind()
. Assign the result toM_3
. - Set the 13x13 element of
M_3
to1
. - Print the resulting matrix.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Add a row of 1's
M_2 <- rbind(M, ___)
# Add a column of -1's
M_3 <- ___(M_2, rep(-1, 13))
# Change the element in the lower-right corner of the matrix
M_3[___, ___] <- 1
# Print M_3
print(___)