Frpcrengine: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Jeremy |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Line 6: | Line 5: | ||
===Synopsis=== | ===Synopsis=== | ||
:[b,ssq,u,sampscales,msg,options] = | :[b,ssq,u,sampscales,msg,options] = frpcrengine(x,y,ncomp,''options''); %calibration | ||
:[yhat] = frpcrengine(x,b); %prediction | |||
:[yhat] = frpcrengine(x,b); %prediction | |||
===Description=== | ===Description=== | ||
Calculates a single full-ratio, FR, PCR model using the given number of components ncomp to predict y from measurements x. Random multiplicative scaling of each sample can be used to aid model stability. Full-Ratio PCR models are based on the simultaneous regression for both y-block prediction and scaling variations (such as those due to pathlength and collection efficiency variations). The resulting PCR model is insensitive to scaling errors. | Calculates a single full-ratio, FR, PCR model using the given number of components ncomp to predict <tt>y</tt> from measurements <tt>x</tt>. Random multiplicative scaling of each sample can be used to aid model stability. Full-Ratio PCR models are based on the simultaneous regression for both y-block prediction and scaling variations (such as those due to pathlength and collection efficiency variations). The resulting PCR model is insensitive to scaling errors. | ||
NOTE: For best results, the x-block should not be mean-centered. | NOTE: For best results, the x-block should not be mean-centered. | ||
Line 20: | Line 18: | ||
T.V. Karstang and R. Manne, "Optimized scaling: A novel approach to linear calibration with close data sets", Chemom. Intell. Lab. Syst., '''14''', 165-173 (1992). | T.V. Karstang and R. Manne, "Optimized scaling: A novel approach to linear calibration with close data sets", Chemom. Intell. Lab. Syst., '''14''', 165-173 (1992). | ||
For calibration mode, inputs include the x-block data, | For calibration mode, inputs include the x-block data, <tt>x</tt>, y-block data, <tt>y</tt>, and number of components <tt>ncomp</tt>. The optional input ''options'' is described below. Calibration mode outputs include: | ||
<tt>b</tt> = the full-ratio regression vector for a SINGLE MODEL at the given number of PCs, | |||
<tt>ssq</tt> = PCA variance information, | |||
<tt>u</tt> = the x-block loadings, | |||
<tt>sampscales</tt> = random scaling used on the samples, | |||
<tt>msg</tt> = warning messages, and | |||
<tt>options</tt> = the modified options structure. | |||
For prediction mode, inputs are the x-block data, <tt>x</tt>, and the full-ratio regression vectors, <tt>b</tt>. The one output is the predicted y, <tt>yhat</tt>. | |||
options | ====Inputs==== | ||
* '''x''' = input x-block. | |||
* '''y''' = input y-block, calibration mode. | |||
* '''ncomp''' = number of components, calibration mode. | |||
* '''b''' = full-ratio regression vector for a single model at the given number of PCs, prediction mode. | |||
====Outputs==== | |||
* '''b''' = full-ratio regression vector for a single model at the given number of PCs, calibration mode. | |||
* '''ssq''' = PCA variance information, calibration mode. | |||
* '''u''' = x-block loadings, calibration mode. | |||
* '''sampscales''' = random scaling used on the samples, calibration mode. | |||
* '''msg''' = warning message, calibration mode. | |||
* '''options''' = modified options structure, calibration mode. | |||
* '''yhat''' = predicted y values, prediction mode. | |||
===Options=== | ===Options=== | ||
options = a structure with the following fields: | |||
* '''pathvar''': [ {0. | * '''pathvar''': [ {0.2} ] standard deviation for random multiplicative scaling. A value of zero will disable the random sample scaling but may increase model sensitivity to scaling errors, | ||
* '''useoffset''': [ {'off'} | 'on' ] flag determining use of offset term in regression equations (may be necessary for mean-centered x-block), | * '''useoffset''': [ {'off'} | 'on' ] flag determining use of offset term in regression equations (may be necessary for mean-centered x-block), | ||
Line 54: | Line 70: | ||
* '''maxiter''': [ {100} ] maximum number of iterations. | * '''maxiter''': [ {100} ] maximum number of iterations. | ||
===See Also=== | ===See Also=== | ||
[[frpcr]], [[mscorr]], [[pcr]] | [[frpcr]], [[mscorr]], [[pcr]] |
Latest revision as of 16:32, 9 October 2008
Purpose
Engine for full-ratio PCR; also known as optimized scaling 2 PCR.
Synopsis
- [b,ssq,u,sampscales,msg,options] = frpcrengine(x,y,ncomp,options); %calibration
- [yhat] = frpcrengine(x,b); %prediction
Description
Calculates a single full-ratio, FR, PCR model using the given number of components ncomp to predict y from measurements x. Random multiplicative scaling of each sample can be used to aid model stability. Full-Ratio PCR models are based on the simultaneous regression for both y-block prediction and scaling variations (such as those due to pathlength and collection efficiency variations). The resulting PCR model is insensitive to scaling errors.
NOTE: For best results, the x-block should not be mean-centered.
Although the full-ratio method uses a different method for determination of the regression vector, the fundamental idea is very similar to the optimized scaling 2 method as described in:
T.V. Karstang and R. Manne, "Optimized scaling: A novel approach to linear calibration with close data sets", Chemom. Intell. Lab. Syst., 14, 165-173 (1992).
For calibration mode, inputs include the x-block data, x, y-block data, y, and number of components ncomp. The optional input options is described below. Calibration mode outputs include:
b = the full-ratio regression vector for a SINGLE MODEL at the given number of PCs,
ssq = PCA variance information,
u = the x-block loadings,
sampscales = random scaling used on the samples,
msg = warning messages, and
options = the modified options structure.
For prediction mode, inputs are the x-block data, x, and the full-ratio regression vectors, b. The one output is the predicted y, yhat.
Inputs
- x = input x-block.
- y = input y-block, calibration mode.
- ncomp = number of components, calibration mode.
- b = full-ratio regression vector for a single model at the given number of PCs, prediction mode.
Outputs
- b = full-ratio regression vector for a single model at the given number of PCs, calibration mode.
- ssq = PCA variance information, calibration mode.
- u = x-block loadings, calibration mode.
- sampscales = random scaling used on the samples, calibration mode.
- msg = warning message, calibration mode.
- options = modified options structure, calibration mode.
- yhat = predicted y values, prediction mode.
Options
options = a structure with the following fields:
- pathvar: [ {0.2} ] standard deviation for random multiplicative scaling. A value of zero will disable the random sample scaling but may increase model sensitivity to scaling errors,
- useoffset: [ {'off'} | 'on' ] flag determining use of offset term in regression equations (may be necessary for mean-centered x-block),
- display: [ 'off' | {'on'} ] governs level of display to command window,
- plots: [ {'none'} | 'intermediate' ] governs level of plotting,
- algorithm: [ {'direct'} | 'empirical' ] governs solution algorithm. Direct solution is fastest and most stable. Only empirical will work on single-factor models when useoffset is 'on', and
- tolerance: [ {5e-5} ] extent of predictions and raw residuals included in model. 'standard' only uses y-block, and 'all' uses x- and y-blocks, and
- maxiter: [ {100} ] maximum number of iterations.