Polytransform
Purpose
Add new variables to a dataset object or matrix formed as power transforms and cross terms of the original variables.
Synopsis
- [DSOout, model] = polytransform(x, options);
Description
Add polynomial and cross terms to data matrix or dataset. Input dataset x has new transformed variables added. These can include existing variables raised to second, third, fourth power, or second order product of variables. The data can be preprocessed before transformed variables are calculated. preprocessingtype option specifies the type of preprocessing to apply, 'none', 'mncn', 'auto', or 'custom'. If 'custom' is specified then the 'preprocessing' option must be a valid preprocessing structure. If pca = 'on' the data are converted to PCA scores after preprocessing, but before the transformed variables are calculated.
Inputs
- y = (M by N) matrix. Note that (y) is a matrix of ROW vectors to be smoothed.
- x = (1 by N) corresponding axis vector at the points at which (y) is given.
Optional Inputs
- xi = a vector of points to interpolate to.
- width = specifies the number of points in the filter {default = 15}.
- order = the order of the polynomial {default = 2}.
- deriv = the derivative {default = 0}.
Examples
If y is a 5 by 100 matrix, x is a 1 by 100 vector, and xi is a 1 by 91 vector then:
polyinterp(x,y,xi,11,3,1)
gives the 5 by 91 matrix of first-derivative row vectors resulting from an 11-point cubic interpolation to the 91 points in xi.