CommencerCommencer gratuitement

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\).

Cet exercice fait partie du cours

Linear Algebra for Data Science in R

Afficher le cours

Instructions

  • Add a row of 1's to the bottom of the matrix M using the command rbind(). Assign the result to M_2.
  • Add a column of -1's to the right of M_2 using the command cbind(). Assign the result to M_3.
  • Set the 13x13 element of M_3 to 1.
  • Print the resulting matrix.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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(___)
Modifier et exécuter le code