Type: | Package |
Title: | Phase Error Correction and Baseline Correction for One Dimensional ('1D') 'NMR' Data |
Version: | 1.0.7 |
Maintainer: | Aixiang Jiang <aijiang@bccrc.ca> |
Depends: | R (≥ 4.3.0) |
Suggests: | knitr, rmarkdown, ggpubr, conflicted |
VignetteBuilder: | knitr |
Imports: | stats, baseline, splines, MassSpecWavelet, signal |
Description: | There are three distinct approaches for phase error correction, they are: a single linear model with a choice of optimization functions, multiple linear models with optimization function choices and a shrinkage-based method. The methodology is based on our new algorithms and various references (Binczyk et al. (2015) <doi:10.1186/1475-925X-14-S2-S5>,Chen et al. (2002) <doi:10.1016/S1090-7807(02)00069-1>, de Brouwer (2009) <doi:10.1016/j.jmr.2009.09.017>, Džakula (2000) <doi:10.1006/jmre.2000.2123>, Ernst (1969) <doi:10.1016/0022-2364(69)90003-1>, Liland et al. (2010) <doi:10.1366/000370210792434350>). |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-06-23 20:07:47 UTC; aijiang |
Author: | Aixiang Jiang |
Repository: | CRAN |
Date/Publication: | 2025-06-24 08:00:12 UTC |
MPC_AAM
Description
Multiple single linear models that minimize absolute area.
Usage
MPC_AAM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data. |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is used to process phase error correction through multiple single linear models that minimize absolute area, followed by polynomial baseline correction when necessary.
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
de Brouwer, H. (2009). Evaluation of algorithms for automated phase correction of NMR spectra. J Magn Reson, 201, 230-238.
Dzakula, Z. (2000). Phase angle measurement from peak areas (PAMPAS). J Magn Reson, 146, 20-32.
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
mpc_aam_phased1 <- MPC_AAM(fdat$frequency_domain)
MPC_ADSM
Description
Multiple single linear models that minimize the absolute total dispersion.
Usage
MPC_ADSM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data. |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is used to process phase error correction through multiple single linear models that minimize the absolute total dispersion, followed by polynomial baseline correction when necessary.
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Jiang, A. (2024). Phase Error Correction in Magnetic Resonance: A Review of Models, Optimization Functions, and Optimizers in Traditional Statistics and Neural Networks. Preprints. https://doi.org/10.20944/preprints202409.2252.v1
Chen, L., Weng, Z., Goh, L., & Garland, M. (2002). An efficient algorithm for automatic phase correction of NMR spectra based on entropy minimization. Journal of Magnetic Resonance, 158, 1-2.
Ernst, R. R. (1969). Numerical Hilbert transform and automatic phase correction in magnetic resonance spectroscopy. Journal of Magnetic Resonance, 1, 7-26
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
mpc_dsm_phased1 <- MPC_ADSM(fdat$frequency_domain)
MPC_DANM
Description
Multiple linear models that minimize the difference between absolute area and net area.
Usage
MPC_DANM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction. |
Details
This function processes phase error correction through multiple linear models that minimize the difference between absolute area and net area, followed by polynomial baseline correction when necessary.
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
mpc_danm_phased1 <- MPC_DANM(fdat$frequency_domain)
MPC_DSM
Description
Multiple single linear models that minimize the total dispersion.
Usage
MPC_DSM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data. |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is used to process phase error correction through multiple single linear models that minimize the total dispersion, followed by polynomial baseline correction when necessary.
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Binczyk, F., Tarnawski, R., & Polanska, J. (2015). Strategies for optimizing the phase correction algorithms in Nuclear Magnetic Resonance spectroscopy. Biomedical Engineering Online, 14 Suppl 2(Suppl 2), S5. https://doi.org/10.1186/1475-925X-14-S2-S5
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
mpc_dsm_phased1 <- MPC_DSM(fdat$frequency_domain)
MPC_EMP
Description
Multiple single linear models based on entropy minimization with negative peak penalty.
Usage
MPC_EMP(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data. |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is used to process phase error correction through multiple single linear models with entropy minimization with negative peak penalty, followed by polynomial baseline correction when necessary.
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Binczyk F, Tarnawski R, Polanska J (2015) Strategies for optimizing the phase correction algorithms in Nuclear Magnetic Resonance spectroscopy. Biomed Eng Online 14 Suppl 2:S5.
de Brouwer, H. (2009). Evaluation of algorithms for automated phase correction of NMR spectra. J Magn Reson, 201, 230-238.
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
mpc_emp_phased1 <- MPC_EMP(fdat$frequency_domain)
NLS
Description
Non-linear shrinkage
Usage
NLS(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data. |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is used to process phase error correction through non-linear shrinkage, followed by Polynomial baseline correction when necessary.
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
nls_phased1 <- NLS(fdat$frequency_domain)
NMRphasing
Description
Phase error correction wrap up function
Usage
NMRphasing(
specDatIn,
absorptionOnly = FALSE,
method = c("NLS", "MPC_DANM", "MPC_EMP", "MPC_AAM", "MPC_DSM", "MPC_ADSM", "SPC_DANM",
"SPC_EMP", "SPC_AAM", "SPC_DSM", "SPC_ADSM"),
withBC = TRUE
)
Arguments
specDatIn |
Input spectrum data, which can be one of the four formats: a vector of absorption spectrum; a complex vector; a data matrix or a data frame with two columns of spectrum data, which 1st column is for absorption spectrum, and 2nd column is for dispersion spectrum |
absorptionOnly |
A logical variable to tell us if specDatIn is a a vector of absorption specrtrum, default is false |
method |
One of phase correction and baseline correction methods. There are eleven available choices, which are "NLS", "MPC_DAOM", "MPC_EMP", "MPC_AAM", "MPC_DSM", "MPC_ADSM", "SPC_DAOM", "SPC_EMP", "SPC_AAM", "SPC_DSM", "SPC_ADSM", with "NLS", non-linear shrinkage as default. |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This is a wrap function to process phase error correction and baseline correction with eleven different choices.
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Jiang, A. (2024). Phase Error Correction in Magnetic Resonance: A Review of Models, Optimization Functions, and Optimizers in Traditional Statistics and Neural Networks. Preprints. https://doi.org/10.20944/preprints202409.2252.v1
Binczyk F, Tarnawski R, Polanska J (2015) Strategies for optimizing the phase correction algorithms in Nuclear Magnetic Resonance spectroscopy. Biomed Eng Online 14 Suppl 2:S5.
Chen L, Weng Z, Goh L, Garland M (2002) An efficient algorithm for automatic phase correction of NMR spectra based on entropy minimization. J Magn Reson 158:164–168.
de Brouwer H (2009) Evaluation of algorithms for automated phase correction of NMR spectra. J Magn Reson 201:230–238.
Džakula Ž (2000) Phase Angle Measurement from Peak Areas (PAMPAS). J Magn Reson 146:20–32.
Ernst RR (1969) Numerical Hilbert transform and automatic phase correction in magnetic resonance spectroscopy. J Magn Reson 1969 1:7–26.
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
nls_phased <- NMRphasing(specDatIn = fdat$frequency_domain, method = "NLS")
SPC_AAM
Description
A single linear model with minimization on absolute area.
Usage
SPC_AAM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is to process phase error correction through a single linear model with minimization on absolute area, followed by polynomial baseline correction if necessary
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
de Brouwer, H. (2009). Evaluation of algorithms for automated phase correction of NMR spectra. J Magn Reson, 201, 230-238.
Dzakula, Z. (2000). Phase angle measurement from peak areas (PAMPAS). J Magn Reson, 146, 20-32.
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
spc_aam_phased1 <- SPC_AAM(fdat$frequency_domain)
SPC_DSM
Description
A single linear model with absolute dispersion summation minimization.
Usage
SPC_ADSM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is to process phase error correction through a single linear model with absolute dispersion summation minimization, followed by polynomial baseline correction if necessary
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Jiang, A. (2024). Phase Error Correction in Magnetic Resonance: A Review of Models, Optimization Functions, and Optimizers in Traditional Statistics and Neural Networks. Preprints. https://doi.org/10.20944/preprints202409.2252.v1
Chen, L., Weng, Z., Goh, L., & Garland, M. (2002). An efficient algorithm for automatic phase correction of NMR spectra based on entropy minimization. Journal of Magnetic Resonance, 158, 1-2.
Ernst, R. R. (1969). Numerical Hilbert transform and automatic phase correction in magnetic resonance spectroscopy. Journal of Magnetic Resonance, 1, 7-26 Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
spc_dsm_phased1 <- SPC_ADSM(fdat$frequency_domain)
SPC_DANM
Description
A single linear model with Minimization of difference between absolute area and net area
Usage
SPC_DANM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is to process phase error correction through a single linear model with minimization of difference between absolute area and net area, followed by polynomial baseline correction if necessary
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
spc_danm_phased1 <- SPC_DANM(fdat$frequency_domain)
SPC_DSM
Description
A single linear model with dispersion summation minimization.
Usage
SPC_DSM(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is to process phase error correction through a single linear model with dispersion summation minimization, followed by polynomial baseline correction if necessary
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Binczyk, F., Tarnawski, R., & Polanska, J. (2015). Strategies for optimizing the phase correction algorithms in Nuclear Magnetic Resonance spectroscopy. Biomedical Engineering Online, 14 Suppl 2(Suppl 2), S5. https://doi.org/10.1186/1475-925X-14-S2-S5
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
spc_dsm_phased1 <- SPC_DSM(fdat$frequency_domain)
SPC_EMP
Description
A single linear model with entropy minimization with negative peak penalty
Usage
SPC_EMP(specdat, withBC = TRUE)
Arguments
specdat |
A complex number vector of observed frequency domain data |
withBC |
A logical parameter that enables/disables baseline correction after baseline correction |
Details
This function is to process phase error correction through a single linear model with entropy minimization with negative peak penalty, followed by polynomial baseline correction if necessary
Value
A numeric vector of phase corrected absorption spectrum
Author(s)
Aixiang Jiang
References
Binczyk F, Tarnawski R, Polanska J (2015) Strategies for optimizing the phase correction algorithms in Nuclear Magnetic Resonance spectroscopy. Biomed Eng Online 14 Suppl 2:S5.
de Brouwer, H. (2009). Evaluation of algorithms for automated phase correction of NMR spectra. J Magn Reson, 201, 230-238.
Liland KH, Almøy T, Mevik B (2010), Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra, Applied Spectroscopy 64, pp. 1007-1016.
Examples
data("fdat")
mpc_emp_phased1 <- SPC_EMP(fdat$frequency_domain)
This is an example data in NMRphasing
Description
This dataset contains sample data for NMRphasing.
Usage
fdat
Format
A data frame with two columns, one is for NMR data in complex format, the other one is ppm
Author(s)
Aixiang Jiang