Description Usage Arguments Details Value Author(s) References Examples
Warps the frequency xaxis to minimize the pairwise distance between a sample spectrum and a reference spectrum.
1 2 3 4 5 6 7  Warping(Spectrum_data, normalization.type = c("median","mean",
"firstquartile","peak","none"), fromto.normW = c(3.05, 4.05),
reference.choice = c("fixed", "before",
"after", "manual"), reference = 1, optim.crit = c("RMS", "WCC"),
ptw.wp = FALSE, K = 3, L = 40, lambda.smooth = 0, deg = 3,
lambda.bspline = 0.01, kappa = 0.0001, max_it_Bspline = 10,
returnReference = FALSE, returnWarpFunc = FALSE, verbose = FALSE)

Spectrum_data 
Matrix containing the spectra in ppm, one row per spectrum. 
normalization.type 
Type of normalization applied to the spectra prior to warping.
See 
fromto.normW 
Used by 
reference.choice 
Specifies how the reference will be chosen:

reference 
The row number or name of the reference spectrum when 
optim.crit 
If 
ptw.wp 
If set to 
K 
It is the degree of the polynomial used for the warping (see details). 
L 
This is the number of Bsplines that are used for the warping.
It should be either 0 or greater than 
lambda.smooth 
Nonnegative coefficient for the smoothing 
deg 
Degree of the Bsplines. 
lambda.bspline 
Nonnegative secondorder smoothness penalty coefficient for the Bsplines warping. See the reference for more details. 
kappa 
Nonnegative ridge (zeroorder) penalty coefficient for the Bsplines warping. See the reference for more details. 
max_it_Bspline 
Maximum number of iterations for the Bsplines warping. 
returnReference 
If 
returnWarpFunc 
If 
verbose 
If 
When reference.choice
is "after"
, the reference with the minimum sum is taken as the reference and the warped spectra according to this reference (that have already been calculated at this stage) are returned. This is n times slower than the 2 others where n is the number of spectra.
Principle:
We try to find a warping function between a reference spectrum and a sample.
This function is a sum of polynomial of degree K
and L
Bsplines of degree deg
.
The unknowns are the polynomial and Bsplines coefficients.
No warping is equivalent to warping with a, the polynomial identity and all the coefficients of the Bsplines with value 0. See the reference for details.
First, the polynomial is estimated on the reference and the sample both smoothed with parameter lambda.smooth
.
The Bsplines are estimated on the nonsmoothed reference and sample using the polynomial just found.
The higher lambda.bspline
and kappa
are, the less flexible the warping function will be.
If returnReference = TRUE
, the function will return the name of the reference spectrum and if returnWarpingfunc = TRUE
, it will also return the warping functions.
Spectrum_data 
The warped spectra. 
Reference 
The name of the reference spectrum. 
Warpingfunc 
The warping functions. 
Benoît Legat, Manon Martin & Paul H. C. Eilers
Martin, M., Legat, B., Leenders, J., Vanwinsberghe, J., Rousseau, R., Boulanger, B., & Govaerts, B. (2018). PepsNMR for 1H NMR metabolomic data preprocessing. Analytica chimica acta, 1019, 113.
Rousseau, R. (2011). Statistical contribution to the analysis of metabonomics data in 1H NMR spectroscopy (Doctoral dissertation, PhD thesis. Institut de statistique, biostatistique et sciences actuarielles, Université catholique de Louvain, Belgium).
1 2 3 4 5 6 7 8 9 10  require(PepsNMRData)
Warp.spec < Warping(Data_HS_sp$Spectrum_data_HS_8, reference.choice="fixed",
reference = row.names(Data_HS_sp$Spectrum_data_HS_8)[1],
returnReference = FALSE)
#or
Warp.res < Warping(Data_HS_sp$Spectrum_data_HS_8, reference.choice="fixed",
reference = row.names(Data_HS_sp$Spectrum_data_HS_8)[1],
returnReference = TRUE)
Warp.spec < Warp.res[["Spectrum_data"]]
Warp.res[["Reference"]]

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.