| specproc-tidy-models | R Documentation |
tidy() lists the estimates of a chemometric model in a long tibble, and
glance() summarizes the model in a one-row tibble, following the
conventions of the broom package. Through parsnip, they also apply to the
fitted models and workflows of the "rsimpls", "lts", "rsimca" and
"mcd" engines.
## S3 method for class 'specproc_robpca'
tidy(x, matrix = "eigenvalues", ...)
## S3 method for class 'specproc_robpca'
glance(x, ...)
## S3 method for class 'specproc_rsimpls'
tidy(x, matrix = "coefficients", ...)
## S3 method for class 'specproc_rsimpls'
glance(x, ...)
## S3 method for class 'specproc_rpcr'
tidy(x, matrix = "coefficients", ...)
## S3 method for class 'specproc_rpcr'
glance(x, ...)
## S3 method for class 'specproc_lts'
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
## S3 method for class 'specproc_lts'
glance(x, ...)
## S3 method for class 'specproc_rsimca'
tidy(x, ...)
## S3 method for class 'specproc_rsimca'
glance(x, ...)
## S3 method for class 'specproc_robust_da'
tidy(x, ...)
## S3 method for class 'specproc_robust_da'
glance(x, ...)
## S3 method for class 'specproc_opls'
tidy(x, matrix = "coefficients", ...)
## S3 method for class 'specproc_opls'
glance(x, ...)
## S3 method for class 'specproc_som'
tidy(x, ...)
## S3 method for class 'specproc_som'
glance(x, ...)
## S3 method for class 'specproc_wavelength_selection'
tidy(x, ...)
## S3 method for class 'specproc_wavelength_selection'
glance(x, ...)
## S3 method for class 'specproc_nas'
tidy(x, ...)
## S3 method for class 'specproc_nas'
glance(x, ...)
## S3 method for class 'specproc_domain'
tidy(x, ...)
## S3 method for class 'specproc_domain'
glance(x, ...)
x |
An object returned by |
matrix |
The table to return (see Details). |
... |
Not used. |
conf.int |
A logical: add the confidence interval ( |
conf.level |
The confidence level of the interval. Default is 0.95. |
tidy() returns, choosing the table with matrix when a model has
several:
robust PCA (robpca(), rospca(), macropca(), cellpca()):
"eigenvalues" (default), one row per component PC with its
eigenvalue and std.dev; "loadings", the value of each variable
(column) on each PC; "scores", the value of each observation
(row) on each PC, as tidy() of a prcomp object in broom (whose
names of the tables are also accepted, such as "rotation" and
"x");
rsimpls() and rpcr(): "coefficients" (default), the estimate
of each term (the intercept and the variables) for each response,
in the units of the responses; "components", the robust r.squared
and the rmse of the models with 1 to ncomp_max components (ncomp);
"loadings" and "scores", as for robust PCA;
lts_fit(): the term, estimate, std.error, statistic and
p.value of the reweighted least-squares fit, and, with
conf.int = TRUE, its confidence interval (conf.low, conf.high);
rsimca() and robust_da(): one row per class, with its prior,
the number n of its regular observations and their misclassification
rate error, and, for RSIMCA, its number of components ncomp and the
cutoffs of the score and orthogonal distances (cutoff.sd,
cutoff.od);
opls(): "coefficients" (default), the estimate of each term
(variable) with its vip and ortho.vip; "components", the
explained variances r2x, r2y and q2 of each component, their
cumulative values (r2x.cum, ...) and their significance;
som(): one row per unit of the map, with its row and col in
the grid, its position (x, y), the number n of observations it
represents and their mean quantization error qe;
select_wavelengths(): one row per variable (term), with its
importance, whether it is selected, and, for iPLS, its interval;
nas(): the regression vector, the estimate of each term;
applicability_domain(): one row per component PC of the PCA, with
its std.dev, percent of the variance and cumulative percent (as
fractions).
glance() returns the number of observations nobs and of variables
nvar, and:
robust PCA: the number of components ncomp, h, alpha, the cutoffs
cutoff.sd and cutoff.od, the numbers of n.good.leverage,
n.orthogonal.outlier and n.bad.leverage observations, the number
of flagged.cells (MacroPCA and cellPCA) and the method;
rsimpls() and rpcr(): ncomp, ncomp_max, h, alpha, the robust
r.squared, the robust scale of the residuals sigma (one response),
the numbers of n.good.leverage, n.vertical.outlier and
n.bad.leverage observations, the method and, for RPCR, the
regression;
lts_fit(): the robust r.squared, the robust scale of the residuals
sigma, df.residual, alpha and the number of n.outliers (weight
0 in the reweighted fit);
rsimca() and robust_da(): the number of n.classes, the overall
misclassification rate error, alpha, the number of observations
left out (n.outliers; for RSIMCA, those outlying for all classes) and
the method;
opls(): the numbers of predictive and orthogonal components
(ncomp, ncomp.ortho), r2x.cum, r2y.cum, q2.cum, rmsee and,
after a permutation test, its p-values p.r2y and p.q2;
som(): the number of n.units, the topology, the
quantization.error and topographic.error of the map, the number of
n.novel observations (beyond the cutoff of the quantization error),
the epochs and whether the map is robust;
select_wavelengths(): the method, ncomp, the number of selected
variables n.selected, robust, the threshold and, for iPLS, the
rmsecv of the final model;
nas(): the method, ncomp and the figures of merit
(sensitivity, selectivity and, with a noise level,
analytical.sensitivity, lod and loq);
applicability_domain(): the number of components ncomp, the variance
explained, the conf.level and the limits t2.limit and q.limit.
A tibble.
Christian L. Goueguel
specproc-tidy for the fits, calibrations and plasma diagnostics
data(forageLIBS)
wl <- as.numeric(names(forageLIBS[-(1:14)]))
spectra <- forageLIBS[-(1:14)][, wl > 380 & wl < 430]
set.seed(1)
fit <- rsimpls(spectra[1:300, ], forageLIBS$Ca[1:300], ncomp = 4)
tidy(fit, matrix = "components")
glance(fit)
# the regression vector, one row per wavelength
head(tidy(fit))
pca <- robpca(spectra, ncomp = 3)
tidy(pca)
glance(pca)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.