prep.alsbasecorr(data, plambda =5, p =0.1, max.niter =10)
Arguments
data: matrix with spectra (rows correspond to individual spectra)
plambda: power of the penalty parameter (e.g. if plambda = 5, lambda = 10^5)
p: assymetry ratio (should be between 0 and 1)
max.niter: maximum number of iterations
Returns
preprocessed spectra.
Details
The function implements baseline correction algorithm based on Whittaker smoother. The method was first shown in [1]. The function has two main parameters - power of a penalty parameter (usually varies betwen 2 and 9) and the ratio of assymetry (usually between 0.1 and 0.001). The choice of the parameters depends on how broad the disturbances of the baseline are and how narrow the original spectral peaks are.
Examples
# take spectra from carbs datasetdata(carbs)spectra = mda.t(carbs$S)# apply the correctionpspectra = prep.alsbasecorr(spectra, plambda =3, p =0.01)# show the original and the corrected spectra individuallypar(mfrow = c(3,1))for(i in1:3){ mdaplotg(list( original = mda.subset(spectra, i), corrected = mda.subset(pspectra, i)), type ="l", col = c("black","red"), lwd = c(2,1), main = rownames(spectra)[i])}