Frpcrengine
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.