do_msc: Perform MSC

View source: R/gen_coreDataManip.r

do_mscR Documentation

Perform MSC

Description

Performs MSC (multiplicative scatter correction) on the provided dataset.

Usage

do_msc(dataset, ref = NULL, extMscModel = NULL, exportModel = FALSE)

Arguments

dataset

An object of class 'aquap_data" as produced by gfd or as can be extracted from a 'cube' via getcd.

ref

An object of class 'aquap_data' containing a single spectrum, i.e. a single row (as e.g. produced by do_avg, or by subscripting via '[]'). If no reference is provided, the average of all spectra of the provided dataset is used as a reference for the baseline correction.

extMscModel

Provide an external msc model to use this for predicting the data instead of running msc on the data. Experimental feature.

exportModel

Logical. If a possible model should be stored in the set, (leave at FALSE).

Details

If no reference is provided, the average of all spectra of the provided dataset is used as a reference for the baseline correction. Provide a dataset with a single spectrum (as e.g. produced by do_avg) to use this as a reference for baseline correction. Internally, the function msc is used.

Value

Returns the dataset with the transformed NIR data.

See Also

ssc for sub-selecting in a datset using a specific criterion.

getcd

Other Data pre-treatment functions: [,aquap_data-method, do_addNoise(), do_avg(), do_blowup(), do_detrend(), do_emsc(), do_gapDer(), do_resampleNIR(), do_sgolay(), dpt_modules, selectWls(), ssc()

Other dpt modules documentation: do_detrend(), do_emsc(), do_gapDer(), do_sgolay(), do_snv(), dpt_modules

Examples

## Not run: 
fd <- gfd() # get the full dataset
fd <- selectWls(fd, 1100, 1800)
fd_msc <- do_msc(fd)
plot(fd - fd_msc, pg.where="", pg.main="| msc subtracted")
fd_msc_ref <- do_msc(fd, ref=fd[4]) # use the 4th row of fd as a reference
plot(fd - fd_msc_ref, pg.where="", pg.main="| 4th row as reference")
fd_msc_mq <- do_msc(fd, ref=do_avg(ssc(fd, C_Group=="MQ"))) # is assuming the 
# existence of a column name "C_Group" and one or more of its values being "MQ"
plot(fd - fd_msc_mq, pg.where="", pg.main="| average of MQ as reference")

## End(Not run)

bpollner/aquap2 documentation built on March 29, 2024, 7:33 a.m.