| specproc-tidy | R Documentation |
tidy() summarizes the estimates of a fit, a calibration or a plasma
diagnostic in a tibble, one row per estimate, and glance() summarizes
the fit in a one-row tibble, following the conventions of the broom
package. The tibbles of several spectra or samples can then be bound
together.
## S3 method for class 'specproc_peak_fit'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'specproc_peak_fit'
glance(x, ...)
## S3 method for class 'specproc_calibration'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'specproc_calibration'
glance(x, ...)
## S3 method for class 'specproc_wavelength_calibration'
tidy(x, ...)
## S3 method for class 'specproc_wavelength_calibration'
glance(x, ...)
## S3 method for class 'specproc_slope_bias'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'specproc_slope_bias'
glance(x, ...)
## S3 method for class 'specproc_boltzmann'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'specproc_boltzmann'
glance(x, ...)
## S3 method for class 'specproc_cflibs'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'specproc_cflibs'
glance(x, ...)
## S3 method for class 'specproc_uncertainty'
tidy(x, ...)
## S3 method for class 'specproc_uncertainty'
glance(x, ...)
## S3 method for class 'specproc_curve_of_growth'
tidy(x, ...)
## S3 method for class 'specproc_curve_of_growth'
glance(x, ...)
x |
A peak fit, or an object returned by |
conf.int |
A logical: add the confidence interval ( |
conf.level |
The confidence level of the interval. Default is 0.95. |
... |
Not used. |
tidy() returns the columns term, estimate and std.error, with the
statistic and p.value of a t test where one applies, and, with
conf.int = TRUE, the bounds conf.low and conf.high of the
confidence interval at conf.level:
a peak fit (an element of the fit column of peak_fit() or
multipeak_fit()): the parameters of each line and the common shifts,
as in tidied; the test is that of a zero value;
calibration_curve(): the intercept, slope and quadratic term,
with the test of a zero value;
wavelength_calibration(): the coefficients of the polynomial
correction of each segment, in powers of the wavelength minus the
center of the segment (nm), without standard errors;
slope_bias(): the bias and slope, with the test of no
correction (a bias of 0, a slope of 1);
boltzmann() and saha_boltzmann(): the temperature (K) and the
intercept of the plot; the interval of the temperature is that of
the slope, transformed, so it is not symmetric (its upper bound is
infinite when the interval of the slope reaches zero);
cf_libs(): the temperature (with an interval as above), and the
atomic_fraction and mass_fraction of each element, without
standard errors (see plasma_uncertainty());
plasma_uncertainty(): the same quantities with their Monte Carlo
standard uncertainties, and always their intervals, at the level
of the object;
curve_of_growth(): the column density of each species (term),
with its number of lines (n.lines) and its largest optical depth
(max.optical.depth).
glance() returns:
a peak fit: sigma, the root mean square error rmse, isConv,
finTol, logLik, AIC, BIC, deviance, df.residual and
nobs, as for nls fits in broom (with rmse);
calibration_curve(): nobs, r.squared, sigma, df.residual,
the sensitivity, the critical.value (ISO 11843 only), lod,
loq, the reduced chi.squared of a Deming or York fit, the p-values
of Mandel's test (mandel.p.value) and of the lack-of-fit test
(lack.of.fit.p.value), the regression and the model;
wavelength_calibration(): the number of reference lines n.lines,
of lines used nobs, of n.segments, the degree, and the rmse
and largest absolute residual max.residual of the lines used (nm);
slope_bias(): nobs, the root mean square differences to the
reference before (rmse.before) and after (rmse.after) the
correction, and whether the slope was fitted (slope.fitted);
boltzmann() and saha_boltzmann(): r.squared, sigma, nobs,
df.residual, the range of the abscissa energy.range (eV), the
electron.density and number of iterations (Saha-Boltzmann only),
the method and the units;
cf_libs(): r.squared (about the mean), sigma, nobs,
df.residual (NA when the temperature is given), the numbers of
n.species and n.elements, the electron.density, the number of
iterations, the method and the units;
plasma_uncertainty(): the number of draws n.draws, of failed
draws, the reduced chi.squared of the fit, the level and the
method;
curve_of_growth(): the temperature, the rmse of the fit (on
the log scale), nobs, the scale and the units.
A tibble.
Christian L. Goueguel
specproc-tidy-models for the chemometric models, peak_fit(),
calibration_curve(), boltzmann(), cf_libs(), plasma_uncertainty()
data(forageLIBS)
mean_spectrum <- colMeans(forageLIBS[-(1:14)])
atomic <- data.frame(
species = c(rep("Ca I", 6), rep("Ca II", 4)),
stage = c(rep(1, 6), rep(2, 4)),
wavelength = c(428.301, 430.253, 431.865, 445.478, 612.222, 616.217,
315.887, 317.933, 370.603, 373.690),
Aki = c(4.34e7, 1.36e8, 7.40e7, 8.70e7, 2.87e7, 4.77e7, 3.10e8, 3.60e8, 8.80e7, 1.70e8),
gk = c(5, 5, 3, 7, 3, 3, 4, 6, 2, 2),
Ek = c(4.780, 4.780, 4.769, 4.681, 3.910, 3.910, 7.047, 7.050, 6.468, 6.468)
)
lines <- line_intensities(mean_spectrum, atomic, baseline = TRUE)
fit <- saha_boltzmann(lines, ionization_energy = 6.113, electron_density = 1.9e17)
tidy(fit, conf.int = TRUE)
glance(fit)
# the K I 769.90 nm line, normalized to the C I 247.86 nm line of the matrix
k <- line_intensities(forageLIBS[-(1:14)], c(C = 247.856, K = 769.896), baseline = TRUE)
standards <- data.frame(K = forageLIBS$K,
signal = k$intensity[k$line == "K"] / k$intensity[k$line == "C"])
cal <- calibration_curve(standards, signal, K)
tidy(cal)
glance(cal)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.