# Mass loss and the carbon budget
# https://tidyecology.com/posts/mass-loss-and-the-carbon-budget/
#
# The R code of this Tidy Ecology tutorial, chunk by chunk, in the order of the post.
# Run it top to bottom in a fresh R session. Code the post shows but does not run
# is commented out. The prose, and the numbers it quotes, are in the post itself.
# Post last modified: 2026-10-14

## ---- setup ----
library(ggplot2)

te_pal <- list(forest = "#275139", green = "#2f8f63", sage = "#93a87f",
               clay = "#b5534e", gold = "#cda23f", line = "#dad9ca",
               ink = "#16241d", paper = "#f5f4ee")

theme_te <- function() {
  theme_minimal(base_size = 12) +
    theme(panel.grid.minor = element_blank(),
          panel.grid.major = element_line(colour = "#e7e6dc"),
          plot.background = element_rect(fill = "#f5f4ee", colour = NA),
          panel.background = element_rect(fill = "#f5f4ee", colour = NA),
          plot.title = element_text(face = "bold", colour = te_pal$ink),
          axis.title = element_text(colour = "#2c3a31"),
          plot.margin = margin(10, 18, 8, 10))
}

f2 <- function(x) sprintf("%.2f", x)
f4 <- function(x) sprintf("%.4f", x)
pc <- function(x) sprintf("%.2f", 100 * x)
pc0 <- function(x) sprintf("%.0f", 100 * x)

## ---- litter ----
f_lab <- 0.62; c_lab <- 0.437; k_lab <- 1.10
f_rec <- 0.38; c_rec <- 0.524; k_rec <- 0.135
c0 <- f_lab * c_lab + f_rec * c_rec

mass_rem <- function(t) f_lab * exp(-k_lab * t) + f_rec * exp(-k_rec * t)
carb_rem <- function(t) c_lab * f_lab * exp(-k_lab * t) + c_rec * f_rec * exp(-k_rec * t)

yr <- c(1, 2, 3)
tab_c <- rbind(dry_mass_remaining = mass_rem(yr),
               carbon_remaining_true = carb_rem(yr),
               carbon_inferred_from_mass = c0 * mass_rem(yr),
               shortfall_per_cent = 100 * (c0 * mass_rem(yr) / carb_rem(yr) - 1),
               carbon_concentration_left = carb_rem(yr) / mass_rem(yr))
colnames(tab_c) <- paste0("year_", yr)
print(round(tab_c, 4))

round(c(labile_fraction_of_mass = f_lab,
        labile_per_cent_of_initial_mass = 100 * f_lab,
        lignified_per_cent_of_initial_mass = 100 * f_rec,
        labile_carbon_concentration = c_lab,
        lignified_carbon_concentration = c_rec,
        labile_rate_per_year = k_lab,
        lignified_rate_per_year = k_rec,
        initial_carbon_concentration = c0,
        concentration_at_five_years = carb_rem(5) / mass_rem(5),
        concentration_rise_per_cent =
          100 * (carb_rem(5) / mass_rem(5) / c0 - 1)), 4)

## ---- fig-carbon ----
tg <- seq(0, 5, by = 0.02)
lev <- c("Dry mass remaining", "Carbon remaining (true)",
         "Carbon inferred from mass", "Shortfall of the inferred carbon")
pan <- c("Left per gram of initial litter (g)",
         "Shortfall of the inferred carbon (per cent)")
shortfall <- function(t) 100 * (1 - c0 * mass_rem(t) / carb_rem(t))

cur <- rbind(
  data.frame(t = tg, y = mass_rem(tg),      series = lev[1], panel = pan[1]),
  data.frame(t = tg, y = carb_rem(tg),      series = lev[2], panel = pan[1]),
  data.frame(t = tg, y = c0 * mass_rem(tg), series = lev[3], panel = pan[1]),
  data.frame(t = tg, y = shortfall(tg),     series = lev[4], panel = pan[2]))
cur$series <- factor(cur$series, levels = lev)
cur$panel  <- factor(cur$panel, levels = pan)

mark <- data.frame(t = 3, y = shortfall(3), panel = factor(pan[2], levels = pan),
                   lab = sprintf("%.2f per cent at 3 years", shortfall(3)))

ggplot(cur, aes(t, y, colour = series, linetype = series)) +
  geom_line(linewidth = 1.05) +
  geom_point(data = mark, aes(t, y), inherit.aes = FALSE, size = 2.6,
             colour = te_pal$ink) +
  geom_text(data = mark, aes(t, y, label = lab), inherit.aes = FALSE,
            hjust = 1.08, vjust = -0.7, size = 3.2, colour = te_pal$ink) +
  facet_wrap(~panel, scales = "free_y") +
  scale_colour_manual(values = c(te_pal$sage, te_pal$forest, te_pal$clay,
                                 te_pal$gold), name = NULL) +
  scale_linetype_manual(values = c(1, 1, 2, 1), name = NULL) +
  scale_x_continuous(limits = c(0, 5.05), breaks = 0:5) +
  guides(colour = guide_legend(nrow = 2)) +
  labs(x = "Years since the bags went out", y = NULL,
       title = "The gap the mass column cannot show you") +
  theme_te() +
  theme(legend.position = "bottom", legend.key.width = unit(2.2, "lines"),
        strip.text = element_text(colour = te_pal$ink, face = "bold",
                                  size = 8.8))

## ---- kfits ----
harv <- c(0.25, 0.5, 1, 1.5, 2, 3, 4, 5)
n_rep <- 5

k_of  <- function(t, y) -coef(lm(log(y) ~ 0 + t))[[1]]
se_of <- function(t, y) summary(lm(log(y) ~ 0 + t))$coefficients[1, 2]

k_mass <- k_of(harv, mass_rem(harv))
k_carb <- k_of(harv, carb_rem(harv) / c0)

round(c(harvest_dates = length(harv),
        bags_per_date = n_rep,
        last_harvest_years = max(harv),
        k_fitted_to_dry_mass = k_mass,
        k_fitted_to_carbon = k_carb,
        carbon_correction_factor = k_carb / k_mass,
        per_cent_the_mass_fit_overstates = 100 * (k_mass / k_carb - 1)), 4)

## ---- contam ----
k_single <- 0.35
a_max <- 0.08; a_rate <- 0.45
sd_bag <- 0.12; sd_ash <- 0.08

soil_on <- function(t) a_max * (1 - exp(-a_rate * t))

set.seed(20260726)
tb <- rep(harv, each = n_rep)
organic  <- exp(-k_single * tb)
raw_mass <- (organic + soil_on(tb)) * exp(rnorm(length(tb), 0, sd_bag))
ash_frac <- pmin((soil_on(tb) / (organic + soil_on(tb))) *
                   exp(rnorm(length(tb), 0, sd_ash)), 0.95)
afdm <- raw_mass * (1 - ash_frac)

k_raw_s  <- k_of(tb, raw_mass)
k_afdm_s <- k_of(tb, afdm)

round(c(true_k = k_single,
        contamination_plateau = a_max,
        bag_weighing_error = sd_bag,
        ash_determination_error = sd_ash,
        k_from_raw_dry_mass = k_raw_s,
        k_from_ash_free_dry_mass = k_afdm_s,
        raw_bias_per_cent = 100 * (k_raw_s / k_single - 1),
        ash_free_bias_per_cent = 100 * (k_afdm_s / k_single - 1),
        standard_error_raw = se_of(tb, raw_mass),
        standard_error_ash_free = se_of(tb, afdm),
        contamination_at_five_years = soil_on(5),
        organic_left_at_five_years = exp(-k_single * 5),
        ash_share_of_the_last_bags =
          soil_on(5) / (exp(-k_single * 5) + soil_on(5))), 4)

## ---- asymptote ----
asym_fit <- function(t, y) {
  ss <- function(p) {
    A <- plogis(p[1]); k <- exp(p[2])
    sum((y - ((1 - A) * exp(-k * t) + A))^2)
  }
  best <- NULL
  for (a0 in c(-4, -2, 0, 1)) for (k0 in log(c(0.08, 0.2, 0.5, 1))) {
    o <- optim(c(a0, k0), ss, control = list(reltol = 1e-12, maxit = 3000))
    if (is.null(best) || o$value < best$value) best <- o
  }
  c(limit_A = plogis(best$par[1]), k = exp(best$par[2]))
}

fit_clean_exact   <- asym_fit(harv, exp(-k_single * harv))
fit_dirty_exact   <- asym_fit(harv, exp(-k_single * harv) + soil_on(harv))
fit_raw_observed  <- asym_fit(tb, raw_mass)
fit_afdm_observed <- asym_fit(tb, afdm)

print(round(rbind(uncontaminated_exact = fit_clean_exact,
                  contaminated_exact = fit_dirty_exact,
                  raw_mass_observed = fit_raw_observed,
                  ash_free_observed = fit_afdm_observed), 4))

sweep_a <- sapply(c(0.00, 0.05, 0.08, 0.12, 0.16, 0.20), function(am) {
  y <- exp(-k_single * harv) + am * (1 - exp(-a_rate * harv))
  ft <- asym_fit(harv, y)
  c(contamination_plateau = am, reported_limit = ft[["limit_A"]],
    reported_k = ft[["k"]])
})
print(round(sweep_a, 4))

## ---- fig-ash ----
pts <- rbind(data.frame(t = tb, y = raw_mass, series = "Raw dry mass"),
             data.frame(t = tb, y = afdm, series = "Ash-free dry mass"))
pts$series <- factor(pts$series, levels = c("Raw dry mass", "Ash-free dry mass"))

A_hat <- fit_raw_observed[["limit_A"]]; k_hat <- fit_raw_observed[["k"]]
lin <- rbind(
  data.frame(t = tg, y = exp(-k_single * tg), series = "True curve (limit zero)"),
  data.frame(t = tg, y = exp(-k_afdm_s * tg), series = "Exponential on ash-free mass"),
  data.frame(t = tg, y = (1 - A_hat) * exp(-k_hat * tg) + A_hat,
             series = "Asymptotic model on raw mass"))
lin$series <- factor(lin$series, levels = c("True curve (limit zero)",
                                            "Exponential on ash-free mass",
                                            "Asymptotic model on raw mass"))
lin_hue <- c(te_pal$ink, te_pal$green, te_pal$gold)

ggplot() +
  geom_hline(yintercept = 0, colour = te_pal$ink, linewidth = 0.7) +
  geom_hline(yintercept = A_hat, linetype = 3, colour = te_pal$gold,
             linewidth = 1) +
  geom_point(data = pts, aes(t, y, colour = series), size = 1.9, alpha = 0.75) +
  geom_line(data = lin, aes(t, y, group = series, linetype = series),
            colour = lin_hue[as.integer(lin$series)], linewidth = 0.95) +
  annotate("text", x = 1.6, y = A_hat + 0.09, hjust = 0, size = 3.2,
           colour = te_pal$ink,
           label = sprintf("gold dotted line: limit reported from raw mass, %.4f",
                           A_hat)) +
  annotate("text", x = 0.05, y = -0.055, hjust = 0, size = 3.2,
           colour = te_pal$ink, label = "true limit of the litter curve: 0") +
  scale_colour_manual(values = c(te_pal$clay, te_pal$forest), name = NULL) +
  scale_linetype_manual(values = c(2, 1, 4), name = NULL) +
  scale_x_continuous(limits = c(0, 5.4), breaks = 0:5) +
  guides(colour = guide_legend(order = 1, ncol = 1),
         linetype = guide_legend(order = 2, ncol = 1,
                                 override.aes = list(colour = lin_hue,
                                                     linewidth = 0.95))) +
  coord_cartesian(ylim = c(-0.1, 1.25)) +
  labs(x = "Years since the bags went out",
       y = "Mass left per gram of initial litter",
       title = "Soil in the bag becomes a recalcitrant fraction in the model") +
  theme_te() +
  theme(legend.position = "bottom", legend.box = "horizontal",
        legend.key.width = unit(2.1, "lines"),
        legend.text = element_text(size = 8.4))

## ---- mesh ----
k_min_true  <- 0.30
fauna_share <- 0.28
frag_fine   <- 0.02
frag_coarse <- 0.10

k_fine_true   <- k_min_true * (1 - fauna_share) + frag_fine
k_coarse_true <- k_min_true + frag_coarse
phi <- k_min_true / k_coarse_true

set.seed(20260726)
y_fine   <- exp(-k_fine_true * tb) * exp(rnorm(length(tb), 0, sd_bag))
y_coarse <- exp(-k_coarse_true * tb) * exp(rnorm(length(tb), 0, sd_bag))

k_fine   <- k_of(tb, y_fine)
k_coarse <- k_of(tb, y_coarse)

round(c(true_mineralisation_rate = k_min_true,
        fauna_share_of_mineralisation = fauna_share,
        fauna_per_cent_of_mineralisation = 100 * fauna_share,
        fragment_loss_fine_mesh = frag_fine,
        fragment_loss_coarse_mesh = frag_coarse,
        fine_mesh_estimate = k_fine,
        coarse_mesh_estimate = k_coarse,
        fine_mesh_error = k_fine - k_min_true,
        coarse_mesh_error = k_coarse - k_min_true,
        fine_mesh_error_per_cent = 100 * (k_fine / k_min_true - 1),
        coarse_mesh_error_per_cent = 100 * (k_coarse / k_min_true - 1),
        se_fine = se_of(tb, y_fine),
        se_coarse = se_of(tb, y_coarse),
        mineralised_share_of_coarse_mass_loss = phi,
        mineralised_per_cent_of_coarse_mass_loss = 100 * phi), 4)

## ---- crossover ----
cross <- function(fs) abs(k_min_true * fs - frag_fine)
fs_grid <- c(0.10, 0.20, 0.28, 0.40, 0.55)
tab_x <- rbind(fauna_share_of_mineralisation = fs_grid,
               fauna_per_cent_of_mineralisation = 100 * fs_grid,
               fine_mesh_error = -(k_min_true * fs_grid - frag_fine),
               coarse_wins_below_this_fragment_rate = cross(fs_grid))
colnames(tab_x) <- paste0("case_", seq_along(fs_grid))
print(round(tab_x, 4))

round(c(fragment_rate_used_here = frag_coarse,
        crossover_at_this_fauna_share = cross(fauna_share),
        one_over_the_mineralised_share = 1 / phi), 4)

## ---- stock ----
I_bar <- 3.20; cv_I <- 0.15
k_bar <- 0.35; cv_k <- 0.15
n_draw <- 20000

rg <- function(n, m, cv) rgamma(n, shape = 1 / cv^2, rate = 1 / (m * cv^2))

set.seed(20260726)
k_draw <- rg(n_draw, k_bar, cv_k)
I_draw <- rg(n_draw, I_bar, cv_I)

X_both <- I_draw / k_draw
X_k    <- I_bar  / k_draw
X_I    <- I_draw / k_bar
X_at_mean <- I_bar / k_bar

round(c(draws = n_draw,
        mean_input_Mg_C_per_ha = I_bar,
        mean_k_per_year = k_bar,
        coefficient_of_variation = cv_k,
        stock_at_the_mean_k = X_at_mean,
        mean_simulated_stock = mean(X_both),
        median_simulated_stock = median(X_both),
        cv_of_the_stock = sd(X_both) / mean(X_both),
        first_order_prediction = sqrt(cv_I^2 + cv_k^2),
        sd_from_k_alone = sd(X_k),
        sd_from_input_alone = sd(X_I),
        ratio_of_the_two_sds = sd(X_k) / sd(X_I),
        upper_2_5_per_cent_point_k_alone = quantile(X_k, 0.975),
        upper_2_5_per_cent_point_input_alone = quantile(X_I, 0.975),
        jensen_gap_per_cent = 100 * (mean(X_both) / X_at_mean - 1),
        exact_gamma_prediction_per_cent = 100 * (1 / (1 - cv_k^2) - 1)), 4)

## ---- cvsweep ----
cv_grid <- c(0.05, 0.10, 0.15, 0.20, 0.30)
sw <- sapply(cv_grid, function(cv) {
  set.seed(20260726)
  a <- rg(n_draw, k_bar, cv); b <- rg(n_draw, I_bar, cv)
  c(cv = cv, cv_per_cent = 100 * cv,
    sd_ratio_k_over_input = sd(I_bar / a) / sd(b / k_bar),
    jensen_gap_per_cent = 100 * (1 / (1 - cv^2) - 1))
})
print(round(sw, 4))

## ---- fig-stock ----
pnx <- c("All the simulated stocks",
         "Zoom on the two reference lines")
zlo <- min(X_at_mean, mean(X_both)) - 0.5
zhi <- max(X_at_mean, mean(X_both)) + 0.5
mk_bars <- function(lo, hi, nb, pan) {
  br <- seq(lo, hi, length.out = nb + 1)
  h <- hist(X_both[X_both >= lo & X_both <= hi], breaks = br, plot = FALSE)
  data.frame(mid = h$mids, count = h$counts, w = br[2] - br[1], panel = pan)
}
hd <- rbind(mk_bars(floor(min(X_both)), ceiling(max(X_both)), 70, pnx[1]),
            mk_bars(zlo, zhi, 32, pnx[2]))
hd$panel <- factor(hd$panel, levels = pnx)
vl <- data.frame(x = rep(c(X_at_mean, mean(X_both)), 2),
                 lty = rep(c(2, 1), 2),
                 col = rep(c(te_pal$ink, te_pal$clay), 2),
                 panel = factor(rep(pnx, each = 2), levels = pnx))
notes <- data.frame(
  x = c(Inf, Inf, -Inf), y = Inf,
  hj = c(1.04, 1.04, -0.07), vj = c(1.7, 3.2, 1.7),
  col = c(te_pal$ink, te_pal$clay, te_pal$clay),
  lab = c(sprintf("dashed, at the mean k: %.4f", X_at_mean),
          sprintf("solid, the mean stock: %.4f", mean(X_both)),
          sprintf("Jensen gap:\n%.2f per cent",
                  100 * (mean(X_both) / X_at_mean - 1))),
  panel = factor(pnx[c(1, 1, 2)], levels = pnx))

ggplot(hd, aes(mid, count)) +
  geom_col(width = hd$w, fill = te_pal$sage, colour = NA) +
  geom_vline(data = vl, aes(xintercept = x), colour = vl$col,
             linetype = vl$lty, linewidth = 0.9) +
  geom_text(data = notes, aes(x = x, y = y, label = lab, hjust = hj,
                              vjust = vj),
            colour = notes$col, size = 3.2, lineheight = 0.95,
            inherit.aes = FALSE) +
  facet_wrap(~panel, scales = "free") +
  scale_y_continuous(expand = expansion(mult = c(0, 0.22))) +
  labs(x = "Steady-state litter carbon stock (Mg C per hectare)",
       y = "Simulated studies",
       title = "Dividing by an uncertain rate constant makes a skewed stock") +
  theme_te() +
  theme(strip.text = element_text(colour = te_pal$ink, face = "bold",
                                  size = 8.8))

## ---- nonsteady ----
g_rate <- 0.02; n_yr <- 30

true_stock <- function(k, g, TT, I0)
  I0 * (exp(g * TT) - exp(-k * TT)) / (g + k) + (I0 / k) * exp(-k * TT)

ns <- sapply(c(litter_layer = 0.35, slow_pool = 0.05), function(kk) {
  Tr <- true_stock(kk, g_rate, n_yr, I_bar)
  Rp <- I_bar * exp(g_rate * n_yr) / kk
  c(k = kk, turnover_time_years = 1 / kk, true_stock = Tr,
    reported_by_I_over_k = Rp, overstated_per_cent = 100 * (Rp / Tr - 1))
})
print(round(ns, 4))

round(c(input_growth_per_cent_per_year = 100 * g_rate,
        years_of_growth = n_yr,
        input_in_the_final_year = I_bar * exp(g_rate * n_yr)), 4)

## ---- cascade ----
X_C <- 3.60

set.seed(20260726)
org_study  <- mass_rem(tb)
raw_study  <- (org_study + soil_on(tb)) * exp(rnorm(length(tb), 0, sd_bag))
ashf_study <- pmin((soil_on(tb) / (org_study + soil_on(tb))) *
                     exp(rnorm(length(tb), 0, sd_ash)), 0.95)
afdm_study <- raw_study * (1 - ashf_study)

fit_study <- lm(log(raw_study) ~ 0 + tb)
k_raw  <- -coef(fit_study)[[1]]
se_raw <- summary(fit_study)$coefficients[1, 2]
ci_raw <- k_raw + c(-1, 1) * qt(0.975, length(tb) - 1) * se_raw
half_width <- (ci_raw[2] - k_raw) / k_raw

corr_ash  <- k_of(tb, afdm_study) / k_raw
corr_frag <- phi
corr_carb <- k_carb / k_mass
corr_all  <- corr_ash * corr_frag * corr_carb

k_target <- phi * k_carb

round(c(standing_litter_carbon_stock = X_C,
        k_from_raw_dry_mass = k_raw,
        standard_error = se_raw,
        ci_lower = ci_raw[1], ci_upper = ci_raw[2],
        ci_half_width_per_cent = 100 * half_width,
        ash_correction = corr_ash,
        fragment_correction = corr_frag,
        carbon_correction = corr_carb,
        product_of_the_three = corr_all,
        corrected_k = k_raw * corr_all,
        true_carbon_mineralisation_k = k_target,
        residual_after_all_three_per_cent =
          100 * (k_raw * corr_all / k_target - 1)), 4)

round(c(ash_correction_per_cent = 100 * (corr_ash - 1),
        fragment_correction_per_cent = 100 * (corr_frag - 1),
        carbon_correction_per_cent = 100 * (corr_carb - 1),
        net_correction_per_cent = 100 * (corr_all - 1),
        net_over_ci_half_width = abs(corr_all - 1) / half_width,
        largest_single_over_ci_half_width =
          max(abs(c(corr_ash, corr_frag, corr_carb) - 1)) / half_width,
        flux_as_reported = k_raw * X_C,
        flux_after_the_corrections = k_raw * corr_all * X_C,
        true_flux = k_target * X_C,
        overstatement_Mg_C_per_ha_per_year = (k_raw - k_target) * X_C,
        overstatement_as_a_share_of_the_truth =
          (k_raw - k_target) / k_target), 4)

## ---- fig-cascade ----
steps <- c("Raw dry mass", "After ash", "After fragments", "After carbon")
ratio <- c(k_raw, k_raw * corr_ash, k_raw * corr_ash * corr_frag,
           k_raw * corr_all) / k_target
casc <- data.frame(step = factor(steps, levels = steps), ratio = ratio)
band_lab <- sprintf(
  "confidence interval on k: %.2f per cent either side, %.2f to %.2f",
  100 * half_width, 1 - half_width, 1 + half_width)

ggplot(casc, aes(step, ratio, group = 1)) +
  annotate("rect", xmin = -Inf, xmax = Inf,
           ymin = 1 - half_width, ymax = 1 + half_width,
           fill = te_pal$line, alpha = 0.8) +
  geom_hline(yintercept = c(1 - half_width, 1 + half_width),
             colour = te_pal$ink, linetype = 3, linewidth = 0.55) +
  geom_hline(yintercept = 1, colour = te_pal$ink, linewidth = 0.8) +
  geom_line(colour = te_pal$sage, linewidth = 1) +
  geom_point(size = 4, colour = te_pal$forest) +
  geom_text(aes(label = sprintf("%.2f", ratio)), vjust = -1.3, size = 3.6,
            colour = te_pal$ink) +
  annotate("text", x = 0.62, y = 1 - half_width - 0.055, hjust = 0, size = 3.4,
           colour = te_pal$ink, fontface = "bold", label = band_lab) +
  scale_x_discrete(expand = expansion(add = 0.45)) +
  scale_y_continuous(limits = c(0.80, 1.60), breaks = seq(0.8, 1.6, 0.1)) +
  labs(x = NULL, y = "Estimated flux divided by true flux",
       title = "Two of the three corrections beat the error bar") +
  theme_te()

## ---- cancel ----
net_at <- sapply(c(0.00, 0.04, 0.08, 0.12, 0.16, 0.24), function(am) {
  s <- am * (1 - exp(-a_rate * tb))
  set.seed(20260726)
  r <- (org_study + s) * exp(rnorm(length(tb), 0, sd_bag))
  af <- pmin((s / (org_study + s)) * exp(rnorm(length(tb), 0, sd_ash)), 0.95)
  ca <- k_of(tb, r * (1 - af)) / k_of(tb, r)
  c(contamination_plateau = am, k_reported = k_of(tb, r), ash_correction = ca,
    net_correction_per_cent = 100 * (ca * corr_frag * corr_carb - 1))
})
print(round(net_at, 4))

## ---- cohort ----
stock_lab <- f_lab / k_lab
stock_rec <- f_rec / k_rec
k_eff_mass <- 1 / (stock_lab + stock_rec)
stock_carb <- c_lab * f_lab / k_lab + c_rec * f_rec / k_rec
k_eff_carb <- c0 / stock_carb

round(c(lignified_share_of_fresh_litter = f_rec,
        lignified_share_of_the_standing_stock =
          stock_rec / (stock_lab + stock_rec),
        cohort_k_dry_mass = k_mass,
        standing_stock_k_dry_mass = k_eff_mass,
        overstated_per_cent_mass = 100 * (k_mass / k_eff_mass - 1),
        cohort_k_carbon = k_carb,
        standing_stock_k_carbon = k_eff_carb,
        overstated_per_cent_carbon = 100 * (k_carb / k_eff_carb - 1),
        stock_per_unit_annual_input_years = stock_lab + stock_rec), 4)
