R: Identification of optimal reference

bestref {ptw} | R Documentation

## Identification of optimal reference

### Description

This function calculates a similarity matrix and returns the sample number that is most similar to all other samples. This is possibly preferable as a reference sample since warping then may be kept to a minimum. Either RMS or WCC may be used as similarity functions.

### Usage

    bestref(x, optim.crit = c("WCC", "RMS"),
                   trwdth=20, wghts = NULL, smooth.param = 0)

### Arguments

`x` | data matrix or array of signals, specified row-wise. In case of an array, the third dimension should differentiate between the different samples
`optim.crit` | either `"WCC"` or `"RMS"`
`trwdth` | the width of the triangle in the WCC criterion, given as a number of data points. Default: 20
`wghts` | Optional weights vector in the WCC criterion; will be calculated from the triangle width if necessary. Sometimes it is more efficient to pre-calculate it and give it as an argument
`smooth.param` | smoothing parameter for smoothing the signal when `optim.crit` equals `"RMS"`. If no smoothing is required, set this to 0

### Value

A list containing two elements:

`best.ref` | the index of the best reference(s)
`crit.values` | the qualities as measured by either RMS or WCC

### Author(s)

Jan Gerretzen, Ron Wehrens

### Examples

    data(gaschrom)
    bestref(gaschrom)
    bestref(gaschrom, optim.crit = "WCC", trwdth = 50)
    bestref(gaschrom, optim.crit = "RMS")
    bestref(gaschrom, optim.crit = "RMS", smooth.param = 1e5)

[Package ptw version 1.9-12 Index]