Predicts sample properties from attenuated total reflection mid-infrared spectra
irp-predict-atr-mir.RdFunctions to predict peat properties from attenuated total reflection (ATR) mid-infrared spectra. All functions below have been computed using various organic matter samples. For detailed information on the underlying prediction models, see the details section.
Usage
irp_holocellulose_content_2(
x,
...,
do_summary = FALSE,
summary_function_mean = mean,
summary_function_sd = stats::sd,
return_as_list = FALSE,
check_prediction_domain = "train"
)
irp_klason_lignin_content_2(
x,
...,
do_summary = FALSE,
summary_function_mean = mean,
summary_function_sd = stats::sd,
return_as_list = FALSE,
check_prediction_domain = "train"
)Arguments
- x
An object of class
irwith transmission mid infrared spectra. Some tests are applied to check if the supplied spectra match the spectra used to fit the models (the spectral range is checked). The spectral resolution of the original spectral data should not be smaller than 4 cm\(^{-1}\) and it is not checked if this assumption is met. For the following models,xhas special meaning:irp_microbial_nitrogen_content_1()Here,
xis a set of litter spectra after decomposition (andyis a set of litter spectra before decomposition). See the Details section.
- ...
Additional arguments passed to
rstanarm::posterior_predict.stanreg()(irp_eac_1(),irp_eac_2()).- do_summary
A logical value indicating if the predicted values should be returned in a summarized version (
TRUE) or not (FALSE).If
do_summary = FALSE, a list column is returned and each element of the list column is a numeric vector, or anrvarobject is returned as column inx, depending on the value ofreturn_as_list. In both cases, the column contains draws from the posterior predictive distribution.If
do_summary = TRUE, each element is aquantities::quantities()object with value and error summarized from posterior draws viasummary_function_meanandsummary_function_sd
- summary_function_mean
A function used to summarize the predicted values (average).
- summary_function_sd
A function used to summarize the predicted values (spread).
- return_as_list
Logical value. If set to
TRUE, the result will be returned as list of draws, otherwise the result will be returned asrvarobject.- check_prediction_domain
A character value indicating if and how it should be checked whether the spectra in
xare within the prediction domain of the model. One of:"train"It is checked whether the spectra in
xare within the prediction domain formed by the training data for the model."test"It is checked whether the spectra in
xare within the prediction domain formed by the testing data for the model."none"It is not checked whether the spectra in
xare within the prediction domain for the model.
Details
The models use the models of the same name in the 'irpeatmodels' package. The 'irpeatmodels' package provides information on the models.
References
Teickner H, Knorr K (2022). “Improving Models to Predict Holocellulose and Klason Lignin Contents for Peat Soil Organic Matter with Mid-Infrared Spectra.” SOIL, 8(2), 699–715. doi:10.5194/soil-8-699-2022 .
Examples
library(ir)
x <- ir::ir_sample_data[1, ]
## make predictions
# holocellulose content
x <- irpeat::irp_holocellulose_content_2(
x,
do_summary = TRUE,
check_prediction_domain = "train"
)
# Klason lignin content
x <- irpeat::irp_klason_lignin_content_2(
x,
do_summary = TRUE,
check_prediction_domain = "train"
)