getsquares | R Documentation |
Takes a matrix of covariates and generates a new matrix that contains the original covariates and all squared terms. Squared terms for binary covariates are omitted.
getsquares(mat)
mat |
n by k numeric matrix of covariates. |
n by k*2 numeric matrix that contains the original covariates plus all squared terms.
Jens Hainmueller
See matrixmaker
# create toy matrix mold <- replicate(3,rnorm(50)) colnames(mold) <- paste("x",1:3,sep="") head(mold) # create new matrix mnew <- getsquares(mold) head(mnew)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.