savgolcv
Purpose
Cross-validation for Savitsky-Golay smoothing and
differentiation.
Synopsis
cumpress =
savgolcv(x,y,lv,width,order,deriv,ind,rm,cvi,pre); %for x class
"double"
cumpress =
savgolcv(x,y,lv,width,order,deriv,[],rm,cvi,pre); %for x class
"dataset"
Description
SAVGOLCV
performs cross-validation of Savitsky-Golay parameters: filter width,
polynomial order, and derviative order.
INPUT:
x
= M by N matrix of predictor variables with ROW vectors to be
smoothed (e.g. spectra), and
y
= M by P matrix of predicted variables.
OPTIONAL INPUTS:
ind
= indices of columns of x
to be used for calibration {default ind = [1:n] i.e. all x columns}.
The following are optional Savitsky-Golay parameters (calls SAVGOL). By entering a
vector, instead of a scalar, these variables are cross-validated.
width
= number of points in filter {default width = [11 17 23]}.
order
= polynomial order {default order
= [2 3]}.
deriv = derivative order {default deriv = [0 1 2]}.
The following are optional cross-validation parameters (calls CROSSVAL).
lv
= maximum number of LVs {default lv = min(size(x))}.
rm
= regression method. Options are: rm = 'nip', PLS via NIPALS algorithm; rm = 'sim', PLS via SIMPLS
algorithm {default}, and rm =
'pcr', uses PCR.
cvm
= cross-validation method. Options are: cvm = 'loo', leave-one-out, cvm = 'vet', venetian blinds {default}, cvm = 'con', contiguous
blocks, and cvm = 'rnd',
repeated random test sets.
split
= number of subsets to split the data into {default = 5} and is required for cvm = 'vet', 'con', or 'rnd'.
iter
= number of iterations {default = 5} and is required for cvm = 'rnd'.
mc
= 0 supresses mean centering of subsets {default mc = 1}.
OUTPUT:
The output is a 4 dimensional array with each dimension
corresponding to one of the directions cross-validated over.
cumpress(i,:,:,:) = derivative
dimension,
cumpress(:,j,:,:) = latent
variable dimension,
cumpress(:,:,k,:) = window
width dimension, and
cumpress(:,:,:,l) = polynomial
order dimension.
See Also
baseline, crossval, lamsel, mscorr, savgol, specedit, stdfir