Who likes least squares
# automatig lapack
betahat = np.linalg.lstsq(X, y)
# brittle manual
betahat2 = np.linalg.inv(X.T @ X) @ X.T @ y
# QR decompostion
Q, R = np.linalg.qr(X)
betahat3 = np.linalg.inv(R) @ Q.T @ y
You can blog here?
Who likes least squares
# automatig lapack
betahat = np.linalg.lstsq(X, y)
# brittle manual
betahat2 = np.linalg.inv(X.T @ X) @ X.T @ y
# QR decompostion
Q, R = np.linalg.qr(X)
betahat3 = np.linalg.inv(R) @ Q.T @ y
causal inference, econometrics, ML, arsenal, loud music, unix, FOSS for scientific computing. Research Scientist.
apoorvalal.github.io
(passively) maintains @paperposterbot.bsky.social