Histogram Matching (HM) is a reference based normalisation that aims to match the histogram created from a experimental spectra with that made from a reference spectra.

hmNorm(
  X,
  noi,
  int_binwid = 0.1,
  alpha = c(0.1, 2),
  use_median = NULL,
  tol = 1e-05
)

Arguments

X

A numerical matrix containing the NMR spectra to be normalised. Rows should be the spectra and columns being the chemical shift variables

noi

The array of maximum noise estimations produced from the function noise() or provided by the user. Must match X rows.

int_binwid

This argument dictates the width of the bins. The average span of intensities is from 10-30, meaning that an intensity_binwidth of 0.1 would give you 200 bins.

alpha

The lower and upper bounds that the golden selection search will search between

use_median

This argument dictates whether the function will calculate the median and use that as the reference spectrum or not. If set to FALSE, the first sample will be used as the reference. This practice is outlined in the methods paper (see 'See also')

tol

This defines the tolerance or level of precision the golden selection search will search until. (i.e., it will search until the bounds are tol distance apart)

Value

This function assigns the normalised X argument (as X_hm) and the calculated dilution factors (as dilf_hm) to the global environment.

Details

hmNorm() works by selecting range of values to scale X by and then uses a golden selection search to find the value that makes the X overlap the most with the reference spectra.

See also

Other Reference-Based: pqNorm(), q2Norm(), xfNorm()

Author

kylebario1@gmail.com

Examples

# it is mandatory to fill args X, noi, and use_median for `hmNorm()` to work. data(X, noi) hmNorm(X, noi, use_median = TRUE, alpha = c(0.1, 2.5))
#> Prepping the spectra #> Using the median spectra as reference #> Calculating the dilfs... Done. #> Normalising X... Done. #>
cat(dilf_hm)
#> 2.499799 1.254311