Skip to contents

irp_klason_lignin_2 predicts the Klason lignin content from mid infrared spectra for peat samples using the model model_klason_lignin_2. This function may also work for organic matter in general. Note that this is a preliminary model only which has not been fully validated for peat samples yet and which has known limitations in predicting contents for peat samples (Teickner and Knorr 2022) .

Usage

irp_klason_lignin_2(x, ..., do_summary = FALSE)

Arguments

x

An object of class ir. 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.

...

Additional arguments passed to rstanarm::posterior_predict.stanreg().

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 with draws from the posterior distribution, including the residual variance of the model.

  • If do_summary = TRUE, each element is a quantities::quantities() object with the error attribute being the standard deviation of the unsummarized values.

Value

x with a new column "klason_lignin_2" with the predicted Klason lignin contents [g/g].

Note

Note that this is a preliminary model only which has not been fully validated for peat samples yet and which has known limitations in predicting contents for peat samples (Teickner and Knorr 2022) .

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 and methods. doi:10.5194/soil-2022-27 .

Examples

library(ir)

irp_klason_lignin_2(ir::ir_sample_data[1, ], do_summary = TRUE)
#> # A tibble: 1 × 8
#>   id_measurement id_sample sample_type sample_comment       klason_lignin
#> *          <int> <chr>     <chr>       <chr>                          [1]
#> 1              1 GN 11-389 needles     Abies Firma Momi fir         0.360
#> # … with 3 more variables: holocellulose [1], spectra <named list>,
#> #   klason_lignin_2 (err) [g/g]