table1: Retrieve table 1 from Fernandez et al. (2022)

View source: R/table_sensAnalysis_4and5.R

table1R Documentation

Retrieve table 1 from Fernandez et al. (2022)

Description

This function returns values for table 1 in Fernandez et al.(2022): Evaluation of four critical nitrogen dilution curves (CNDC) models fitted with the Bayesian approach using four types of datasets: (All data or only Wmax achieved data) ✕ (unweighted or variance-weighted data model).

Usage

multi_metrics(data, truth, estimate, na_rm = TRUE, case_weights = NULL, ...)

table1()

Details

The four models were compared based on model parameters: 1. Posterior distributions for a (A1) and b (A2) are averaged to obtain posterior medians and credibility intervals from all the samples. 2. Then, they are used to estimate NNI values across an independent validation set of observations and compared against the reference curve by Plenet and Lemaire (2000). 3. Error metrics for the agreement between NNI estimated and reference are calculated using the metrica:: library. 4. Deviance information criterion (DIC) is retrieved for each model.

Examples

## Not run: 
Compare DIC of models ---------------------------------------------
dicSens_4and5 <- data_frame(Method = c("Unweighted-Wmax", "Unweighted-Wall", "Weighted-Wmax",
"Weighted-Wall"))  %>%
  mutate(DIC = case_when(
    Method == "Unweighted-Wmax" ~ dic_4[[1]][[1]]  %>%  sum(),
    Method == "Unweighted-Wall" ~ dic_4[[2]][[1]]  %>%  sum(),
    Method == "Weighted-Wmax" ~ dic_5[[1]][[1]]  %>%  sum(),
    Method == "Weighted-Wall" ~ dic_5[[2]][[1]]  %>%  sum(),
    TRUE ~ NA_real_
  ))  %>%
  mutate_if(is.double, .funs = ~ round(digits = 0, x = .))

## End(Not run)

jafernandez01/cndcR documentation built on Oct. 26, 2022, 5:24 a.m.