Projects the (centred) columns of a matrix onto a (centered) vector and returns the slope-coefficient for each column.

projectonto(A, b)

Arguments

A

A centered matrix whose columns will be projected onto

b

this centered vector

Value

A vector of slope coefficients.

Examples

data(BCdata) Y <- BCdata$Y X <- BCdata$X #Project the columns of X onto Y. tt <- projectonto(X,Y)