Back to Article
Preliminary Results
Download Source

Model Validation and coefficient calculation

Author

Marc Pérez

Published

May 22, 2025

In [1]:
Code

library(multcomp)
Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS

Attaching package: 'TH.data'
The following object is masked from 'package:MASS':

    geyser
Code
library(car)
Loading required package: carData
Code
library(tidyr)
library(lme4)
Loading required package: Matrix

Attaching package: 'Matrix'
The following objects are masked from 'package:tidyr':

    expand, pack, unpack
Code
library(ggplot2)
library(ggtext)
library(ggpmisc)
Loading required package: ggpp
Registered S3 methods overwritten by 'ggpp':
  method                  from   
  heightDetails.titleGrob ggplot2
  widthDetails.titleGrob  ggplot2

Attaching package: 'ggpp'
The following object is masked from 'package:ggplot2':

    annotate
Code
library(nlme)

Attaching package: 'nlme'
The following object is masked from 'package:lme4':

    lmList
Code
library(latex2exp)
library(kableExtra)
library(broom)
library(dplyr)

Attaching package: 'dplyr'
The following object is masked from 'package:kableExtra':

    group_rows
The following object is masked from 'package:nlme':

    collapse
The following object is masked from 'package:car':

    recode
The following object is masked from 'package:MASS':

    select
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
Code
library(MuMIn)
Registered S3 methods overwritten by 'MuMIn':
  method        from 
  nobs.multinom broom
  nobs.fitdistr broom
Code
library(sjPlot) # table functions
library(sjmisc) # sample data
Install package "strengejacke" from GitHub (`devtools::install_github("strengejacke/strengejacke")`) to load all sj-packages at once!

Attaching package: 'sjmisc'
The following object is masked from 'package:tidyr':

    replace_na
Code
library(lme4) # fitting models
library(report)
library(performance)

load("~/Documents/Master Thesis/Master-Thesis-P-kinetics/data/results_coefficient_analysis")

Results

The results are presented in three main parts. First, the development and validation of the phosphorus (P) desorption kinetic model are detailed, justifying the final modeling approach. Second, the descriptive trends of both agronomic outcomes and soil P parameters in response to long-term fertilization and site differences are explored visually. Finally, the predictive power of the kinetic and standard P parameters is formally evaluated using linear mixed-effects models.

Establishment of the P-Desorption Kinetic Model

The primary goal was to derive two key parameters for each soil sample: the desorbable P pool (\(P_{desorb}\)) and the rate constant (\(k\)). The analysis proceeded in two stages: an initial test of a linearized model, followed by the implementation of a more robust non-linear model.

Initial Approach: Linearized Model

Following the conceptual framework of Flossmann and Richter (1982), the first-order kinetic equation was linearized to the form \(ln(1 - P/P_{desorb}) = -kt\). For this approach, the asymptote (\(P_{desorb}\)) was not fitted but was calculated beforehand as the difference between Olsen-P and water-soluble P. A linear model was then fitted to the transformed data for each sample.

In [2]:
Code

# This is a placeholder for your code from pretest.qmd
 ggplot(d[d$Treatment!="P100"&(d$Repetition==1|d$Repetition==2),], aes(y=Y1, x=t.min., col = Repetition)) +
   geom_point() +
   facet_grid(Site ~ Treatment) +
   labs(x=TeX("$Time (min)$"),
        y=TeX("$ln(1-\\frac{P}{P_S})$")) +
   geom_smooth(method="lm", alpha = 0.3)
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 13 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 13 rows containing missing values or values outside the scale range
(`geom_point()`).
Test of the linearized first-order kinetic model. Data is faceted by Site and P fertilization Treatment. The solid line represents a linear model fit.

(Placeholder for the linearized model plot)

The results of this linearized approach were inconsistent (Figure X.1). While some samples showed a reasonable linear trend, many exhibited significant deviations, particularly a curvilinear pattern. Furthermore, the model required the intercept to be fixed at zero, but the statistical summary of the fitted models (lmList) showed that the estimated intercepts were often significantly different from zero (p < 0.05). For example, the sample Cadenazzo_P166_1 had a highly significant intercept of -0.27 (p < 0.001). This systematic deviation from the model’s core assumption indicated that this linearized approach, which relied on an externally estimated asymptote, was not robust for this dataset.

Final Approach: Non-Linear Model

Given the limitations of the linearized method, a direct non-linear modeling approach was adopted to estimate both \(P_{desorb}\) and \(k\) simultaneously from the untransformed data. The model \(P(t) = P_{desorb} \times (1 - e^{-k \times t'})\) was fitted to each sample’s desorption curve.

In [3]:
Code

Res <- nlsList(Pv.mg.L. ~ PS * (1 - exp(-k * (t.dt))) | uid, d[, c("Pv.mg.L.", "uid", "t.dt")],  start=list(PS=0.1,k=0.2))
Warning: 1 error caught in nls(model, data = data, control = controlvals, start
= start): singular gradient
Code

# summary(Res)
# d$nls_pred <- predict(Res)

# Extract coefficients from the nlsList results
nls_coefs <- coef(Res)
nls_coefs$uid <- rownames(nls_coefs)

# Merge coefficients back to the main dataset
d_plot <- merge(d, nls_coefs, by = "uid")

# Most straightforward approach - create curves manually
time_seq <- seq(min(d$t.dt, na.rm = TRUE), max(d$t.dt, na.rm = TRUE), length.out = 100)

# Create prediction data
pred_data <- d_plot %>%
  select(uid, Site, Treatment, Repetition, PS, k) %>%
  distinct() %>%
  crossing(t.dt = time_seq) %>%
  mutate(pred_Pv = PS * (1 - exp(-k * (t.dt))))

# This is a placeholder for your code from pretest.qmd
 p1 <- ggplot() +
   geom_point(data = d_plot, aes(y = Pv.mg.L., x = t.dt, col = Repetition)) +
   geom_line(data = pred_data, aes(x = t.dt, y = pred_Pv, col = Repetition), size = 0.5) +
   facet_grid(Treatment ~ Site,scales = "free_y") +
   labs(x = TeX("$Time (min)$"),
        y = TeX("$P_{V}(\\frac{mg}{L})$"));
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
Code

 suppressWarnings(print(p1))
Non-linear first-order kinetic model fits for P desorption over time. Points represent measured data and solid lines represent the fitted model for each replicate.

(Placeholder for the non-linear model plot)

This approach proved to be far more successful (Figure X.2). The non-linear model was able to accurately capture the curvilinear shape of the desorption data for nearly all samples. The successful convergence of the models for each unique sample (uid) provided robust, sample-specific estimates for both the desorbable P pool (\(P_{desorb}\)) and the rate constant (\(k\)). For example, for the sample Cadenazzo_P166_1, the model estimated a \(P_{desorb}\) of 0.27 mg/L and a \(k\) of 0.086 min⁻¹, both with high statistical significance (p < 0.01).

To account for the hierarchical data structure and obtain the most reliable estimates, the final parameters were extracted from a non-linear mixed-effects model (nlme), which models the overall fixed effects for \(k\) and \(P_{desorb}\) while allowing for random variation among individual samples. These final nlme-derived coefficients were used for all subsequent analyses.

Research Questions:

How well can current GRUD measurements of \(C_P\) predict the relative Yield, P-Uptake and P-Balance?

  • Hypothesis I: The measurements of the equlibrium concentrations of Phosphorus in a solvent do not display significant effects on relative Yield and consequently P-Uptake, since it is strongly dependent on yield. \(C_P\) relates strongly to the amount of Phosphorus applied, the P-balance might well be siginificantly correlated to \(C_P\) but not explain a lot of variance.
In [4]:
Code

ggplot(D[D$soil_0_20_P_CO2!=0,],aes(y=Ymain_norm, x=soil_0_20_P_CO2, col=Site, size = Treatment)) +
  geom_point(shape = 7) + 
  scale_x_log10() + scale_y_log10() +
  labs(x=TeX("$P_{CO_{2}}(mg/kg Soil)$"),
         y="relative Yield (%)") +
  facet_wrap( ~ Site, nrow = 2)
Warning: Using size for a discrete variable is not advised.
Warning: Removed 77 rows containing missing values or values outside the scale range
(`geom_point()`).

Code
ggplot(D[D$soil_0_20_P_AAE10!=0,],aes(y=Ymain_norm, x=soil_0_20_P_AAE10, col=Site, size = Treatment)) +
  geom_point(shape = 7) + 
  scale_x_log10() + scale_y_log10() +
  labs(x=TeX("$P_{AAE10}(mg/kg Soil)$"),
         y="relative Yield (%)") +
  facet_wrap( ~ Site, nrow = 2)
Warning: Using size for a discrete variable is not advised.
Removed 77 rows containing missing values or values outside the scale range
(`geom_point()`).

Code
ggplot(D[D$soil_0_20_P_CO2!=0&D$annual_P_uptake!=0,],aes(y=annual_P_uptake, x=soil_0_20_P_CO2, col=Site, size = Treatment)) +
  geom_point(shape = 7) + 
  scale_x_log10() + scale_y_log10() +
  labs(x=TeX("$P_{CO_{2}}(mg/kg Soil)$"),
         y=TeX("Annual P-Uptake $kg~P/ha$")) +
  facet_wrap( ~ Site, nrow = 2)
Warning: Using size for a discrete variable is not advised.
Warning: Removed 124 rows containing missing values or values outside the scale range
(`geom_point()`).

Code
ggplot(D[D$soil_0_20_P_AAE10!=0&D$annual_P_uptake!=0,],aes(y=annual_P_uptake, x=soil_0_20_P_AAE10, col=Site, size = Treatment)) +
  geom_point(shape = 7) + 
  scale_x_log10() + scale_y_log10() +
  labs(x=TeX("$P_{AAE10}(mg/kg Soil)$"),
         y=TeX("Annual P-Uptake $kg~P/ha$")) +
  facet_wrap( ~ Site, nrow = 2)
Warning: Using size for a discrete variable is not advised.
Removed 124 rows containing missing values or values outside the scale range
(`geom_point()`).

Code
ggplot(D[D$soil_0_20_P_CO2!=0&D$annual_P_balance!=0,],aes(y=annual_P_balance, x=soil_0_20_P_CO2, col=Site, size = Treatment)) +
  geom_point(shape = 7) + 
  scale_x_log10() + scale_y_log10() +
  labs(x=TeX("$P_{CO_{2}}(mg/kg Soil)$"),
         y=TeX("Annual P-Balance $kg~P/ha$")) +
  facet_wrap( ~ Site, nrow = 2)
Warning: Using size for a discrete variable is not advised.
Warning in transformation$transform(x): NaNs produced
Warning in scale_y_log10(): log-10 transformation introduced infinite values.
Warning: Removed 216 rows containing missing values or values outside the scale range
(`geom_point()`).

Code
ggplot(D[D$soil_0_20_P_AAE10!=0&D$annual_P_balance!=0,],aes(y=annual_P_balance, x=soil_0_20_P_AAE10, col=Site, size = Treatment)) +
  geom_point(shape = 7) + 
  scale_x_log10() + scale_y_log10() +
  labs(x=TeX("$P_{AAE10}(mg/kg Soil)$"),
         y=TeX("Annual P-Balance $kg~P/ha$")) +
  facet_wrap( ~ Site, nrow = 2)
Warning: Using size for a discrete variable is not advised.
Warning in transformation$transform(x): NaNs produced
Warning in scale_y_log10(): log-10 transformation introduced infinite values.
Warning: Removed 216 rows containing missing values or values outside the scale range
(`geom_point()`).

Now we want to check the strength of the models in terms of \(R^2\) and the significance of the effects in terms of p-values:

In [5]:
Code

#tab_model(fit.grud.Yrel,fit.grud.Puptake,fit.grud.Pbalance)
report(fit.grud.Yrel)
Loading required namespace: lmerTest
Formula contains log- or sqrt-terms.
  See help("standardize") for how such terms are standardized.
boundary (singular) fit: see help('isSingular')
Formula contains log- or sqrt-terms.
  See help("standardize") for how such terms are standardized.
boundary (singular) fit: see help('isSingular')
We fitted a linear mixed model (estimated using REML and nloptwrap optimizer)
to predict Ymain_rel with soil_0_20_P_CO2 and soil_0_20_P_AAE10 (formula:
Ymain_rel ~ log(soil_0_20_P_CO2) + log(soil_0_20_P_AAE10)). The model included
year as random effects (formula: list(~1 | year, ~1 | Site, ~1 | Site:block, ~1
| Site:Treatment)). The model's total explanatory power is substantial
(conditional R2 = 0.58) and the part related to the fixed effects alone
(marginal R2) is of 0.07. The model's intercept, corresponding to
soil_0_20_P_CO2 = 0 and soil_0_20_P_AAE10 = 0, is at 108.49 (95% CI [73.65,
143.34], t(204) = 6.14, p < .001). Within this model:

  - The effect of soil 0 20 P CO2 [log] is statistically significant and positive
(beta = 9.69, 95% CI [1.35, 18.03], t(204) = 2.29, p = 0.023; Std. beta = 0.24,
95% CI [-0.42, 0.91])
  - The effect of soil 0 20 P AAE10 [log] is statistically non-significant and
negative (beta = -0.93, 95% CI [-9.14, 7.28], t(204) = -0.22, p = 0.823; Std.
beta = 0.47, 95% CI [-0.30, 1.24])

Standardized parameters were obtained by fitting the model on a standardized
version of the dataset. 95% Confidence Intervals (CIs) and p-values were
computed using a Wald t-distribution approximation.
Code
report(fit.grud.Pexport)
Formula contains log- or sqrt-terms.
  See help("standardize") for how such terms are standardized.
boundary (singular) fit: see help('isSingular')
Random effect variances not available. Returned R2 does not account for random effects.
Formula contains log- or sqrt-terms.
  See help("standardize") for how such terms are standardized.
boundary (singular) fit: see help('isSingular')
Random effect variances not available. Returned R2 does not account for random effects.
We fitted a linear mixed model (estimated using REML and nloptwrap optimizer)
to predict annual_P_uptake with soil_0_20_P_CO2 and soil_0_20_P_AAE10 (formula:
annual_P_uptake ~ log(soil_0_20_P_CO2) + log(soil_0_20_P_AAE10)). The model
included year as random effects (formula: list(~1 | year, ~1 | Site, ~1 |
Site:block, ~1 | Site:Treatment)). The model's explanatory power related to the
fixed effects alone (marginal R2) is 0.15. The model's intercept, corresponding
to soil_0_20_P_CO2 = 0 and soil_0_20_P_AAE10 = 0, is at 24.73 (95% CI [7.95,
41.50], t(251) = 2.90, p = 0.004). Within this model:

  - The effect of soil 0 20 P CO2 [log] is statistically significant and positive
(beta = 4.56, 95% CI [1.04, 8.09], t(251) = 2.55, p = 0.011; Std. beta = 0.29,
95% CI [-0.20, 0.79])
  - The effect of soil 0 20 P AAE10 [log] is statistically non-significant and
positive (beta = 0.72, 95% CI [-3.01, 4.46], t(251) = 0.38, p = 0.703; Std.
beta = 0.45, 95% CI [-0.17, 1.07])

Standardized parameters were obtained by fitting the model on a standardized
version of the dataset. 95% Confidence Intervals (CIs) and p-values were
computed using a Wald t-distribution approximation.
Code
report(fit.grud.Pbalance)
Formula contains log- or sqrt-terms.
  See help("standardize") for how such terms are standardized.
boundary (singular) fit: see help('isSingular')
Random effect variances not available. Returned R2 does not account for random effects.
Formula contains log- or sqrt-terms.
  See help("standardize") for how such terms are standardized.
boundary (singular) fit: see help('isSingular')
Random effect variances not available. Returned R2 does not account for random effects.
We fitted a linear mixed model (estimated using REML and nloptwrap optimizer)
to predict annual_P_balance with soil_0_20_P_CO2 and soil_0_20_P_AAE10
(formula: annual_P_balance ~ log(soil_0_20_P_CO2) + log(soil_0_20_P_AAE10)).
The model included year as random effects (formula: list(~1 | year, ~1 | Site,
~1 | Site:block, ~1 | Site:Treatment)). The model's explanatory power related
to the fixed effects alone (marginal R2) is 3.54e-03. The model's intercept,
corresponding to soil_0_20_P_CO2 = 0 and soil_0_20_P_AAE10 = 0, is at 6.58 (95%
CI [-23.64, 36.79], t(266) = 0.43, p = 0.669). Within this model:

  - The effect of soil 0 20 P CO2 [log] is statistically non-significant and
negative (beta = -0.43, 95% CI [-8.71, 7.85], t(266) = -0.10, p = 0.919; Std.
beta = -1.18e-03, 95% CI [-0.50, 0.49])
  - The effect of soil 0 20 P AAE10 [log] is statistically non-significant and
negative (beta = -0.55, 95% CI [-7.41, 6.32], t(266) = -0.16, p = 0.876; Std.
beta = -0.06, 95% CI [-0.58, 0.46])

Standardized parameters were obtained by fitting the model on a standardized
version of the dataset. 95% Confidence Intervals (CIs) and p-values were
computed using a Wald t-distribution approximation.

here I also show the non linear mixed models, following the Mitscherlich saturation curve:

In [6]:
Code


library(nlme)

# Make sure grouping variables are factors
D$year  <- as.factor(D$year)
D$Site  <- as.factor(D$Site)
D$block <- as.factor(D$block)
D$crop <- as.factor(D$crop)
# Fit the model
fit.mitscherlich.CO2.Yrel <- nlme(
  Ymain_rel ~ A * (1 - exp(-k * soil_0_20_P_CO2 + E)),                
  fixed = A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec,
  random = A ~ 1 | year/Site/block,
  data = D,
  subset = Treatment != "P166",
  start = c(
    A = 1100, A1 = 0, A2 = 0, A3 = 0, A4 = 0,
    k = 0.05, k1 = 0, k2 = 0, k3 = 0, k4 = 0,
    E = -3, E1 = 0, E2 = 0, E3 = 0, E4 = 0
  ),
  control = nlmeControl(maxIter = 500),
  na.action = na.omit
)

summary(fit.mitscherlich.CO2.Yrel)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: Ymain_rel ~ A * (1 - exp(-k * soil_0_20_P_CO2 + E)) 
  Data: D 
  Subset: Treatment != "P166" 
       AIC      BIC    logLik
  527.2096 568.2283 -244.6048

Random effects:
 Formula: A ~ 1 | year
        A.(Intercept)
StdDev:    0.01961179

 Formula: A ~ 1 | Site %in% year
        A.(Intercept)
StdDev:   0.009131671

 Formula: A ~ 1 | block %in% Site %in% year
        A.(Intercept) Residual
StdDev:      6.208515 9.605261

Fixed effects:  A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec 
                        Value Std.Error DF   t-value p-value
A.(Intercept)       205.19121  93.50859 18  2.194357  0.0416
A.soil_0_20_clay      0.47979   0.59388 18  0.807903  0.4297
A.soil_0_20_pH_H2O    3.14485   5.07842 18  0.619258  0.5435
A.ansum_sun          -0.03359   0.02723 18 -1.233522  0.2332
A.ansum_prec         -0.09319   0.02923 18 -3.188058  0.0051
k.(Intercept)      -148.68484 224.85418 18 -0.661250  0.5168
k.soil_0_20_clay     -0.73860   0.96610 18 -0.764517  0.4545
k.soil_0_20_pH_H2O  -11.70857  11.55623 18 -1.013183  0.3244
k.ansum_sun           0.05090   0.06324 18  0.804749  0.4315
k.ansum_prec          0.19483   0.12848 18  1.516449  0.1468
E.(Intercept)       -88.43864  71.82211 18 -1.231357  0.2340
E.soil_0_20_clay      0.11543   0.20823 18  0.554316  0.5862
E.soil_0_20_pH_H2O    1.01035   2.48731 18  0.406201  0.6894
E.ansum_sun           0.02003   0.01769 18  1.132091  0.2725
E.ansum_prec          0.04587   0.03050 18  1.503763  0.1500
 Correlation: 
                   A.(In) A.s_0_20_ A._0_20_H A.nsm_s A.nsm_p k.(In) k.s_0_20_
A.soil_0_20_clay   -0.622                                                     
A.soil_0_20_pH_H2O -0.770  0.754                                              
A.ansum_sun        -0.925  0.427     0.582                                    
A.ansum_prec       -0.298 -0.324    -0.230     0.283                          
k.(Intercept)       0.100 -0.126    -0.084    -0.046  -0.047                  
k.soil_0_20_clay   -0.050  0.013     0.150     0.010  -0.028  -0.396          
k.soil_0_20_pH_H2O -0.239  0.339     0.371     0.180  -0.196  -0.290  0.755   
k.ansum_sun        -0.040  0.047     0.010    -0.002   0.075  -0.963  0.249   
k.ansum_prec        0.041 -0.066    -0.179    -0.047   0.182  -0.648 -0.346   
E.(Intercept)       0.121 -0.104    -0.019    -0.080  -0.141   0.933 -0.175   
E.soil_0_20_clay   -0.104  0.077     0.076     0.049   0.100  -0.754  0.690   
E.soil_0_20_pH_H2O -0.270  0.346     0.288     0.196  -0.052  -0.709  0.557   
E.ansum_sun        -0.098  0.065    -0.001     0.070   0.138  -0.931  0.143   
E.ansum_prec        0.010 -0.063    -0.175    -0.018   0.228  -0.678 -0.283   
                   k._0_20_H k.nsm_s k.nsm_p E.(In) E.s_0_20_ E._0_20_H E.nsm_s
A.soil_0_20_clay                                                               
A.soil_0_20_pH_H2O                                                             
A.ansum_sun                                                                    
A.ansum_prec                                                                   
k.(Intercept)                                                                  
k.soil_0_20_clay                                                               
k.soil_0_20_pH_H2O                                                             
k.ansum_sun         0.071                                                      
k.ansum_prec       -0.491     0.745                                            
E.(Intercept)      -0.082    -0.913  -0.801                                    
E.soil_0_20_clay    0.427     0.634   0.326  -0.739                            
E.soil_0_20_pH_H2O  0.728     0.520   0.159  -0.679  0.787                     
E.ansum_sun         0.007     0.960   0.809  -0.973  0.655     0.567           
E.ansum_prec       -0.422     0.749   0.987  -0.845  0.394     0.238     0.834 

Standardized Within-Group Residuals:
         Min           Q1          Med           Q3          Max 
-2.588726770 -0.366345358  0.007224172  0.414582087  3.309922831 

Number of Observations: 64
Number of Groups: 
                     year            Site %in% year block %in% Site %in% year 
                        2                         8                        32 
Code
anova(fit.mitscherlich.CO2.Yrel)
                   numDF denDF   F-value p-value
A.(Intercept)          1    18 2825.9668  <.0001
A.soil_0_20_clay       1    18    1.3471  0.2610
A.soil_0_20_pH_H2O     1    18    7.7358  0.0123
A.ansum_sun            1    18   10.2069  0.0050
A.ansum_prec           1    18   23.1223  0.0001
k.(Intercept)          1    18   40.8657  <.0001
k.soil_0_20_clay       1    18    0.3246  0.5759
k.soil_0_20_pH_H2O     1    18    1.3052  0.2682
k.ansum_sun            1    18    8.3623  0.0097
k.ansum_prec           1    18    0.2708  0.6092
E.(Intercept)          1    18    0.7594  0.3950
E.soil_0_20_clay       1    18    0.0017  0.9673
E.soil_0_20_pH_H2O     1    18    0.0777  0.7837
E.ansum_sun            1    18    0.0492  0.8269
E.ansum_prec           1    18    2.2613  0.1500
Code
model_performance(fit.mitscherlich.CO2.Yrel)
# Indices of model performance

AIC     |    AICc |     BIC |  RMSE | Sigma
-------------------------------------------
557.316 | 574.588 | 598.334 | 8.515 | 9.605
Code
r.square.CO2 <- 1-sum(residuals(fit.mitscherlich.CO2.Yrel)^2)/sum((D$Ymain_rel-mean(D$Ymain_rel,na.rm=TRUE))^2,na.rm = TRUE)

# Fit the model
fit.mitscherlich.CO2.Yrel <- nlme(
  Ymain_rel ~ A * (1 - exp(-k * kPS + E)),                
  fixed = A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec,
  random = A ~ 1 | year/Site/block,
  data = D,
  subset = Treatment != "P166",
  start = c(
    A = 600, A1 = 0, A2 = 0, A3 = 0, A4 = 0,
    k = 3, k1 = 0, k2 = 0, k3 = 0, k4 = 0,
    E = -3, E1 = 0, E2 = 0, E3 = 0, E4 = 0
  ),
  control = nlmeControl(maxIter = 1500),
  na.action = na.omit
)
Warning in nlme.formula(Ymain_rel ~ A * (1 - exp(-k * kPS + E)), fixed = A + :
Iteration 2, LME step: nlminb() did not converge (code = 1). PORT message:
singular convergence (7)
Code
summary(fit.mitscherlich.CO2.Yrel)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: Ymain_rel ~ A * (1 - exp(-k * kPS + E)) 
  Data: D 
  Subset: Treatment != "P166" 
       AIC      BIC    logLik
  527.6624 568.6812 -244.8312

Random effects:
 Formula: A ~ 1 | year
        A.(Intercept)
StdDev:   0.001509839

 Formula: A ~ 1 | Site %in% year
        A.(Intercept)
StdDev:      3.512008

 Formula: A ~ 1 | block %in% Site %in% year
        A.(Intercept) Residual
StdDev:  1.712714e-76 10.75765

Fixed effects:  A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec 
                       Value Std.Error DF    t-value p-value
A.(Intercept)      242.18244   99.9327 18  2.4234557  0.0261
A.soil_0_20_clay    -2.37735    1.3420 18 -1.7714418  0.0934
A.soil_0_20_pH_H2O  -0.86288    4.8523 18 -0.1778294  0.8608
A.ansum_sun          0.00453    0.0405 18  0.1117703  0.9122
A.ansum_prec        -0.06433    0.0385 18 -1.6702902  0.1122
k.(Intercept)      -35.69127  733.0589 18 -0.0486881  0.9617
k.soil_0_20_clay     9.68568   20.3692 18  0.4755054  0.6401
k.soil_0_20_pH_H2O  42.48863   74.4105 18  0.5710035  0.5751
k.ansum_sun         -0.18169    0.2507 18 -0.7248095  0.4779
k.ansum_prec        -0.19839    0.1940 18 -1.0224586  0.3201
E.(Intercept)       -8.42292    9.2740 18 -0.9082312  0.3758
E.soil_0_20_clay    -0.08828    0.1099 18 -0.8030627  0.4324
E.soil_0_20_pH_H2O   0.43207    0.5734 18  0.7534716  0.4609
E.ansum_sun          0.00311    0.0023 18  1.3377403  0.1976
E.ansum_prec         0.00063    0.0023 18  0.2784023  0.7839
 Correlation: 
                   A.(In) A.s_0_20_ A._0_20_H A.nsm_s A.nsm_p k.(In) k.s_0_20_
A.soil_0_20_clay   -0.202                                                     
A.soil_0_20_pH_H2O -0.481  0.269                                              
A.ansum_sun        -0.727 -0.460     0.150                                    
A.ansum_prec       -0.557 -0.239    -0.252     0.542                          
k.(Intercept)      -0.048 -0.259     0.045     0.238   0.041                  
k.soil_0_20_clay    0.108  0.566     0.053    -0.519  -0.195  -0.741          
k.soil_0_20_pH_H2O  0.074  0.552    -0.003    -0.461  -0.148  -0.865  0.957   
k.ansum_sun        -0.096 -0.633    -0.092     0.542   0.237   0.253 -0.828   
k.ansum_prec       -0.104 -0.621    -0.088     0.536   0.237   0.082 -0.664   
E.(Intercept)       0.199 -0.466    -0.076     0.146  -0.053   0.826 -0.570   
E.soil_0_20_clay    0.080  0.246     0.143    -0.293  -0.149  -0.633  0.796   
E.soil_0_20_pH_H2O -0.049  0.600     0.158    -0.387  -0.153  -0.825  0.824   
E.ansum_sun        -0.308  0.230    -0.028     0.163   0.197  -0.356 -0.085   
E.ansum_prec       -0.249 -0.105    -0.124     0.286   0.372  -0.330 -0.155   
                   k._0_20_H k.nsm_s k.nsm_p E.(In) E.s_0_20_ E._0_20_H E.nsm_s
A.soil_0_20_clay                                                               
A.soil_0_20_pH_H2O                                                             
A.ansum_sun                                                                    
A.ansum_prec                                                                   
k.(Intercept)                                                                  
k.soil_0_20_clay                                                               
k.soil_0_20_pH_H2O                                                             
k.ansum_sun        -0.685                                                      
k.ansum_prec       -0.542     0.867                                            
E.(Intercept)      -0.709     0.164   0.028                                    
E.soil_0_20_clay    0.720    -0.591  -0.404  -0.459                            
E.soil_0_20_pH_H2O  0.899    -0.526  -0.414  -0.867  0.707                     
E.ansum_sun         0.118     0.385   0.339  -0.684 -0.303     0.306           
E.ansum_prec       -0.012     0.450   0.672  -0.553 -0.160     0.116     0.703 

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-2.90069009 -0.61991716 -0.01031473  0.51093634  4.38888646 

Number of Observations: 64
Number of Groups: 
                     year            Site %in% year block %in% Site %in% year 
                        2                         8                        32 
Code
anova(fit.mitscherlich.CO2.Yrel)
                   numDF denDF   F-value p-value
A.(Intercept)          1    18 3026.9437  <.0001
A.soil_0_20_clay       1    18  293.8330  <.0001
A.soil_0_20_pH_H2O     1    18    8.5656  0.0090
A.ansum_sun            1    18   18.4450  0.0004
A.ansum_prec           1    18    2.6270  0.1224
k.(Intercept)          1    18    2.0230  0.1720
k.soil_0_20_clay       1    18    0.0429  0.8382
k.soil_0_20_pH_H2O     1    18    0.8471  0.3695
k.ansum_sun            1    18    1.4533  0.2436
k.ansum_prec           1    18    1.0222  0.3254
E.(Intercept)          1    18    8.9965  0.0077
E.soil_0_20_clay       1    18    1.6959  0.2092
E.soil_0_20_pH_H2O     1    18    0.0518  0.8225
E.ansum_sun            1    18    2.5774  0.1258
E.ansum_prec           1    18    0.0775  0.7839
Code
model_performance(fit.mitscherlich.CO2.Yrel)
# Indices of model performance

AIC     |    AICc |     BIC |   RMSE |  Sigma
---------------------------------------------
548.486 | 565.758 | 589.504 | 10.496 | 10.758
Code
r.square.CO2 <- 1-sum(residuals(fit.mitscherlich.CO2.Yrel)^2)/sum((D$Ymain_rel-mean(D$Ymain_rel,na.rm=TRUE))^2,na.rm = TRUE)



fit.mitscherlich.CO2.Ynorm <- nlme(
  Ymain_norm ~ A * (1 - exp(-k * kPS + E)),                
  fixed = A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec,
  random = A ~ 1 | year/Site/block,
  data = D,
  subset = Treatment != "P166",
  start = c(
    A = 6, A1 = 0, A2 = 0, A3 = 0, A4 = 0,
    k = 3, k1 = 0, k2 = 0, k3 = 0, k4 = 0,
    E = -3, E1 = 0, E2 = 0, E3 = 0, E4 = 0
  ),
  control = nlmeControl(maxIter = 1500),
  na.action = na.omit
)

summary(fit.mitscherlich.CO2.Yrel)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: Ymain_rel ~ A * (1 - exp(-k * kPS + E)) 
  Data: D 
  Subset: Treatment != "P166" 
       AIC      BIC    logLik
  527.6624 568.6812 -244.8312

Random effects:
 Formula: A ~ 1 | year
        A.(Intercept)
StdDev:   0.001509839

 Formula: A ~ 1 | Site %in% year
        A.(Intercept)
StdDev:      3.512008

 Formula: A ~ 1 | block %in% Site %in% year
        A.(Intercept) Residual
StdDev:  1.712714e-76 10.75765

Fixed effects:  A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec 
                       Value Std.Error DF    t-value p-value
A.(Intercept)      242.18244   99.9327 18  2.4234557  0.0261
A.soil_0_20_clay    -2.37735    1.3420 18 -1.7714418  0.0934
A.soil_0_20_pH_H2O  -0.86288    4.8523 18 -0.1778294  0.8608
A.ansum_sun          0.00453    0.0405 18  0.1117703  0.9122
A.ansum_prec        -0.06433    0.0385 18 -1.6702902  0.1122
k.(Intercept)      -35.69127  733.0589 18 -0.0486881  0.9617
k.soil_0_20_clay     9.68568   20.3692 18  0.4755054  0.6401
k.soil_0_20_pH_H2O  42.48863   74.4105 18  0.5710035  0.5751
k.ansum_sun         -0.18169    0.2507 18 -0.7248095  0.4779
k.ansum_prec        -0.19839    0.1940 18 -1.0224586  0.3201
E.(Intercept)       -8.42292    9.2740 18 -0.9082312  0.3758
E.soil_0_20_clay    -0.08828    0.1099 18 -0.8030627  0.4324
E.soil_0_20_pH_H2O   0.43207    0.5734 18  0.7534716  0.4609
E.ansum_sun          0.00311    0.0023 18  1.3377403  0.1976
E.ansum_prec         0.00063    0.0023 18  0.2784023  0.7839
 Correlation: 
                   A.(In) A.s_0_20_ A._0_20_H A.nsm_s A.nsm_p k.(In) k.s_0_20_
A.soil_0_20_clay   -0.202                                                     
A.soil_0_20_pH_H2O -0.481  0.269                                              
A.ansum_sun        -0.727 -0.460     0.150                                    
A.ansum_prec       -0.557 -0.239    -0.252     0.542                          
k.(Intercept)      -0.048 -0.259     0.045     0.238   0.041                  
k.soil_0_20_clay    0.108  0.566     0.053    -0.519  -0.195  -0.741          
k.soil_0_20_pH_H2O  0.074  0.552    -0.003    -0.461  -0.148  -0.865  0.957   
k.ansum_sun        -0.096 -0.633    -0.092     0.542   0.237   0.253 -0.828   
k.ansum_prec       -0.104 -0.621    -0.088     0.536   0.237   0.082 -0.664   
E.(Intercept)       0.199 -0.466    -0.076     0.146  -0.053   0.826 -0.570   
E.soil_0_20_clay    0.080  0.246     0.143    -0.293  -0.149  -0.633  0.796   
E.soil_0_20_pH_H2O -0.049  0.600     0.158    -0.387  -0.153  -0.825  0.824   
E.ansum_sun        -0.308  0.230    -0.028     0.163   0.197  -0.356 -0.085   
E.ansum_prec       -0.249 -0.105    -0.124     0.286   0.372  -0.330 -0.155   
                   k._0_20_H k.nsm_s k.nsm_p E.(In) E.s_0_20_ E._0_20_H E.nsm_s
A.soil_0_20_clay                                                               
A.soil_0_20_pH_H2O                                                             
A.ansum_sun                                                                    
A.ansum_prec                                                                   
k.(Intercept)                                                                  
k.soil_0_20_clay                                                               
k.soil_0_20_pH_H2O                                                             
k.ansum_sun        -0.685                                                      
k.ansum_prec       -0.542     0.867                                            
E.(Intercept)      -0.709     0.164   0.028                                    
E.soil_0_20_clay    0.720    -0.591  -0.404  -0.459                            
E.soil_0_20_pH_H2O  0.899    -0.526  -0.414  -0.867  0.707                     
E.ansum_sun         0.118     0.385   0.339  -0.684 -0.303     0.306           
E.ansum_prec       -0.012     0.450   0.672  -0.553 -0.160     0.116     0.703 

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-2.90069009 -0.61991716 -0.01031473  0.51093634  4.38888646 

Number of Observations: 64
Number of Groups: 
                     year            Site %in% year block %in% Site %in% year 
                        2                         8                        32 
Code
anova(fit.mitscherlich.CO2.Yrel)
                   numDF denDF   F-value p-value
A.(Intercept)          1    18 3026.9437  <.0001
A.soil_0_20_clay       1    18  293.8330  <.0001
A.soil_0_20_pH_H2O     1    18    8.5656  0.0090
A.ansum_sun            1    18   18.4450  0.0004
A.ansum_prec           1    18    2.6270  0.1224
k.(Intercept)          1    18    2.0230  0.1720
k.soil_0_20_clay       1    18    0.0429  0.8382
k.soil_0_20_pH_H2O     1    18    0.8471  0.3695
k.ansum_sun            1    18    1.4533  0.2436
k.ansum_prec           1    18    1.0222  0.3254
E.(Intercept)          1    18    8.9965  0.0077
E.soil_0_20_clay       1    18    1.6959  0.2092
E.soil_0_20_pH_H2O     1    18    0.0518  0.8225
E.ansum_sun            1    18    2.5774  0.1258
E.ansum_prec           1    18    0.0775  0.7839
Code
model_performance(fit.mitscherlich.CO2.Yrel)
# Indices of model performance

AIC     |    AICc |     BIC |   RMSE |  Sigma
---------------------------------------------
548.486 | 565.758 | 589.504 | 10.496 | 10.758
Code
r.square.CO2 <- 1-sum(residuals(fit.mitscherlich.CO2.Yrel)^2)/sum((D$Ymain_rel-mean(D$Ymain_rel,na.rm=TRUE))^2,na.rm = TRUE)

# Fit the model
fit.mitscherlich.CO2.Yrel <- nlme(
  Ymain_norm ~ A * (1 - exp(-k * soil_0_20_P_CO2 + E)),                
  fixed = A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec,
  random = A ~ 1 | year/Site/block,
  data = D,
  subset = Treatment != "P166",
  start = c(
    A = 1100, A1 = 0, A2 = 0, A3 = 0, A4 = 0,
    k = 0.05, k1 = 0, k2 = 0, k3 = 0, k4 = 0,
    E = -3, E1 = 0, E2 = 0, E3 = 0, E4 = 0
  ),
  control = nlmeControl(maxIter = 500),
  na.action = na.omit
)
Warning in nlme.formula(Ymain_norm ~ A * (1 - exp(-k * soil_0_20_P_CO2 + :
Iteration 1, LME step: nlminb() did not converge (code = 1). PORT message:
false convergence (8)
Warning in nlme.formula(Ymain_norm ~ A * (1 - exp(-k * soil_0_20_P_CO2 + :
Non-finite log-likelihood replaced by maximally negative value
Code
summary(fit.mitscherlich.CO2.Yrel)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: Ymain_norm ~ A * (1 - exp(-k * soil_0_20_P_CO2 + E)) 
  Data: D 
  Subset: Treatment != "P166" 
        AIC       BIC   logLik
  -65.46004 -24.44126 51.73002

Random effects:
 Formula: A ~ 1 | year
        A.(Intercept)
StdDev:  3.401442e-07

 Formula: A ~ 1 | Site %in% year
        A.(Intercept)
StdDev:  1.250369e-05

 Formula: A ~ 1 | block %in% Site %in% year
        A.(Intercept)  Residual
StdDev:     0.0412576 0.1009889

Fixed effects:  A + k + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec 
                       Value Std.Error DF    t-value p-value
A.(Intercept)        0.85935   0.92707 18  0.9269461  0.3662
A.soil_0_20_clay     0.00520   0.00603 18  0.8617388  0.4002
A.soil_0_20_pH_H2O   0.04542   0.05071 18  0.8955985  0.3823
A.ansum_sun          0.00019   0.00027 18  0.7267131  0.4767
A.ansum_prec        -0.00076   0.00028 18 -2.7486077  0.0132
k.(Intercept)      -44.77553 170.38514 18 -0.2627901  0.7957
k.soil_0_20_clay    -0.91043   0.88586 18 -1.0277351  0.3177
k.soil_0_20_pH_H2O -13.63803  11.56905 18 -1.1788377  0.2538
k.ansum_sun          0.02657   0.04635 18  0.5733714  0.5735
k.ansum_prec         0.14919   0.09961 18  1.4977573  0.1515
E.(Intercept)      -48.51924  51.23631 18 -0.9469698  0.3562
E.soil_0_20_clay     0.00818   0.17746 18  0.0460744  0.9638
E.soil_0_20_pH_H2O  -0.27523   2.31329 18 -0.1189757  0.9066
E.ansum_sun          0.01173   0.01243 18  0.9439714  0.3577
E.ansum_prec         0.03234   0.02239 18  1.4445403  0.1658
 Correlation: 
                   A.(In) A.s_0_20_ A._0_20_H A.nsm_s A.nsm_p k.(In) k.s_0_20_
A.soil_0_20_clay   -0.672                                                     
A.soil_0_20_pH_H2O -0.793  0.777                                              
A.ansum_sun        -0.930  0.496     0.624                                    
A.ansum_prec       -0.233 -0.335    -0.263     0.216                          
k.(Intercept)       0.131 -0.174    -0.149    -0.065  -0.009                  
k.soil_0_20_clay   -0.160  0.138     0.257     0.120  -0.073  -0.472          
k.soil_0_20_pH_H2O -0.344  0.410     0.443     0.299  -0.206  -0.398  0.842   
k.ansum_sun        -0.011  0.036     0.017    -0.042   0.053  -0.931  0.217   
k.ansum_prec        0.147 -0.152    -0.257    -0.165   0.205  -0.470 -0.471   
E.(Intercept)       0.186 -0.171    -0.100    -0.123  -0.144   0.918 -0.266   
E.soil_0_20_clay   -0.212  0.210     0.214     0.136   0.051  -0.717  0.787   
E.soil_0_20_pH_H2O -0.388  0.441     0.416     0.311  -0.086  -0.659  0.710   
E.ansum_sun        -0.128  0.091     0.041     0.083   0.150  -0.899  0.160   
E.ansum_prec        0.067 -0.112    -0.222    -0.090   0.271  -0.545 -0.363   
                   k._0_20_H k.nsm_s k.nsm_p E.(In) E.s_0_20_ E._0_20_H E.nsm_s
A.soil_0_20_clay                                                               
A.soil_0_20_pH_H2O                                                             
A.ansum_sun                                                                    
A.ansum_prec                                                                   
k.(Intercept)                                                                  
k.soil_0_20_clay                                                               
k.soil_0_20_pH_H2O                                                             
k.ansum_sun         0.078                                                      
k.ansum_prec       -0.582     0.667                                            
E.(Intercept)      -0.225    -0.867  -0.628                                    
E.soil_0_20_clay    0.623     0.493   0.039  -0.694                            
E.soil_0_20_pH_H2O  0.854     0.369  -0.157  -0.634  0.825                     
E.ansum_sun         0.081     0.939   0.692  -0.958  0.541     0.463           
E.ansum_prec       -0.458     0.686   0.972  -0.735  0.169    -0.009     0.764 

Standardized Within-Group Residuals:
          Min            Q1           Med            Q3           Max 
-2.9466374325 -0.3121491790  0.0006899933  0.4620155338  3.5904220314 

Number of Observations: 64
Number of Groups: 
                     year            Site %in% year block %in% Site %in% year 
                        2                         8                        32 
Code
anova(fit.mitscherlich.CO2.Yrel)
                   numDF denDF  F-value p-value
A.(Intercept)          1    18 3935.945  <.0001
A.soil_0_20_clay       1    18    3.609  0.0736
A.soil_0_20_pH_H2O     1    18    1.432  0.2470
A.ansum_sun            1    18   38.638  <.0001
A.ansum_prec           1    18   26.333  0.0001
k.(Intercept)          1    18   42.277  <.0001
k.soil_0_20_clay       1    18    0.014  0.9061
k.soil_0_20_pH_H2O     1    18    0.465  0.5040
k.ansum_sun            1    18   13.685  0.0016
k.ansum_prec           1    18    0.433  0.5187
E.(Intercept)          1    18    1.410  0.2505
E.soil_0_20_clay       1    18    0.033  0.8585
E.soil_0_20_pH_H2O     1    18    0.012  0.9142
E.ansum_sun            1    18    0.061  0.8073
E.ansum_prec           1    18    2.087  0.1658
Code
model_performance(fit.mitscherlich.CO2.Yrel)
# Indices of model performance

AIC    |   AICc |    BIC |  RMSE | Sigma
----------------------------------------
14.391 | 31.663 | 55.410 | 0.095 | 0.101
Code
r.square.CO2 <- 1-sum(residuals(fit.mitscherlich.CO2.Yrel)^2)/sum((D$Ymain_rel-mean(D$Ymain_rel,na.rm=TRUE))^2,na.rm = TRUE)

With the covariate and random effect used as by Juliane Hirte we obtain \(R^2=\) 0.9999989, I don’t know how to interpret that, I fear that the model is overfitting data.

How do GRUD-measurements of \(C_P\) relate to the soil properties \(C_\text{org}\)-content, clay-content, silt-content and pH?

  • Hypothesis II: Given the known capacity of clay and silt compounds to adsorb orthophosphate a positive correlation between \(C_P\) (for both \(CO_2\) and AAE10) and silt- and clay-content. \(C_\text{org}\) has been reported to positively influence the capacity of Phosphorus as well, it is plausible it also shows a positive correlation with \(C_P\). AAE10 also deploys \(Na_4EDTA\) which is easily captured by \(Mg^{2+}\) and \(Ca^{2+}\), therefore it is officially by GRUD advised against being used in soils with \(\text{pH}>6.8\), therefore \(C_P\)-AAE10 will presumably be negatively correlated to pH.
In [7]:
Code


anova(fit.soil.CO2)
Type III Analysis of Variance Table with Satterthwaite's method
                  Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
soil_0_20_clay   0.01031 0.01031     1 39.033  0.3482 0.55854  
soil_0_20_pH_H2O 0.03990 0.03990     1 36.270  1.3477 0.25326  
soil_0_20_Corg   0.03609 0.03609     1 30.050  1.2192 0.27829  
soil_0_20_silt   0.01225 0.01225     1 36.371  0.4139 0.52405  
Fed              2.24907 2.24907     1  1.237 75.9765 0.04625 *
Ald              0.37933 0.37933     1  1.859 12.8143 0.07780 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
fit.soil.CO2 |> r.squaredGLMM()
           R2m       R2c
[1,] 0.3615715 0.9946094
Code
anova(fit.soil.AAE10)
Type III Analysis of Variance Table with Satterthwaite's method
                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
soil_0_20_clay   0.02689 0.02689     1 33.372  1.1447   0.29233    
soil_0_20_pH_H2O 0.00022 0.00022     1 36.721  0.0095   0.92271    
soil_0_20_Corg   0.55693 0.55693     1 38.895 23.7089 1.902e-05 ***
soil_0_20_silt   0.09825 0.09825     1 34.019  4.1824   0.04864 *  
Fed              0.42176 0.42176     1  1.848 17.9545   0.05892 .  
Ald              0.70761 0.70761     1  2.551 30.1233   0.01795 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
fit.soil.AAE10 |> r.squaredGLMM()
           R2m       R2c
[1,] 0.4938704 0.9965101

Can the Inclusion of the net-release-kinetic of Orthophosphate improve the model power of predicting relative Yield, P-Uptake and P-Balance?

  • Hypothesis III: Given the comparably low solubility of \(PO_4^{3-}\) in the water-soil interface, most P is transported to the rhizosphere via diffusion. As a consequence the intensity of \(PO_4^{3-}\) might not adequately account for the P-uptake in the harvested plant. Since the diffusion process is in its velocity a kinetic and in its finally reached intensity a thermodynamic process, the inclusion of kinetic parameters might well improve the performance.
In [8]:
Code

fit.mitscherlich.PS.Yrel <- nlme(
  Ymain_rel ~ A * (1 - exp(-r * PS + E)),                
  fixed = A + r + E ~ k + soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec,
  random = A ~ 1 | year/Site/block,
  data = D,
  start = c(
    A = 220, A1 = 0, A2 = 0, A3 = 0, A4 = 0, A5 = 0,
    r = 1, r1 = 0, r2 = 0, r3 = 0, r4 = 0, r5 = 0,
    E = -1, E1 = 0, E2 = 0, E3 = 0, E4 = 0, E5 = 0
  ),
  control = nlmeControl(maxIter = 500),
  na.action = na.omit
)

summary(fit.mitscherlich.PS.Yrel)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: Ymain_rel ~ A * (1 - exp(-r * PS + E)) 
  Data: D 
      AIC      BIC   logLik
  756.704 812.6565 -356.352

Random effects:
 Formula: A ~ 1 | year
        A.(Intercept)
StdDev:   0.001434366

 Formula: A ~ 1 | Site %in% year
        A.(Intercept)
StdDev:      4.135705

 Formula: A ~ 1 | block %in% Site %in% year
        A.(Intercept) Residual
StdDev:  2.098085e-05 10.26954

Fixed effects:  A + r + E ~ k + soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun +      ansum_prec 
                       Value Std.Error DF    t-value p-value
A.(Intercept)       159.3520   91.1962 45  1.7473529  0.0874
A.k                 -25.4193   30.3021 45 -0.8388642  0.4060
A.soil_0_20_clay      0.3554    0.4095 45  0.8678259  0.3901
A.soil_0_20_pH_H2O    4.9194    4.3133 45  1.1405232  0.2601
A.ansum_sun          -0.0257    0.0269 45 -0.9524325  0.3460
A.ansum_prec         -0.0623    0.0288 45 -2.1634395  0.0359
r.(Intercept)      2284.8408 1418.9108 45  1.6102779  0.1143
r.k                 334.2789  237.5217 45  1.4073615  0.1662
r.soil_0_20_clay     -3.5798    2.4890 45 -1.4382872  0.1573
r.soil_0_20_pH_H2O -100.7852   62.7013 45 -1.6073858  0.1150
r.ansum_sun          -0.5390    0.3332 45 -1.6176110  0.1127
r.ansum_prec         -0.5023    0.3122 45 -1.6088164  0.1147
E.(Intercept)        63.8366   53.9968 45  1.1822310  0.2433
E.k                  22.9236   12.6296 45  1.8150670  0.0762
E.soil_0_20_clay      0.0488    0.0483 45  1.0101435  0.3178
E.soil_0_20_pH_H2O   -1.1850    1.4792 45 -0.8010865  0.4273
E.ansum_sun          -0.0174    0.0144 45 -1.2077238  0.2335
E.ansum_prec         -0.0327    0.0228 45 -1.4328213  0.1588
 Correlation: 
                   A.(In) A.k    A.s_0_20_ A._0_20_H A.nsm_s A.nsm_p r.(In)
A.k                 0.088                                                  
A.soil_0_20_clay   -0.504  0.082                                           
A.soil_0_20_pH_H2O -0.747 -0.263  0.589                                    
A.ansum_sun        -0.931 -0.071  0.340     0.565                          
A.ansum_prec       -0.623 -0.130 -0.077     0.165     0.539                
r.(Intercept)       0.326 -0.153 -0.221    -0.392    -0.249  -0.108        
r.k                 0.164 -0.283 -0.081    -0.174    -0.128  -0.052   0.807
r.soil_0_20_clay   -0.221  0.216  0.118     0.266     0.165   0.076  -0.935
r.soil_0_20_pH_H2O -0.325  0.173  0.223     0.380     0.251   0.108  -0.996
r.ansum_sun        -0.333  0.140  0.226     0.404     0.254   0.111  -0.999
r.ansum_prec       -0.310  0.161  0.206     0.378     0.236   0.099  -0.997
E.(Intercept)       0.336 -0.151 -0.213    -0.385    -0.260  -0.129   0.976
E.k                 0.235 -0.071 -0.120    -0.322    -0.171  -0.081   0.832
E.soil_0_20_clay    0.089 -0.084  0.010    -0.122    -0.076  -0.035   0.551
E.soil_0_20_pH_H2O -0.327  0.025  0.193     0.390     0.248   0.145  -0.779
E.ansum_sun        -0.334  0.165  0.212     0.376     0.264   0.124  -0.979
E.ansum_prec       -0.299  0.180  0.189     0.351     0.227   0.108  -0.985
                   r.k    r.s_0_20_ r._0_20_H r.nsm_s r.nsm_p E.(In) E.k   
A.k                                                                        
A.soil_0_20_clay                                                           
A.soil_0_20_pH_H2O                                                         
A.ansum_sun                                                                
A.ansum_prec                                                               
r.(Intercept)                                                              
r.k                                                                        
r.soil_0_20_clay   -0.943                                                  
r.soil_0_20_pH_H2O -0.836  0.942                                           
r.ansum_sun        -0.778  0.919     0.990                                 
r.ansum_prec       -0.828  0.950     0.990     0.994                       
E.(Intercept)       0.799 -0.916    -0.979    -0.972  -0.969               
E.k                 0.888 -0.891    -0.845    -0.815  -0.845   0.809       
E.soil_0_20_clay    0.334 -0.413    -0.524    -0.566  -0.560   0.491  0.335
E.soil_0_20_pH_H2O -0.603  0.703     0.798     0.774   0.751  -0.867 -0.706
E.ansum_sun        -0.795  0.913     0.979     0.977   0.973  -0.995 -0.787
E.ansum_prec       -0.855  0.955     0.982     0.979   0.992  -0.972 -0.850
                   E.s_0_20_ E._0_20_H E.nsm_s
A.k                                           
A.soil_0_20_clay                              
A.soil_0_20_pH_H2O                            
A.ansum_sun                                   
A.ansum_prec                                  
r.(Intercept)                                 
r.k                                           
r.soil_0_20_clay                              
r.soil_0_20_pH_H2O                            
r.ansum_sun                                   
r.ansum_prec                                  
E.(Intercept)                                 
E.k                                           
E.soil_0_20_clay                              
E.soil_0_20_pH_H2O -0.210                     
E.ansum_sun        -0.538     0.824           
E.ansum_prec       -0.572     0.746     0.977 

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-3.62053951 -0.40518895  0.02478129  0.53746770  4.15921453 

Number of Observations: 94
Number of Groups: 
                     year            Site %in% year block %in% Site %in% year 
                        2                         8                        32 
Code
anova(fit.mitscherlich.PS.Yrel)
                   numDF denDF   F-value p-value
A.(Intercept)          1    45 2488.4068  <.0001
A.k                    1    45    2.3144  0.1352
A.soil_0_20_clay       1    45    2.2731  0.1386
A.soil_0_20_pH_H2O     1    45   29.8949  <.0001
A.ansum_sun            1    45    6.5752  0.0137
A.ansum_prec           1    45    2.6606  0.1098
r.(Intercept)          1    45   21.0005  <.0001
r.k                    1    45    1.9181  0.1729
r.soil_0_20_clay       1    45    0.1437  0.7064
r.soil_0_20_pH_H2O     1    45    6.0053  0.0182
r.ansum_sun            1    45    0.1454  0.7048
r.ansum_prec           1    45    9.4644  0.0036
E.(Intercept)          1    45   26.4308  <.0001
E.k                    1    45    0.9943  0.3240
E.soil_0_20_clay       1    45    0.0699  0.7926
E.soil_0_20_pH_H2O     1    45    0.0668  0.7973
E.ansum_sun            1    45    0.8021  0.3752
E.ansum_prec           1    45    2.0530  0.1588
Code
model_performance(fit.mitscherlich.PS.Yrel)
# Indices of model performance

AIC     |    AICc |     BIC |  RMSE |  Sigma
--------------------------------------------
765.695 | 779.948 | 821.647 | 9.989 | 10.270
Code
r.square.PS <- 1-sum(residuals(fit.mitscherlich.PS.Yrel)^2)/sum((D$Ymain_rel-mean(D$Ymain_rel,na.rm=TRUE))^2,na.rm = TRUE)

fit.mitscherlich.kPS.Yrel <- nlme(
  Ymain_rel ~ A * (1 - exp(-k * PS + E)),                
  fixed = A + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec,
  random = A ~ 1 | year/Site/block,
  data = D,
  start = c(
    A = 220, A1 = 0, A2 = 0, A3 = 0, A4 = 0,
    E = -1, E1 = 0, E2 = 0, E3 = 0, E4 = 0
  ),
  control = nlmeControl(maxIter = 500),
  na.action = na.omit
)

summary(fit.mitscherlich.kPS.Yrel)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: Ymain_rel ~ A * (1 - exp(-k * PS + E)) 
  Data: D 
       AIC      BIC    logLik
  757.7736 793.3798 -364.8868

Random effects:
 Formula: A ~ 1 | year
        A.(Intercept)
StdDev:    0.00112278

 Formula: A ~ 1 | Site %in% year
        A.(Intercept)
StdDev:   0.008239412

 Formula: A ~ 1 | block %in% Site %in% year
        A.(Intercept) Residual
StdDev:   2.69498e-05 11.73805

Fixed effects:  A + E ~ soil_0_20_clay + soil_0_20_pH_H2O + ansum_sun + ansum_prec 
                       Value Std.Error DF   t-value p-value
A.(Intercept)      2690.1350  985.2790 53  2.730328  0.0086
A.soil_0_20_clay      5.8621    3.0618 53  1.914606  0.0609
A.soil_0_20_pH_H2O  -75.2347   37.4744 53 -2.007628  0.0498
A.ansum_sun          -0.7671    0.2684 53 -2.858049  0.0061
A.ansum_prec         -0.6208    0.2478 53 -2.505009  0.0154
E.(Intercept)         0.6989    0.5030 53  1.389531  0.1705
E.soil_0_20_clay      0.0069    0.0040 53  1.715683  0.0921
E.soil_0_20_pH_H2O   -0.0352    0.0289 53 -1.219687  0.2280
E.ansum_sun          -0.0004    0.0002 53 -2.210431  0.0314
E.ansum_prec         -0.0002    0.0002 53 -1.427522  0.1593
 Correlation: 
                   A.(In) A.s_0_20_ A._0_20_H A.nsm_s A.nsm_p E.(In) E.s_0_20_
A.soil_0_20_clay   -0.024                                                     
A.soil_0_20_pH_H2O -0.857  0.189                                              
A.ansum_sun        -0.963 -0.098     0.725                                    
A.ansum_prec       -0.873 -0.184     0.620     0.829                          
E.(Intercept)       0.197 -0.757    -0.214    -0.136  -0.092                  
E.soil_0_20_clay   -0.791  0.449     0.717     0.719   0.574  -0.393          
E.soil_0_20_pH_H2O  0.014  0.643     0.399    -0.184  -0.246  -0.593  0.197   
E.ansum_sun         0.266  0.555    -0.317    -0.204  -0.330  -0.800 -0.088   
E.ansum_prec       -0.040  0.243    -0.140    -0.016   0.345  -0.562 -0.030   
                   E._0_20_H E.nsm_s
A.soil_0_20_clay                    
A.soil_0_20_pH_H2O                  
A.ansum_sun                         
A.ansum_prec                        
E.(Intercept)                       
E.soil_0_20_clay                    
E.soil_0_20_pH_H2O                  
E.ansum_sun         0.329           
E.ansum_prec       -0.022     0.451 

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-2.72142747 -0.51960209 -0.04192907  0.54601061  4.70468829 

Number of Observations: 94
Number of Groups: 
                     year            Site %in% year block %in% Site %in% year 
                        2                         8                        32 
Code
anova(fit.mitscherlich.kPS.Yrel)
                   numDF denDF   F-value p-value
A.(Intercept)          1    53 14865.096  <.0001
A.soil_0_20_clay       1    53   474.026  <.0001
A.soil_0_20_pH_H2O     1    53     0.724  0.3986
A.ansum_sun            1    53   286.635  <.0001
A.ansum_prec           1    53   305.097  <.0001
E.(Intercept)          1    53     1.553  0.2182
E.soil_0_20_clay       1    53     3.035  0.0873
E.soil_0_20_pH_H2O     1    53     0.401  0.5295
E.ansum_sun            1    53     3.082  0.0850
E.ansum_prec           1    53     2.038  0.1593
Code
model_performance(fit.mitscherlich.kPS.Yrel)
# Indices of model performance

AIC     |    AICc |     BIC |   RMSE |  Sigma
---------------------------------------------
804.491 | 809.807 | 840.097 | 11.738 | 11.738
Code
r.square.kPS <- 1-sum(residuals(fit.mitscherlich.kPS.Yrel)^2)/sum((D$Ymain_rel-mean(D$Ymain_rel,na.rm=TRUE))^2,na.rm = TRUE)

With the covariate and random effect used as by Juliane Hirte we obtain \(R^2=\) 0.9823775, I don’t know how to interpret that, I fear that the model is overfitting data, the same might be true for the model that used \(k\times PS\) as a predictor with \(R^2=\) 0.975664.

I also tried more conservative models, where I log-transformed the concentrations and PS, also I was more cautious with random effects. This resulted in coefficients that were not as straight-forward as the mitscherlich coefficients to interpret.

In [9]:
Code

# relative Yield
anova(fit.kin.Yrel)
Type III Analysis of Variance Table with Satterthwaite's method
           Sum Sq Mean Sq NumDF  DenDF F value   Pr(>F)   
k         10361.3 10361.3     1 243.49  7.0248 0.008566 **
log(PS)    9132.5  9132.5     1 243.72  6.1918 0.013504 * 
k:log(PS) 12026.0 12026.0     1 243.87  8.1535 0.004668 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
summary(fit.kin.Yrel)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: Ymain_rel ~ k * log(PS) + (1 | year) + (1 | Site) + (1 | Site:block)
   Data: D

REML criterion at convergence: 2566.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.5325 -0.3160 -0.0669  0.3200  3.8807 

Random effects:
 Groups     Name        Variance Std.Dev.
 Site:block (Intercept)    0.0    0.00   
 year       (Intercept)  840.6   28.99   
 Site       (Intercept)  254.1   15.94   
 Residual               1474.9   38.41   
Number of obs: 254, groups:  Site:block, 20; year, 6; Site, 5

Fixed effects:
            Estimate Std. Error     df t value Pr(>|t|)   
(Intercept)    56.38      28.72  90.88   1.963  0.05268 . 
k             377.50     142.43 243.49   2.650  0.00857 **
log(PS)       -27.49      11.05 243.72  -2.488  0.01350 * 
k:log(PS)     171.51      60.06 243.87   2.855  0.00467 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
          (Intr) k      lg(PS)
k         -0.830              
log(PS)    0.816 -0.871       
k:log(PS) -0.790  0.934 -0.955
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
Code
fit.kin.Yrel |> r.squaredGLMM()
            R2m       R2c
[1,] 0.02182182 0.4385486
Code
# P-Uptake
anova(fit.kin.Pexport)
Type III Analysis of Variance Table with Satterthwaite's method
          Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
k         35.305  35.305     1 247.74  0.5252 0.4693
log(PS)   39.586  39.586     1 248.15  0.5889 0.4436
k:log(PS) 53.624  53.624     1 248.29  0.7978 0.3726
Code
summary(fit.kin.Pexport)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: annual_P_uptake ~ k * log(PS) + (1 | year) + (1 | Site) + (1 |  
    Site:block)
   Data: D

REML criterion at convergence: 1835.9

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.1240 -0.4693 -0.0175  0.3715  4.7721 

Random effects:
 Groups     Name        Variance Std.Dev.
 Site:block (Intercept)  0.00    0.000   
 year       (Intercept) 73.71    8.585   
 Site       (Intercept) 37.56    6.129   
 Residual               67.22    8.199   
Number of obs: 259, groups:  Site:block, 16; year, 6; Site, 4

Fixed effects:
            Estimate Std. Error      df t value Pr(>|t|)    
(Intercept)   29.599      7.412  44.304   3.993 0.000242 ***
k             22.622     31.215 247.742   0.725 0.469307    
log(PS)        1.954      2.547 248.145   0.767 0.443570    
k:log(PS)     11.928     13.354 248.286   0.893 0.372632    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
          (Intr) k      lg(PS)
k         -0.746              
log(PS)    0.728 -0.898       
k:log(PS) -0.709  0.945 -0.965
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
Code
fit.kin.Pexport |> r.squaredGLMM()
            R2m       R2c
[1,] 0.06433359 0.6476313
Code
anova(fit.kin.Pbalance)
Type III Analysis of Variance Table with Satterthwaite's method
           Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
k          411.53  411.53     1 228.31  2.6679    0.1038    
log(PS)   2451.67 2451.67     1 236.98 15.8941 8.925e-05 ***
k:log(PS)  335.79  335.79     1 232.66  2.1769    0.1414    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
summary(fit.kin.Pbalance)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: annual_P_balance ~ k * log(PS) + (1 | year) + (1 | Site) + (1 |  
    Site:block)
   Data: D

REML criterion at convergence: 2172.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-4.2416 -0.5978  0.0314  0.5493  2.8712 

Random effects:
 Groups     Name        Variance Std.Dev.
 Site:block (Intercept)  20.33    4.508  
 year       (Intercept)  59.32    7.702  
 Site       (Intercept)  23.97    4.896  
 Residual               154.25   12.420  
Number of obs: 274, groups:  Site:block, 16; year, 6; Site, 4

Fixed effects:
            Estimate Std. Error      df t value Pr(>|t|)    
(Intercept)   43.833     10.402 146.531   4.214 4.37e-05 ***
k             84.993     52.035 228.313   1.633    0.104    
log(PS)       16.947      4.251 236.979   3.987 8.92e-05 ***
k:log(PS)     33.029     22.386 232.660   1.475    0.141    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
          (Intr) k      lg(PS)
k         -0.887              
log(PS)    0.858 -0.901       
k:log(PS) -0.843  0.944 -0.971
Code
fit.kin.Pbalance |> r.squaredGLMM()
           R2m       R2c
[1,] 0.5718185 0.7438699

Is the method presented by Flossmann and Richter (1982) with the double extraction replicable with the soils from the STYCS-trial?

  • Hypothesis V: The authors expect the desorption kinetics to follow a 1. order kinetic, with the relation: \[ \frac{dP}{dt}=PS(1-e^{-kt})\] where \(PS\) is estimated as \(PS=[P_\text{Olsen/CAL}]-[P_{H_2O}]\), denoted as the semi-labile P-pool. The Olsen- and CAL-method deploy extractants that increase the solubility by more than order of magnitude. This presents the problem, that the estimation of \(PS\) is likely to high. It was chosen by the authors in order to make the equation linearizable, so if the linearization is not well behaved, a non-linear regression might deliver a better estimation of both parameters.
In [11]:
Code

res <- lmList(Y1 ~ t.min. | uid, d[d$Repetition==1|d$Repetition==2,],na.action = na.pass)
Warning: 12 times caught the same error in lm.fit(x, y, offset = offset,
singular.ok = singular.ok, ...): NA/NaN/Inf in 'y'
Code
summary(res)
Warning in summary.lm(el): essentially perfect fit: summary may be unreliable
Call:
  Model: Y1 ~ t.min. | uid 
   Data: d[d$Repetition == 1 | d$Repetition == 2, ] 

Coefficients:
   (Intercept) 
                      Estimate Std. Error    t value     Pr(>|t|)
Cadenazzo_P0_1     -0.12891945 0.01537006  -8.387702 4.332766e-12
Cadenazzo_P0_2     -0.12037045 0.01537006  -7.831491 4.433395e-11
Cadenazzo_P100_1            NA         NA         NA           NA
Cadenazzo_P100_2            NA         NA         NA           NA
Cadenazzo_P166_1   -0.26932199 0.01537006 -17.522512 6.499702e-27
Cadenazzo_P166_2   -0.19243796 0.01537006 -12.520316 2.550625e-19
Ellighausen_P0_1   -0.10464296 0.01537006  -6.808236 3.136905e-09
Ellighausen_P0_2   -0.11438112 0.01537006  -7.441815 2.257472e-10
Ellighausen_P100_1          NA         NA         NA           NA
Ellighausen_P100_2          NA         NA         NA           NA
Ellighausen_P166_1          NA         NA         NA           NA
Oensingen_P0_1     -0.03432646 0.01537006  -2.233333 2.882091e-02
Oensingen_P0_2     -0.05745952 0.01537006  -3.738407 3.819350e-04
Oensingen_P100_1            NA         NA         NA           NA
Oensingen_P100_2            NA         NA         NA           NA
Oensingen_P166_1   -0.13275856 0.01537006  -8.637481 1.527196e-12
Oensingen_P166_2   -0.17051390 0.01537006 -11.093902 6.616653e-17
Reckenholz_P0_1    -0.10545869 0.01537006  -6.861308 2.519112e-09
Reckenholz_P0_2    -0.08557888 0.01537006  -5.567897 4.753375e-07
Reckenholz_P100_1           NA         NA         NA           NA
Reckenholz_P100_2           NA         NA         NA           NA
Reckenholz_P166_1  -0.17172348 0.01537006 -11.172600 4.839473e-17
Reckenholz_P166_2  -0.23296391 0.01537006 -15.156998 1.712692e-23
Ruemlang_P0_1      -0.01851905 0.01537006  -1.204878 2.324269e-01
Ruemlang_P0_2      -0.08675331 0.01537006  -5.644307 3.515958e-07
Ruemlang_P100_1             NA         NA         NA           NA
Ruemlang_P100_2             NA         NA         NA           NA
Ruemlang_P166_1    -0.26153690 0.01537006 -17.016002 3.315417e-26
Ruemlang_P166_2             NA         NA         NA           NA
   t.min. 
                        Estimate   Std. Error       t value     Pr(>|t|)
Cadenazzo_P0_1     -1.318800e-03 0.0004483906 -2.941186e+00 4.466020e-03
Cadenazzo_P0_2     -1.272378e-03 0.0004483906 -2.837654e+00 5.984783e-03
Cadenazzo_P100_1              NA           NA            NA           NA
Cadenazzo_P100_2              NA           NA            NA           NA
Cadenazzo_P166_1   -5.270369e-03 0.0004483906 -1.175397e+01 4.905164e-18
Cadenazzo_P166_2   -3.394812e-03 0.0004483906 -7.571105e+00 1.316077e-10
Ellighausen_P0_1    4.952586e-05 0.0004483906  1.104525e-01 9.123759e-01
Ellighausen_P0_2   -1.260933e-04 0.0004483906 -2.812130e-01 7.794010e-01
Ellighausen_P100_1            NA           NA            NA           NA
Ellighausen_P100_2            NA           NA            NA           NA
Ellighausen_P166_1            NA           NA            NA           NA
Oensingen_P0_1      1.049070e-04 0.0004483906  2.339634e-01 8.157164e-01
Oensingen_P0_2     -1.837559e-04 0.0004483906 -4.098121e-01 6.832320e-01
Oensingen_P100_1              NA           NA            NA           NA
Oensingen_P100_2              NA           NA            NA           NA
Oensingen_P166_1   -2.320568e-04 0.0004483906 -5.175327e-01 6.064639e-01
Oensingen_P166_2   -5.531502e-04 0.0004483906 -1.233635e+00 2.215861e-01
Reckenholz_P0_1     2.780943e-04 0.0004483906  6.202053e-01 5.371956e-01
Reckenholz_P0_2    -7.752286e-04 0.0004483906 -1.728914e+00 8.836252e-02
Reckenholz_P100_1             NA           NA            NA           NA
Reckenholz_P100_2             NA           NA            NA           NA
Reckenholz_P166_1  -1.609218e-03 0.0004483906 -3.588876e+00 6.216266e-04
Reckenholz_P166_2  -4.831330e-03 0.0004483906 -1.077482e+01 2.367928e-16
Ruemlang_P0_1       8.878899e-20 0.0004483906  1.980171e-16 1.000000e+00
Ruemlang_P0_2      -1.438957e-03 0.0004483906 -3.209160e+00 2.032261e-03
Ruemlang_P100_1               NA           NA            NA           NA
Ruemlang_P100_2               NA           NA            NA           NA
Ruemlang_P166_1    -1.090605e-03 0.0004483906 -2.432266e+00 1.764226e-02
Ruemlang_P166_2               NA           NA            NA           NA

Residual standard error: 0.02119011 on 68 degrees of freedom
Code
ggplot(d, aes(y=Y1, x=t.min., col = Repetition)) +
  geom_point() +
  facet_grid(Site ~ Treatment) + 
  labs(x=TeX("$Time (min)$"),
       y=TeX("$ln(1-\\frac{P}{P_S})$")) +
  geom_smooth(method="lm", alpha = 0.3) 
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 292 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 292 rows containing missing values or values outside the scale range
(`geom_point()`).

The relation can be improved:

In [12]:
Code

Res <- nlsList(Pv.mg.L. ~ PS * (1 - exp(-k * (t.dt))) | uid, d[, c("Pv.mg.L.", "uid", "t.dt")],  start=list(PS=0.1,k=0.2))
Warning: 1 error caught in nls(model, data = data, control = controlvals, start
= start): singular gradient
Code
# summary(Res)
# d$nls_pred <- predict(Res)

# Extract coefficients from the nlsList results
nls_coefs <- coef(Res)
nls_coefs$uid <- rownames(nls_coefs)

# Merge coefficients back to the main dataset
d_plot <- merge(d, nls_coefs, by = "uid")

# Most straightforward approach - create curves manually
time_seq <- seq(min(d$t.dt, na.rm = TRUE), max(d$t.dt, na.rm = TRUE), length.out = 100)

# Create prediction data
pred_data <- d_plot %>%
  select(uid, Site, Treatment, Repetition, PS, k) %>%
  distinct() %>%
  crossing(t.dt = time_seq) %>%
  mutate(pred_Pv = PS * (1 - exp(-k * (t.dt))))

# Final plot
p1 <- ggplot() +
  geom_point(data = d_plot, aes(y = Pv.mg.L., x = t.dt, col = Repetition)) +
  geom_line(data = pred_data, aes(x = t.dt, y = pred_Pv, col = Repetition), size = 0.5) +
  facet_grid(Treatment ~ Site) +
  labs(x = TeX("$Time (min)$"),
       y = TeX("$P_{V}(\\frac{mg}{L})$")); suppressWarnings(print(p1))

Now we see how those parameters depend on the tratment:

In [13]:
Code

d$ui <- interaction(d$Site, d$Treatment)

nlme.coef.avg <- list()
nlme.coef <- list()
for (lvl in levels(d$ui)){
  d.tmp <- subset(d, ui == lvl)
  # first get nlsList coefs for comparison only (unused)
  temp_nls <- coef(nlsList(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)) | uid, 
                    d.tmp[, c("Pv.mg.L.", "uid", "t.dt")], 
                    start = list(PS = 0.1, k = 0.2)))
  nlsList_coefs <- c(apply(temp_nls, 2, \(x) c(mean=mean(x), sd=sd(x))))
  names(nlsList_coefs) <- c("PS.mean", "PS.sd", "k.mean", "k.sd")

  # now do the real thing
  model4 <- nlme(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)),
                fixed = PS + k ~ 1,
                random = PS + k  ~ 1 | uid,
                data = d.tmp[, c("Pv.mg.L.", "uid", "t.dt")],
                start = c(PS = 0.05, k = 0.12),
                control = nlmeControl(maxIter = 200))
  coef(model4)
  fixef <- model4$coefficients$fixed
  ranefs <- ranef(model4)
  colnames(ranefs) <- paste0("ranef_",colnames(ranefs))
  nlme.coef[[lvl]]  <- cbind(coef(model4), ranefs, Rep=1:nrow(ranef(model4)), ui=lvl, Site=d.tmp[1, "Site"], Treatment=d.tmp[1, "Treatment"], uid = rownames(coef(model4)))
  nlme.coef.avg[[lvl]] <- data.frame(PS=fixef["PS"], k=fixef["k"], ui=lvl, Site=d.tmp[1, "Site"], Treatment=d.tmp[1, "Treatment"], uid = d.tmp$uid)
}
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning: 1 error caught in nls(model, data = data, control = controlvals, start
= start): singular gradient
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase
'msMaxIter'!
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Warning in nlme.formula(Pv.mg.L. ~ PS * (1 - exp(-k * t.dt)), fixed = PS + :
Singular precision matrix in level -1, block 1
Warning in data.frame(PS = fixef["PS"], k = fixef["k"], ui = lvl, Site =
d.tmp[1, : row names were found from a short variable and have been discarded
Code
nlme.coef.avg <- do.call(rbind, nlme.coef.avg)
# folgendes datenset wollen wir benutzen um ihn mit dem Boden zu kombinieren
nlme.coef <- do.call(rbind, nlme.coef)
points <- geom_point(position=position_dodge(width=0.5), size = 3, alpha = 0.5)

ggplot(nlme.coef, aes(y=PS  , x=Treatment, col=Site, pch=Treatment)) + points + scale_y_log10()

Code
ggplot(nlme.coef, aes(y=k   , x=Treatment, col=Site, pch=Treatment)) + points

Code
ggplot(nlme.coef, aes(y=k*PS, x=Treatment, col=Site, pch=Treatment)) + points + scale_y_log10()

Code
ggplot(nlme.coef, aes(y=PS  , x=Site, col=Treatment)) + points + scale_y_log10()

Code
ggplot(nlme.coef, aes(y=k   , x=Site, col=Treatment)) + points

Code
ggplot(nlme.coef, aes(y=k*PS, x=Site, col=Treatment)) + points + scale_y_log10()

Code
# k PS macht von der interpretation her Sinn
# aber PS ist log-normal verteilt


fit.PS   <- lm(log(PS)      ~ Treatment + Site, nlme.coef)
fit.k    <- lm(k            ~ Treatment + Site, nlme.coef)
fit.kPS  <- lm(I(log(k*PS)) ~ Treatment + Site, nlme.coef)


Anova(fit.PS)
Anova Table (Type II tests)

Response: log(PS)
           Sum Sq Df  F value    Pr(>F)    
Treatment 27.6260  2 154.7655 < 2.2e-16 ***
Site       3.0383  4   8.5104 2.324e-05 ***
Residuals  4.6411 52                       
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
summary(glht(fit.PS, mcp(Treatment = "Tukey")))

     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: lm(formula = log(PS) ~ Treatment + Site, data = nlme.coef)

Linear Hypotheses:
                 Estimate Std. Error t value Pr(>|t|)    
P100 - P0 == 0    0.91948    0.09447   9.733   <1e-10 ***
P166 - P0 == 0    1.68127    0.09580  17.550   <1e-10 ***
P166 - P100 == 0  0.76179    0.09580   7.952   <1e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
Code
# Fazit: PS wird von treatment stark beeinfluss, k eher nicht (dafür von site)
Anova(fit.k)
Anova Table (Type II tests)

Response: k
            Sum Sq Df F value    Pr(>F)    
Treatment 0.007374  2  1.6124    0.2092    
Site      0.108427  4 11.8547 6.442e-07 ***
Residuals 0.118902 52                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
summary(glht(fit.k, mcp(Treatment = "Tukey")))

     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: lm(formula = k ~ Treatment + Site, data = nlme.coef)

Linear Hypotheses:
                  Estimate Std. Error t value Pr(>|t|)
P100 - P0 == 0    0.003111   0.015121   0.206    0.977
P166 - P0 == 0   -0.022243   0.015334  -1.451    0.323
P166 - P100 == 0 -0.025354   0.015334  -1.653    0.233
(Adjusted p values reported -- single-step method)
Code
Anova(fit.kPS)
Anova Table (Type II tests)

Response: I(log(k * PS))
           Sum Sq Df F value    Pr(>F)    
Treatment 22.4177  2 68.5970 2.609e-15 ***
Site       3.9298  4  6.0124 0.0004703 ***
Residuals  8.4969 52                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
summary(glht(fit.kPS, mcp(Treatment = "Tukey")))

     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: lm(formula = I(log(k * PS)) ~ Treatment + Site, data = nlme.coef)

Linear Hypotheses:
                 Estimate Std. Error t value Pr(>|t|)    
P100 - P0 == 0     0.9127     0.1278   7.140  < 1e-05 ***
P166 - P0 == 0     1.5035     0.1296  11.599  < 1e-05 ***
P166 - P100 == 0   0.5908     0.1296   4.558 8.79e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
Code
anova(fit.soil.PS)
Type III Analysis of Variance Table with Satterthwaite's method
                 Sum Sq Mean Sq NumDF  DenDF  F value    Pr(>F)    
soil_0_20_clay   0.0017  0.0017     1 39.832   0.0467   0.82993    
soil_0_20_pH_H2O 0.0007  0.0007     1 38.367   0.0202   0.88762    
soil_0_20_Corg   0.1525  0.1525     1 32.811   4.2087   0.04827 *  
soil_0_20_silt   0.0000  0.0000     1 40.483   0.0002   0.98792    
Fed              4.9643  4.9643     1 36.018 137.0324 7.807e-14 ***
Ald              1.8349  1.8349     1 37.406  50.6502 1.865e-08 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
#summary(glht(fit.PS))
# Fazit: PS wird von treatment stark beeinfluss, k eher nicht (dafür von site)
anova(fit.soil.k)
Type III Analysis of Variance Table with Satterthwaite's method
                    Sum Sq   Mean Sq NumDF  DenDF F value   Pr(>F)   
soil_0_20_clay   0.0126524 0.0126524     1 32.124 11.0892 0.002190 **
soil_0_20_pH_H2O 0.0010892 0.0010892     1 38.528  0.9546 0.334637   
soil_0_20_Corg   0.0091554 0.0091554     1 31.652  8.0242 0.007963 **
soil_0_20_silt   0.0012806 0.0012806     1 13.842  1.1224 0.307539   
Fed              0.0001832 0.0001832     1  2.350  0.1606 0.722155   
Ald              0.0002817 0.0002817     1  2.262  0.2469 0.663422   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
summary(glht(fit.soil.k))
Warning in RET$pfunction("adjusted", ...): Completion with error > abseps

     Simultaneous Tests for General Linear Hypotheses

Fit: lmer(formula = k ~ soil_0_20_clay + soil_0_20_pH_H2O + soil_0_20_Corg + 
    soil_0_20_silt + Fed + Ald + (1 | year) + (1 | Site) + (1 | 
    Site:block) + (1 | Site:Treatment), data = D)

Linear Hypotheses:
                       Estimate Std. Error z value Pr(>|z|)   
(Intercept) == 0       0.454128   0.358773   1.266  0.70504   
soil_0_20_clay == 0   -0.016164   0.004854  -3.330  0.00538 **
soil_0_20_pH_H2O == 0 -0.020791   0.021279  -0.977  0.87784   
soil_0_20_Corg == 0    0.136661   0.048244   2.833  0.02724 * 
soil_0_20_silt == 0    0.004076   0.003848   1.059  0.83548   
Fed == 0               0.005157   0.012867   0.401  0.99838   
Ald == 0              -0.072344   0.145598  -0.497  0.99477   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
Code
anova(fit.soil.kPS)
Type III Analysis of Variance Table with Satterthwaite's method
                 Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
soil_0_20_clay   0.2899  0.2899     1 40.076  3.4177 0.07189 .
soil_0_20_pH_H2O 0.0186  0.0186     1 38.805  0.2198 0.64181  
soil_0_20_Corg   0.6111  0.6111     1 33.275  7.2042 0.01125 *
soil_0_20_silt   0.0039  0.0039     1 30.169  0.0457 0.83217  
Fed              4.9569  4.9569     1  1.276 58.4378 0.05081 .
Ald              1.7919  1.7919     1  2.143 21.1247 0.03873 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
summary(glht(fit.soil.kPS))

     Simultaneous Tests for General Linear Hypotheses

Fit: lmer(formula = I(log(k * PS)) ~ soil_0_20_clay + soil_0_20_pH_H2O + 
    soil_0_20_Corg + soil_0_20_silt + Fed + Ald + (1 | year) + 
    (1 | Site) + (1 | Site:block) + (1 | Site:Treatment), data = D)

Linear Hypotheses:
                      Estimate Std. Error z value Pr(>|z|)    
(Intercept) == 0      21.18866    3.96710   5.341   <0.001 ***
soil_0_20_clay == 0   -0.08522    0.04610  -1.849   0.3021    
soil_0_20_pH_H2O == 0 -0.09210    0.19644  -0.469   0.9965    
soil_0_20_Corg == 0    1.25026    0.46581   2.684   0.0427 *  
soil_0_20_silt == 0    0.00845    0.03953   0.214   1.0000    
Fed == 0              -1.08433    0.14184  -7.644   <0.001 ***
Ald == 0              -8.63139    1.87796  -4.596   <0.001 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
In [14]:
Code
library(knitr)
library(kableExtra)

benchmark_results <- readRDS("cache/benchmark-tables.rds")

# Extract individual tables
Tables_yield <- benchmark_results$Tables_yield
Tables_yield_weather <- benchmark_results$Tables_yield_weather
Tables_earth_treatment <- benchmark_results$Tables_earth_treatment
Tables_earth_notreatment <- benchmark_results$Tables_earth_notreatment
Tables_yield_lm <- benchmark_results$Tables_yield_lm
Tables_yield_weather_lm <- benchmark_results$Tables_yield_weather_lm
Tables_earth_lm <- benchmark_results$Tables_earth_lm
In [15]:
Code
kable(Tables_yield_lm, 
     caption = "Linear model performance for predicting yield and P-balance variables using different P-dynamics variable sets (without weather data). Rows represent different predictor variable sets: 'k' uses only the release rate constant; 'PS' uses only log-transformed semi-labile P; 'kPS' uses both k and log-transformed PS plus their interaction; 'AAE10' uses only log-transformed AAE10-extractable P; 'CO2' uses only log-transformed CO2-extractable P; 'AAE10_CO2' uses both log-transformed AAE10 and CO2 extractable P plus their log-log interaction; 'AAE10_CO2_kPS' combines AAE10, CO2, k, and PS variables with interactions; 'CO2_kPS' combines CO2, k, and PS variables with interactions. Columns show explained variance for different target variables.",
     digits = 3) |>
 kable_styling(bootstrap_options = c("striped", "hover", "condensed"), 
               full_width = FALSE)
Linear model performance for predicting yield and P-balance variables using different P-dynamics variable sets (without weather data). Rows represent different predictor variable sets: 'k' uses only the release rate constant; 'PS' uses only log-transformed semi-labile P; 'kPS' uses both k and log-transformed PS plus their interaction; 'AAE10' uses only log-transformed AAE10-extractable P; 'CO2' uses only log-transformed CO2-extractable P; 'AAE10_CO2' uses both log-transformed AAE10 and CO2 extractable P plus their log-log interaction; 'AAE10_CO2_kPS' combines AAE10, CO2, k, and PS variables with interactions; 'CO2_kPS' combines CO2, k, and PS variables with interactions. Columns show explained variance for different target variables.
Ymain_norm Ymain_rel annual_P_uptake annual_P_balance
k 0.021 -0.009 -0.005 0.018
PS 0.223 0.051 0.034 0.553
kPS 0.215 0.036 0.030 0.540
AAE10 0.109 0.152 0.095 0.277
CO2 0.228 0.105 0.075 0.500
AAE10_CO2 0.232 0.129 0.097 0.491
AAE10_CO2_kPS 0.233 0.139 0.049 0.562
CO2_kPS 0.232 0.094 0.046 0.561
In [16]:
Code
kable(Tables_yield_weather_lm, 
      caption = "Linear model performance for predicting yield and P-balance variables including weather data. Rows represent different predictor variable sets: 'onlyweather' uses only weather variables (annual average temperature, annual sum precipitation, juvenile deviation precipitation/sun/temperature, annual sum sun, plus NA weather indicator); 'k' combines weather variables with release rate constant; 'PS' combines weather variables with log-transformed semi-labile P; 'kPS' combines weather variables with k, log-transformed PS, and their interaction; 'AAE10' combines weather variables with log-transformed AAE10-extractable P; 'CO2' combines weather variables with log-transformed CO2-extractable P; 'AAE10_CO2' combines weather variables with both extractable P measures and their interaction; 'AAE10_CO2_kPS' combines weather variables with all P-dynamics parameters; 'CO2_kPS' combines weather variables with CO2, k, and PS parameters.",
      digits = 3) |>
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), 
                full_width = FALSE)
Linear model performance for predicting yield and P-balance variables including weather data. Rows represent different predictor variable sets: 'onlyweather' uses only weather variables (annual average temperature, annual sum precipitation, juvenile deviation precipitation/sun/temperature, annual sum sun, plus NA weather indicator); 'k' combines weather variables with release rate constant; 'PS' combines weather variables with log-transformed semi-labile P; 'kPS' combines weather variables with k, log-transformed PS, and their interaction; 'AAE10' combines weather variables with log-transformed AAE10-extractable P; 'CO2' combines weather variables with log-transformed CO2-extractable P; 'AAE10_CO2' combines weather variables with both extractable P measures and their interaction; 'AAE10_CO2_kPS' combines weather variables with all P-dynamics parameters; 'CO2_kPS' combines weather variables with CO2, k, and PS parameters.
Ymain_norm Ymain_rel annual_P_uptake annual_P_balance
onlyweather -0.018 0.132 0.391 0.113
k 0.023 0.105 0.353 0.077
PS 0.204 0.184 0.446 0.627
kPS 0.203 0.189 0.415 0.632
AAE10 0.147 0.222 0.496 0.432
CO2 0.231 0.210 0.463 0.594
AAE10_CO2 0.235 0.245 0.491 0.591
AAE10_CO2_kPS 0.220 0.238 0.463 0.652
CO2_kPS 0.246 0.157 0.449 0.644
In [17]:
Code
kable(Tables_earth_lm, 
      caption = "Linear model performance comparison for predicting P-dynamics parameters from soil properties. Rows represent different target P-dynamics variables: 'PS_log' is log-transformed semi-labile phosphorus; 'k' is the phosphorus release rate constant; 'kPS_log' is log-transformed product of release rate and semi-labile P; 'P_AAE10_log' is log-transformed AAE10-extractable phosphorus; 'P_CO2_log' is log-transformed CO2-extractable phosphorus. The 'with_treatment' column uses soil variables (clay content, pH, organic carbon, silt content) plus treatment (P0 P100 P166), while 'without_treatment' uses only the soil variables.",
      digits = 3) |>
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), 
                full_width = FALSE)
Linear model performance comparison for predicting P-dynamics parameters from soil properties. Rows represent different target P-dynamics variables: 'PS_log' is log-transformed semi-labile phosphorus; 'k' is the phosphorus release rate constant; 'kPS_log' is log-transformed product of release rate and semi-labile P; 'P_AAE10_log' is log-transformed AAE10-extractable phosphorus; 'P_CO2_log' is log-transformed CO2-extractable phosphorus. The 'with_treatment' column uses soil variables (clay content, pH, organic carbon, silt content) plus treatment (P0 P100 P166), while 'without_treatment' uses only the soil variables.
PS_log k kPS_log P_AAE10_log P_CO2_log
soil + treatment 0.885 0.328 0.752 0.824 0.792
only soil 0.042 0.267 0.023 0.365 0.025