View source: R/char_thresh_global.R
| char_thresh_global | R Documentation |
Determines a single threshold applied uniformly across the entire record.
The noise component of C_peak is modelled as a zero-mean Gaussian
(residuals), a one-mean Gaussian (ratios), or via a Gaussian mixture
model (GMM). Mirrors CharThreshGlobal.m from the MATLAB v2.0
codebase.
char_thresh_global(
charcoal,
pretreatment,
peak_analysis,
site = NULL,
results = NULL,
plot_data = 0L,
bkg_sens_in = 0L
)
charcoal |
Named list containing |
pretreatment |
Named list with |
peak_analysis |
Named list with |
site |
Character string (site name; unused in R, kept for API symmetry). |
results |
Named list (unused in R, kept for API symmetry). |
plot_data |
0/1 flag; ignored in R. |
bkg_sens_in |
0/1 flag; ignored in R (no sensitivity loop). |
## Gaussian assumption (threshMethod = 2)
For residuals (cPeak = 1): noise is zero-mean; sigma is estimated
from the negative half of C_peak, mirrored and pooled.
For ratios (cPeak = 2): noise is one-mean; values are shifted to
zero, mirrored, shifted back, and sigma estimated from the pooled set.
## GMM (threshMethod = 3)
MATLAB's GaussianMixture(X, 2, 2, false) is replicated by
gaussian_mixture_em(X) from utils_gaussian_mixture.R, using
the same first/last-point initialisation and loose convergence criterion as
the original Bowman CLUSTER EM. The noise component is identified as the
Gaussian with the smaller mean (matching MATLAB's
noiseIdx = find(mu == min(mu), 1)).
## Bin-lookup for threshold values
Percentile thresholds are mapped to the nearest bin in
possible (251 equally-spaced values spanning C_peak range).
The v2.0 bug fix is preserved: both sides of the abs() comparison
use the CHAR-unit threshold value thresh[i], not the raw percentile.
Named list char_thresh with elements:
Numeric vector of 251 candidate threshold bins.
Numeric matrix [N x 4]: positive threshold for each of the
four threshValues.
Numeric matrix [N x 4] (method 1) or [N x 1] (methods 2-3): negative threshold.
Estimated noise PDF evaluated at possible
(methods 2-3), or scalar -99 (method 1).
Fitted noise-component mean.
Fitted noise-component standard deviation.
Signal-to-noise index (scalar).
Sentinel vector (-999, length N).
[char_thresh_local()], [char_smooth()], [CharAnalysis()]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.