# Frpcr

### Purpose

Full-ratio PCR calibration and prediction.

### Synopsis

- model = frpcr(x,y,ncomp,
*options*) %calibration - pred = frpcr(x,model,
*options*) %prediction - valid = frpcr(x,y,model,
*options*) %validation

Please note that the recommended way to build a Full-ratio PCR model from the command line is to use the Model Object. Please see this wiki page on building models using the Model Object.

### Description

FRPCR calculates a single full-ratio 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 absolute scaling errors.

NOTE: For best results, the x-block should not be mean-centered.

Inputs are `x` the predictor block (2-way array or dataset object), `y` the predicted block (2-way array or dataset object), `ncomp` the number of components to to be calculated (positive integer scalar) and the optional options structure, *options*.

The output of the function is a standard model structure `model`. In prediction and validation modes, the same model structure is used but predictions are provided in the `model.detail.pred` field.

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

#### Inputs

**x**= input x-block (should not be mean-centered), 2-way double array or dataset object.**y**= input y-block, 2-way double array or dataset object, calibration and validation modes.**ncomp**= number of components, calibration mode.**model**= existing model, prediction and validation modes.

#### Outputs

**model**= model generated in calibration mode.**pred**= prediction results, prediction mode.**valid**= validation results, validation 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' | 'final' ] governs level of plotting,

**preprocessing**: {[ ] [ ]} cell of two preprocessing structures (see PREPROCESS) defining preprocessing for the x- and y-blocks.

**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

**blockdetails**: [ 'compact' | {'standard'} | 'all' ] level of detail (predictions, raw residuals, and calibration data) included in the model.

- ‘Standard’ - the predictions and raw residuals for the X-block as well as the X-block itself are not stored in the model to reduce its size in memory. Specifically, these fields in the model object are left empty: 'model.pred{1}', 'model.detail.res{1}', 'model.detail.data{1}'.
- ‘Compact’ = for this function, 'compact' is identical to 'standard'.
- 'All' = keep predictions, raw residuals for both X- & Y-blocks as well as the X- & Y-blocks themselves.

**confidencelimit**: [ {'0.95'} ] Confidence level for Q and T2 limits. A value of zero (0) disables calculation of confidence limits.

In addition, there are several options relating to the algorithm. See FRPCRENGINE.