lwrpred
Purpose
Predictions based on locally weighted regression models.
Synopsis
ypred = lwrpred(xnew,xold,yold,lvs,npts,out)
[ypred,extrap] = lwrpred(xnew,xold,yold,lvs,npts,out)
Description
LWRPRED
makes new sample predictions ypred
for a new matrix of independent variables xnew based on an existing data set of independent
variables xold, and a
vector of dependent variables yold.
Predictions are made using a locally weighted regression model defined by the
number principal components used to model the independent variables lvs and the number of points
defined as local npts.
Optional input out suppresses printing of the results
when set to 0 {default = 1}. Additional output (extrap), a vector equal in
length to number of samples in xnew, is non-zero when the given sample was
predicted by extrapolating outside of the range of y-values which were used in
the model. The value represents the distance (in y-units) extrapolated outside
of the modeled samples. For example, a value of -0.3 indicates that the given
sample was predicted by extrapolating 0.3 y-units below the lowest modeled
sample in yold.
Note: Be sure to use the same scaling on new and old samples i.e.
xnew must be scaled
the same as xold!
Options
options = a structure array with the following fields:
display: [ 'off' | {'on'} ] governs level of display.
alpha: [ 0-1 ] Weighting of y-distances in
selection of local points. 0 = do not consider y-distances {default}, 1 =
consider ONLY y-distances,
iter: [ {5} ] Iterations in determining local
points. Used only when alpha > 0 (i.e. when using y-distance scaling),
preprocessing: {
2 2 } Two element cell array defining preprocessing to use on data.
First element of cell defines x-block preprocessing, second element defines
y-block preprocessing. Options are:
0 = no scaling or
centering
1 = mean center only
2 = autoscale (default)
For example: {1 2}
performs mean centering on x-block and autoscaling on y-block,
algorithm: [
{'globalpcr'} | 'pcr' | 'pls' ] Method of regression after samples are
selected. 'globalpcr' performs PCR based on the PCs calculated from the entire
calibration data set but a regression vector calculated from only the selected
samples. 'pcr' and 'pls' calculate a local PCR or PLS model based only on the
selected samples.
reglvs: [ ] Used only when algorithm is 'pcr' or 'pls', this
is the number of latent variables/principal components to use in the
regression model, if different from the number used to select calibration
samples. [] (Empty) implies LWRPRED should use the same number of latent
variables in the regression as were used to select samples. NOTE: This option
is NOT used when algorithm is 'globalpcr'.
See Also
pls, polypls