Alternatives to the Regular Matrix Inverse
In the last video, we talked briefly about generalized or pseudo-inverses.
In this exercise, you'll use the Moore-Penrose generalized inverse in the `MASS' package and find that it produces the regular inverse if the matrix you're working with is already invertible!
The command ginv() computes the Moore-Penrose generalized inverse in R.
For more information on the Moore-Penrose inverse, see the following link.
Este exercício faz parte do curso
Linear Algebra for Data Science in R
Instruções do exercício
- The WNBA Massey Matrix
Mand vector of point differentialsfare loaded for you. PrintMagain. - Apply the regular inverse to
Mtofand print the result. - The
MASSpackage is already loaded for you. Apply the generalized inverseginv(M)to `f' and print the result.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Print M
print(M)
# Find the rating vector the conventional way
r <- ___%*%f
colnames(r) <- "Rating"
print(r)
# Find the rating vector using ginv
r <- ___ ___ ___
colnames(r) <- "Rating"
print(r)