eQuad: Multivariate second order polynomial expansion.

Description Usage Arguments Details Value See Also Examples

View source: R/expandFunctions.R

Description

Expand matrix columns into linear, square, and unique product columns.

Usage

1
eQuad(X, FUN = `*`, ...)

Arguments

X

vector or matrix. If a vector, it will be converted to a column matrix. If it is desired that the squares and products of a vector are computed, pass rbind(X) instead of X, and thereby pass a row matrix.

FUN

Binary function which forms the products of the columns. By default, this is '*', but other commuting operators or kernels can be used if desired.

...

Options for FUN. Not needed if FUN doesn't have options.

Details

Form a matrix with columns composed of into linear, square, and product columns:

[X | FUN(X[,i], X[,j])]

where i, j are the unique combinations of i and j, including i=j.

By default, the function used to form the squares and products, FUN, is just conventional multiplication = '*', but any commuting binary operator can be used.

This particular expansion is often applied in

Value

[X,X^2,unique products of columns of X]. The unique products are in row major upper right triangular order. Thus, for X with columns 1:3, the order is

X[,1]^2, X[,2]^2, X[,3]^2, X[,1]*X[,2], X[,1]*X[,3], X[,2]*X[,3]

See Also

sfa2

Examples

1
2
3
# # Examples
# eQuad(1:5)
# eQuad(matrix(1:12,ncol=3),FUN=`+`)

expandFunctions documentation built on May 2, 2019, 9:15 a.m.