Savgolcv: Difference between revisions

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

Revision as of 15:26, 3 September 2008

Purpose

Cross-validation for Savitzky-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 Savitzky-Golay parameters: filter width, polynomial order, and derviative order.

INPUTS

  • 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 Savitzky-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.
  • cvi = cross-validation method. Options are: cvi = 'loo', leave-one-out, cvi = 'vet', venetian blinds {default}, cvi = 'con', contiguous blocks, and cvi = 'rnd', repeated random test sets.
  • split = number of subsets to split the data into {default = 5} and is required for cvi = 'vet', 'con', or 'rnd'.
  • iter = number of iterations {default = 5} and is required for cvi = 'rnd'.
  • mc = 0 supresses mean centering of subsets {default mc = 1}.

OUTPUTS

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