eQuad: Multivariate second order polynomial expansion.

Description Usage Arguments Details Value See Also Examples


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


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



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.


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.


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

  • General Method of Data Handling (GMDH).

  • Nonlinear Slow Feature Analysis (SFA). Performing a multivariate polynomial of second degree expansion in all the features, then performing linear SFA on the resulting expanded feature matrix, is a very common approach, and in fact is the default method in sfa2 {rSFA}.


[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



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

Search within the expandFunctions package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.