Projects the (centred) columns of a matrix onto a (centered) vector and returns the slope-coefficient for each column.
projectonto(A, b)
A | A centered matrix whose columns will be projected onto |
---|---|
b | this centered vector |
A vector of slope coefficients.
data(BCdata) Y <- BCdata$Y X <- BCdata$X #Project the columns of X onto Y. tt <- projectonto(X,Y)