PLS_Toolbox Documentation: matchvars | < lwrxy | mcr > |
matchvars
Purpose
Align variables of a dataset to allow prediction with a model.
Synopsis
[mxdata, unmap] = matchvars(model,xdata,options)
[mxdata, unmap] = matchvars(labels,xdata,options)
[mxdata, unmap] = matchvars(axisscale,xdata,options)
[mxdata, mydata, unmapx, unmapy] = matchvars(model,xdata,ydata,options)
rdata = matchvars(mdata,unmap)
Description
Given a standard model structure model MATCHVARS uses either the labels stored in the model or, if no labels exist, the axisscale in the model to rearrange or interpolate the variables of a dataset object so that the model can be applied to the data. If model is a regression model, both an X and a Y block may be passed for alignment. A Y block is not required, however.
MATCHVARS WITH LABELS: When variable labels exist in both the model and the data, the variables in data are rearranged to match the variable order in model based on the labels stored in the model. Any variables required by model that do not exist in data are returned as NaN (Not a Number). These will usually be automatically replaced by the prediction routine using REPLACE.
MATCHVARS WITH LABELS: When variable labels exist in both the model and the data, the variables in data are rearranged to match the variable order in model based on the labels stored in the model. Any variables required by model that do not exist in data are returned as NaN (Not a Number). These will usually be automatically replaced by the prediction routine using REPLACE.
When no labels exist in the supplied model, the axisscale is used to interpolate the data based on the setting of options.axismode (see below). Axis regions which require extrapolation are returned as NaN (Not a Number). These will usually be automatically replaced by the prediction routine using REPLACE.
If neither labels nor axisscales can be used to align variables, the dataset object is passed back without modification.
An ordinary cell or character array of strings representing labels to match or an ordinary vector representing an axisscale may be passed in place of model. Such labels or axisscale can only be used with a single dataset (i.e. xdata).
NOTE: if axisscale was used to interpolate new variables for mxdata or mydata, the unmap variable(s) will be linear vectors which simply return the original data.
INPUTS:
OUTPUT:
Options
See Also
interp1, modlpred, pcapro, replace, str2cell
< lwrxy | mcr > |