Analysis of agroforestry project data; Linear mixed model with year as random effect for repeated measurements
Significance Summary:
Agroforestry treatment was found to be NOT significant (p = 0.39) using a linear mixed-effects model with total C as the response variable, agro_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tc_ag_treats2 <- lmer(c_gkg ~ agro_treatment + (1 | year), data = ag_treats2)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_ag_treats2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ agro_treatment + (1 | year)
## Data: ag_treats2
##
## REML criterion at convergence: 452.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.1774 -0.6944 -0.3121 0.3723 3.4187
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.0 0.00
## Residual 102.5 10.13
## Number of obs: 62, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 22.437 1.307 60.000 17.164 <2e-16 ***
## agro_treatmentno_agroforestry -6.398 7.278 60.000 -0.879 0.383
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agr_trtmnt_ -0.180
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_ag_treats2)
## (Intercept) agro_treatmentno_agroforestry
## 22.436667 -6.398167
# Extract random effects (conditional modes)
ranef(model_tc_ag_treats2)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_ag_treats2) # residuals vs fitted
qqnorm(resid(model_tc_ag_treats2)); qqline(resid(model_tc_ag_treats2)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_treatment as a factor for pairwise comparisons
ag_treats2$agro_treatment_f <- factor(ag_treats2$agro_treatment)
lmer_model_tc_ag_treats2_factor <- lmer(c_gkg ~ agro_treatment_f + (1 | year), data = ag_treats2)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_tc_ag_treats2_result <- emmeans(lmer_model_tc_ag_treats2_factor, pairwise ~ agro_treatment_f, adjust = "tukey")
# View the results
emmeans_tc_ag_treats2_result
## $emmeans
## agro_treatment_f emmean SE df lower.CL upper.CL
## agroforestry 22.4 1.31 2.1 17.07 27.8
## no_agroforestry 16.0 7.28 59.6 1.48 30.6
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 6.4 7.39 59.4 0.865 0.3903
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_ag_treats2 <- mixed(
c_gkg ~ agro_treatment_f + (1 | year),
data = ag_treats2,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_treatment_f
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_ag_treats2), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ agro_treatment_f + (1 | year)
## Data: ag_treats2
## Effect df F p.value
## 1 agro_treatment_f 1, 59.43 0.75 .390
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_ag_treats2 <- anova_kr_tc_ag_treats2$Anova
car_table_tc_ag_treats2 # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.ag_treats2 <- emmeans(model_tc_ag_treats2, "agro_treatment")
pairs(c_gkg.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 6.4 7.39 59.4 0.865 0.3903
##
## Degrees-of-freedom method: kenward-roger
cld(c_gkg.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_treatment emmean SE df lower.CL upper.CL .group
## no_agroforestry 16.0 7.28 59.6 -0.655 32.7 a
## agroforestry 22.4 1.31 2.1 14.852 30.0 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Agroforestry tree type was found to be significant (p < 0.001) using a linear mixed-effects model with total C as the response variable, agro_type as the fixed effect, and (1 / year) as the random intercept.
model_tc_ag <- lmer(c_gkg ~ agro_type + (1 | year), data = ag_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_ag)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ agro_type + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 425.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.4911 -0.5809 -0.2553 0.2685 3.4161
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.00 0.000
## Residual 79.76 8.931
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 26.544 1.488 58.000 17.833 < 2e-16 ***
## agro_typepine -10.268 2.354 58.000 -4.363 5.34e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agro_typepn -0.632
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_ag)
## (Intercept) agro_typepine
## 26.54397 -10.26826
# Extract random effects (conditional modes)
ranef(model_tc_ag)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_ag) # residuals vs fitted
qqnorm(resid(model_tc_ag)); qqline(resid(model_tc_ag)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
lmer_model_tc_ag_factor <- lmer(c_gkg ~ agro_type_f + (1 | year), data = ag_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_type_f` factor.
emmeans_tc_ag_result <- emmeans(lmer_model_tc_ag_factor, pairwise ~ agro_type_f, adjust = "tukey")
# View the results
emmeans_tc_ag_result
## $emmeans
## agro_type_f emmean SE df lower.CL upper.CL
## pecan 26.5 1.49 5.47 22.8 30.3
## pine 16.3 1.82 11.57 12.3 20.3
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan - pine 10.3 2.35 56 4.363 0.0001
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_ag <- mixed(
c_gkg ~ agro_type_f + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_ag), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ agro_type_f + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 56 19.04 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_ag <- anova_kr_tc_ag$Anova
car_table_tc_ag # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.ag <- emmeans(model_tc_ag, "agro_type")
pairs(c_gkg.emm.s.ag, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## pecan - pine 10.3 2.35 56 4.363 0.0001
##
## Degrees-of-freedom method: kenward-roger
cld(c_gkg.emm.s.ag, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_type emmean SE df lower.CL upper.CL .group
## pine 16.3 1.82 11.57 11.6 21.0 a
## pecan 26.5 1.49 5.47 22.0 31.1 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop treatment was found to be NOT significant (p = 0.39) using a linear mixed-effects model with total C as the response variable, cc_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tc_cc_treats <- lmer(c_gkg ~ cc_treatment + (1 | year), data = dat)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_cc_treats)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ cc_treatment + (1 | year)
## Data: dat
##
## REML criterion at convergence: 466.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.1942 -0.6835 -0.3166 0.4207 3.4676
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.00 0.000
## Residual 99.66 9.983
## Number of obs: 64, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 22.437 1.289 62.000 17.41 <2e-16 ***
## cc_treatmentno_cc -4.639 5.155 62.000 -0.90 0.372
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## cc_trtmntn_ -0.250
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_cc_treats)
## (Intercept) cc_treatmentno_cc
## 22.436667 -4.639417
# Extract random effects (conditional modes)
ranef(model_tc_cc_treats)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_cc_treats) # residuals vs fitted
qqnorm(resid(model_tc_cc_treats)); qqline(resid(model_tc_cc_treats)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_treatment as a factor for pairwise comparisons
dat$cc_treatment_f <- factor(dat$cc_treatment)
lmer_model_tc_cc_treats_factor <- lmer(c_gkg ~ cc_treatment_f + (1 | year), data = dat)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_tc_cc_treats_result <- emmeans(lmer_model_tc_cc_treats_factor, pairwise ~ cc_treatment_f, adjust = "tukey")
# View the results
emmeans_tc_cc_treats_result
## $emmeans
## cc_treatment_f emmean SE df lower.CL upper.CL
## covercrop 22.4 1.29 2.21 17.37 27.5
## no_cc 17.8 5.14 55.02 7.49 28.1
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc 4.64 5.3 62 0.875 0.3851
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_cc_treats <- mixed(
c_gkg ~ cc_treatment_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_treatment_f
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_cc_treats), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ cc_treatment_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_treatment_f 1, 61.99 0.77 .385
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_cc_treats <- anova_kr_tc_cc_treats$Anova
car_table_tc_cc_treats # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.cc_treats <- emmeans(model_tc_cc_treats, "cc_treatment")
pairs(c_gkg.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc 4.64 5.3 62 0.875 0.3851
##
## Degrees-of-freedom method: kenward-roger
cld(c_gkg.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_treatment emmean SE df lower.CL upper.CL .group
## no_cc 17.8 5.14 55.02 5.97 29.6 a
## covercrop 22.4 1.29 2.21 15.37 29.5 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop class (mix, mono, control) was found to be significant (p = 0.01) using a linear mixed-effects model with total C as the response variable, cc_class as the fixed effect, and (1 / year) as the random intercept.
model_tc_cc_c <- lmer(c_gkg ~ cc_class + (1 | year), data = dat)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_cc_c)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ cc_class + (1 | year)
## Data: dat
##
## REML criterion at convergence: 454.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.3741 -0.7139 -0.1973 0.4817 3.4332
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.00 0.000
## Residual 88.04 9.383
## Number of obs: 64, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 24.840 1.448 61.000 17.157 < 2e-16 ***
## cc_classmono -8.011 2.643 61.000 -3.031 0.00358 **
## cc_classnone -7.043 4.910 61.000 -1.434 0.15656
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_clssm
## cc_classmon -0.548
## cc_classnon -0.295 0.162
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_cc_c)
## (Intercept) cc_classmono cc_classnone
## 24.839881 -8.010714 -7.042631
# Extract random effects (conditional modes)
ranef(model_tc_cc_c)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_cc_c) # residuals vs fitted
qqnorm(resid(model_tc_cc_c)); qqline(resid(model_tc_cc_c)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_class as a factor for pairwise comparisons
dat$cc_class_f <- factor(dat$cc_class)
lmer_model_tc_cc_c_factor <- lmer(c_gkg ~ cc_class_f + (1 | year), data = dat)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_class_f` factor.
emmeans_tc_cc_c_result <- emmeans(lmer_model_tc_cc_c_factor, pairwise ~ cc_class_f, adjust = "tukey")
# View the results
emmeans_tc_cc_c_result
## $emmeans
## cc_class_f emmean SE df lower.CL upper.CL
## mixed 24.8 1.45 4.47 21.0 28.7
## mono 16.8 2.21 20.25 12.2 21.4
## none 17.8 4.84 54.33 8.1 27.5
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## mixed - mono 8.011 2.64 59.0 3.031 0.0100
## mixed - none 7.043 5.05 61.0 1.395 0.3497
## mono - none -0.968 5.32 60.9 -0.182 0.9819
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_cc_c <- mixed(
c_gkg ~ cc_class_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_class_f
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_cc_c), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ cc_class_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_class_f 2, 60.17 5.02 ** .010
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_cc_c <- anova_kr_tc_cc_c$Anova
car_table_tc_cc_c # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.cc_c <- emmeans(model_tc_cc_c, "cc_class")
pairs(c_gkg.emm.s.cc_c, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## mixed - mono 8.011 2.64 59.0 3.031 0.0100
## mixed - none 7.043 5.05 61.0 1.395 0.3497
## mono - none -0.968 5.32 60.9 -0.182 0.9819
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
cld(c_gkg.emm.s.cc_c, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_class emmean SE df lower.CL upper.CL .group
## mono 16.8 2.21 20.25 11.08 22.6 a
## none 17.8 4.84 54.33 5.88 29.7 ab
## mixed 24.8 1.45 4.47 19.47 30.2 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 3 estimates
## P value adjustment: tukey method for comparing a family of 3 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop type was found to be significant (p < 0.001) using a linear mixed-effects model with total C as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_tc_cc <- lmer(c_gkg ~ cc_type + (1 | year), data = cc_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ cc_type + (1 | year)
## Data: cc_nocntrl
##
## REML criterion at convergence: 350.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.56939 -0.53915 -0.06002 0.29452 2.62327
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.00 0.000
## Residual 45.31 6.731
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 17.6737 2.7480 50.0000 6.431 4.65e-08 ***
## cc_typeoat-clover 5.2287 3.8863 50.0000 1.345 0.184561
## cc_typeoat-vetch 15.9767 3.8863 50.0000 4.111 0.000146 ***
## cc_typeradish -4.7415 3.8863 50.0000 -1.220 0.228165
## cc_typeradish-oat -3.8150 3.8863 50.0000 -0.982 0.330994
## cc_typeradish-rye -0.4208 3.8863 50.0000 -0.108 0.914201
## cc_typeradish-vetch 3.3855 3.8863 50.0000 0.871 0.387840
## cc_typerye 2.2080 3.8863 50.0000 0.568 0.572474
## cc_typerye-clover 21.7215 3.8863 50.0000 5.589 9.45e-07 ***
## cc_typerye-vetch 8.0870 3.8863 50.0000 2.081 0.042585 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typrd cc_typrdsh-t cc_typrdsh-r
## cc_typt-clv -0.707
## cc_typt-vtc -0.707 0.500
## cc_typerdsh -0.707 0.500 0.500
## cc_typrdsh-t -0.707 0.500 0.500 0.500
## cc_typrdsh-r -0.707 0.500 0.500 0.500 0.500
## cc_typrdsh-v -0.707 0.500 0.500 0.500 0.500 0.500
## cc_typerye -0.707 0.500 0.500 0.500 0.500 0.500
## cc_typry-cl -0.707 0.500 0.500 0.500 0.500 0.500
## cc_typry-vt -0.707 0.500 0.500 0.500 0.500 0.500
## cc_typrdsh-v cc_typry cc_typry-c
## cc_typt-clv
## cc_typt-vtc
## cc_typerdsh
## cc_typrdsh-t
## cc_typrdsh-r
## cc_typrdsh-v
## cc_typerye 0.500
## cc_typry-cl 0.500 0.500
## cc_typry-vt 0.500 0.500 0.500
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typeradish
## 17.6736667 5.2286667 15.9766667 -4.7415000
## cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch cc_typerye
## -3.8150000 -0.4208333 3.3855000 2.2080000
## cc_typerye-clover cc_typerye-vetch
## 21.7215000 8.0870000
# Extract random effects (conditional modes)
ranef(model_tc_cc)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_cc) # residuals vs fitted
qqnorm(resid(model_tc_cc)); qqline(resid(model_tc_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
cc_nocntrl$cc_type_f <- factor(cc_nocntrl$cc_type)
lmer_model_tc_cc_factor <- lmer(c_gkg ~ cc_type_f + (1 | year), data = cc_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_tc_cc_result <- emmeans(lmer_model_tc_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_tc_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 17.7 2.75 45.7 12.14 23.2
## oat-clover 22.9 2.75 45.7 17.37 28.4
## oat-vetch 33.7 2.75 45.7 28.12 39.2
## radish 12.9 2.75 45.7 7.40 18.5
## radish-oat 13.9 2.75 45.7 8.33 19.4
## radish-rye 17.3 2.75 45.7 11.72 22.8
## radish-vetch 21.1 2.75 45.7 15.53 26.6
## rye 19.9 2.75 45.7 14.35 25.4
## rye-clover 39.4 2.75 45.7 33.86 44.9
## rye-vetch 25.8 2.75 45.7 20.23 31.3
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -5.229 3.89 48 -1.345 0.9373
## oat - (oat-vetch) -15.977 3.89 48 -4.111 0.0054
## oat - radish 4.742 3.89 48 1.220 0.9654
## oat - (radish-oat) 3.815 3.89 48 0.982 0.9920
## oat - (radish-rye) 0.421 3.89 48 0.108 1.0000
## oat - (radish-vetch) -3.385 3.89 48 -0.871 0.9967
## oat - rye -2.208 3.89 48 -0.568 0.9999
## oat - (rye-clover) -21.721 3.89 48 -5.589 <.0001
## oat - (rye-vetch) -8.087 3.89 48 -2.081 0.5492
## (oat-clover) - (oat-vetch) -10.748 3.89 48 -2.766 0.1778
## (oat-clover) - radish 9.970 3.89 48 2.565 0.2619
## (oat-clover) - (radish-oat) 9.044 3.89 48 2.327 0.3913
## (oat-clover) - (radish-rye) 5.649 3.89 48 1.454 0.9031
## (oat-clover) - (radish-vetch) 1.843 3.89 48 0.474 1.0000
## (oat-clover) - rye 3.021 3.89 48 0.777 0.9986
## (oat-clover) - (rye-clover) -16.493 3.89 48 -4.244 0.0036
## (oat-clover) - (rye-vetch) -2.858 3.89 48 -0.735 0.9991
## (oat-vetch) - radish 20.718 3.89 48 5.331 0.0001
## (oat-vetch) - (radish-oat) 19.792 3.89 48 5.093 0.0002
## (oat-vetch) - (radish-rye) 16.398 3.89 48 4.219 0.0039
## (oat-vetch) - (radish-vetch) 12.591 3.89 48 3.240 0.0606
## (oat-vetch) - rye 13.769 3.89 48 3.543 0.0276
## (oat-vetch) - (rye-clover) -5.745 3.89 48 -1.478 0.8940
## (oat-vetch) - (rye-vetch) 7.890 3.89 48 2.030 0.5831
## radish - (radish-oat) -0.926 3.89 48 -0.238 1.0000
## radish - (radish-rye) -4.321 3.89 48 -1.112 0.9811
## radish - (radish-vetch) -8.127 3.89 48 -2.091 0.5423
## radish - rye -6.949 3.89 48 -1.788 0.7390
## radish - (rye-clover) -26.463 3.89 48 -6.809 <.0001
## radish - (rye-vetch) -12.829 3.89 48 -3.301 0.0520
## (radish-oat) - (radish-rye) -3.394 3.89 48 -0.873 0.9966
## (radish-oat) - (radish-vetch) -7.200 3.89 48 -1.853 0.6991
## (radish-oat) - rye -6.023 3.89 48 -1.550 0.8647
## (radish-oat) - (rye-clover) -25.537 3.89 48 -6.571 <.0001
## (radish-oat) - (rye-vetch) -11.902 3.89 48 -3.063 0.0928
## (radish-rye) - (radish-vetch) -3.806 3.89 48 -0.979 0.9921
## (radish-rye) - rye -2.629 3.89 48 -0.676 0.9995
## (radish-rye) - (rye-clover) -22.142 3.89 48 -5.698 <.0001
## (radish-rye) - (rye-vetch) -8.508 3.89 48 -2.189 0.4778
## (radish-vetch) - rye 1.177 3.89 48 0.303 1.0000
## (radish-vetch) - (rye-clover) -18.336 3.89 48 -4.718 0.0008
## (radish-vetch) - (rye-vetch) -4.702 3.89 48 -1.210 0.9672
## rye - (rye-clover) -19.514 3.89 48 -5.021 0.0003
## rye - (rye-vetch) -5.879 3.89 48 -1.513 0.8804
## (rye-clover) - (rye-vetch) 13.634 3.89 48 3.508 0.0303
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_cc <- mixed(
c_gkg ~ cc_type_f + (1 | year),
data = cc_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ cc_type_f + (1 | year)
## Data: cc_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 48 9.51 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_cc <- anova_kr_tc_cc$Anova
car_table_tc_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.cc <- emmeans(model_tc_cc, "cc_type")
pairs(c_gkg.emm.s.cc, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -5.229 3.89 48 -1.345 0.9373
## oat - (oat-vetch) -15.977 3.89 48 -4.111 0.0054
## oat - radish 4.742 3.89 48 1.220 0.9654
## oat - (radish-oat) 3.815 3.89 48 0.982 0.9920
## oat - (radish-rye) 0.421 3.89 48 0.108 1.0000
## oat - (radish-vetch) -3.385 3.89 48 -0.871 0.9967
## oat - rye -2.208 3.89 48 -0.568 0.9999
## oat - (rye-clover) -21.721 3.89 48 -5.589 <.0001
## oat - (rye-vetch) -8.087 3.89 48 -2.081 0.5492
## (oat-clover) - (oat-vetch) -10.748 3.89 48 -2.766 0.1778
## (oat-clover) - radish 9.970 3.89 48 2.565 0.2619
## (oat-clover) - (radish-oat) 9.044 3.89 48 2.327 0.3913
## (oat-clover) - (radish-rye) 5.649 3.89 48 1.454 0.9031
## (oat-clover) - (radish-vetch) 1.843 3.89 48 0.474 1.0000
## (oat-clover) - rye 3.021 3.89 48 0.777 0.9986
## (oat-clover) - (rye-clover) -16.493 3.89 48 -4.244 0.0036
## (oat-clover) - (rye-vetch) -2.858 3.89 48 -0.735 0.9991
## (oat-vetch) - radish 20.718 3.89 48 5.331 0.0001
## (oat-vetch) - (radish-oat) 19.792 3.89 48 5.093 0.0002
## (oat-vetch) - (radish-rye) 16.398 3.89 48 4.219 0.0039
## (oat-vetch) - (radish-vetch) 12.591 3.89 48 3.240 0.0606
## (oat-vetch) - rye 13.769 3.89 48 3.543 0.0276
## (oat-vetch) - (rye-clover) -5.745 3.89 48 -1.478 0.8940
## (oat-vetch) - (rye-vetch) 7.890 3.89 48 2.030 0.5831
## radish - (radish-oat) -0.926 3.89 48 -0.238 1.0000
## radish - (radish-rye) -4.321 3.89 48 -1.112 0.9811
## radish - (radish-vetch) -8.127 3.89 48 -2.091 0.5423
## radish - rye -6.949 3.89 48 -1.788 0.7390
## radish - (rye-clover) -26.463 3.89 48 -6.809 <.0001
## radish - (rye-vetch) -12.829 3.89 48 -3.301 0.0520
## (radish-oat) - (radish-rye) -3.394 3.89 48 -0.873 0.9966
## (radish-oat) - (radish-vetch) -7.200 3.89 48 -1.853 0.6991
## (radish-oat) - rye -6.023 3.89 48 -1.550 0.8647
## (radish-oat) - (rye-clover) -25.537 3.89 48 -6.571 <.0001
## (radish-oat) - (rye-vetch) -11.902 3.89 48 -3.063 0.0928
## (radish-rye) - (radish-vetch) -3.806 3.89 48 -0.979 0.9921
## (radish-rye) - rye -2.629 3.89 48 -0.676 0.9995
## (radish-rye) - (rye-clover) -22.142 3.89 48 -5.698 <.0001
## (radish-rye) - (rye-vetch) -8.508 3.89 48 -2.189 0.4778
## (radish-vetch) - rye 1.177 3.89 48 0.303 1.0000
## (radish-vetch) - (rye-clover) -18.336 3.89 48 -4.718 0.0008
## (radish-vetch) - (rye-vetch) -4.702 3.89 48 -1.210 0.9672
## rye - (rye-clover) -19.514 3.89 48 -5.021 0.0003
## rye - (rye-vetch) -5.879 3.89 48 -1.513 0.8804
## (rye-clover) - (rye-vetch) 13.634 3.89 48 3.508 0.0303
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
cld(c_gkg.emm.s.cc, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 12.9 2.75 45.7 4.85 21.0 a
## radish-oat 13.9 2.75 45.7 5.78 21.9 a
## radish-rye 17.3 2.75 45.7 9.17 25.3 a
## oat 17.7 2.75 45.7 9.59 25.8 a
## rye 19.9 2.75 45.7 11.80 28.0 a
## radish-vetch 21.1 2.75 45.7 12.98 29.1 ab
## oat-clover 22.9 2.75 45.7 14.82 31.0 ab
## rye-vetch 25.8 2.75 45.7 17.68 33.8 ab
## oat-vetch 33.7 2.75 45.7 25.57 41.7 bc
## rye-clover 39.4 2.75 45.7 31.31 47.5 c
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 10 estimates
## P value adjustment: tukey method for comparing a family of 10 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Within the plots using pecan agroforestry, cover crop type was found to be significant (p < 0.001) using a linear mixed-effects model with total C as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_tc_pec_cc <- lmer(c_gkg ~ cc_type + (1 | year), data = datPEC)
# Summarize the model results
summary(model_tc_pec_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ cc_type + (1 | year)
## Data: datPEC
##
## REML criterion at convergence: 220.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1538 -0.5472 -0.1631 0.6194 2.1605
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.9903 0.9951
## Residual 63.4713 7.9669
## Number of obs: 36, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 17.674 3.303 23.962 5.351 1.72e-05 ***
## cc_typeoat-clover 5.229 4.600 28.000 1.137 0.26528
## cc_typeoat-vetch 15.977 4.600 28.000 3.473 0.00169 **
## cc_typerye 2.208 4.600 28.000 0.480 0.63493
## cc_typerye-clover 21.721 4.600 28.000 4.722 5.92e-05 ***
## cc_typerye-vetch 8.087 4.600 28.000 1.758 0.08965 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typ cc_typry-c
## cc_typt-clv -0.696
## cc_typt-vtc -0.696 0.500
## cc_typerye -0.696 0.500 0.500
## cc_typry-cl -0.696 0.500 0.500 0.500
## cc_typry-vt -0.696 0.500 0.500 0.500 0.500
# Extract fixed effects
fixef(model_tc_pec_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typerye
## 17.673667 5.228667 15.976667 2.208000
## cc_typerye-clover cc_typerye-vetch
## 21.721500 8.087000
# Extract random effects (conditional modes)
ranef(model_tc_pec_cc)
## $year
## (Intercept)
## 2021 -0.3090959
## 2022 0.4452502
## 2023 -0.1361543
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_pec_cc) # residuals vs fitted
qqnorm(resid(model_tc_pec_cc)); qqline(resid(model_tc_pec_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPEC$cc_type_f <- factor(datPEC$cc_type)
lmer_model_tc_pec_cc_factor <- lmer(c_gkg ~ cc_type_f + (1 | year), data = datPEC)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_tc_pec_cc_result <- emmeans(lmer_model_tc_pec_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_tc_pec_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 17.7 3.3 24 10.9 24.5
## oat-clover 22.9 3.3 24 16.1 29.7
## oat-vetch 33.7 3.3 24 26.8 40.5
## rye 19.9 3.3 24 13.1 26.7
## rye-clover 39.4 3.3 24 32.6 46.2
## rye-vetch 25.8 3.3 24 18.9 32.6
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -5.23 4.6 28 -1.137 0.8618
## oat - (oat-vetch) -15.98 4.6 28 -3.473 0.0189
## oat - rye -2.21 4.6 28 -0.480 0.9965
## oat - (rye-clover) -21.72 4.6 28 -4.722 0.0008
## oat - (rye-vetch) -8.09 4.6 28 -1.758 0.5072
## (oat-clover) - (oat-vetch) -10.75 4.6 28 -2.337 0.2134
## (oat-clover) - rye 3.02 4.6 28 0.657 0.9852
## (oat-clover) - (rye-clover) -16.49 4.6 28 -3.586 0.0144
## (oat-clover) - (rye-vetch) -2.86 4.6 28 -0.621 0.9885
## (oat-vetch) - rye 13.77 4.6 28 2.993 0.0574
## (oat-vetch) - (rye-clover) -5.74 4.6 28 -1.249 0.8091
## (oat-vetch) - (rye-vetch) 7.89 4.6 28 1.715 0.5336
## rye - (rye-clover) -19.51 4.6 28 -4.242 0.0027
## rye - (rye-vetch) -5.88 4.6 28 -1.278 0.7941
## (rye-clover) - (rye-vetch) 13.63 4.6 28 2.964 0.0612
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_pec_cc <- mixed(
c_gkg ~ cc_type_f + (1 | year),
data = datPEC,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_tc_pec_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ cc_type_f + (1 | year)
## Data: datPEC
## Effect df F p.value
## 1 cc_type_f 5, 28 6.67 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_pec_cc <- anova_kr_tc_pec_cc$Anova
car_table_tc_pec_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.cc_pec <- emmeans(model_tc_pec_cc, "cc_type")
pairs(c_gkg.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -5.23 4.6 28 -1.137 0.8618
## oat - (oat-vetch) -15.98 4.6 28 -3.473 0.0189
## oat - rye -2.21 4.6 28 -0.480 0.9965
## oat - (rye-clover) -21.72 4.6 28 -4.722 0.0008
## oat - (rye-vetch) -8.09 4.6 28 -1.758 0.5072
## (oat-clover) - (oat-vetch) -10.75 4.6 28 -2.337 0.2134
## (oat-clover) - rye 3.02 4.6 28 0.657 0.9852
## (oat-clover) - (rye-clover) -16.49 4.6 28 -3.586 0.0144
## (oat-clover) - (rye-vetch) -2.86 4.6 28 -0.621 0.9885
## (oat-vetch) - rye 13.77 4.6 28 2.993 0.0574
## (oat-vetch) - (rye-clover) -5.74 4.6 28 -1.249 0.8091
## (oat-vetch) - (rye-vetch) 7.89 4.6 28 1.715 0.5336
## rye - (rye-clover) -19.51 4.6 28 -4.242 0.0027
## rye - (rye-vetch) -5.88 4.6 28 -1.278 0.7941
## (rye-clover) - (rye-vetch) 13.63 4.6 28 2.964 0.0612
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
cld(c_gkg.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## oat 17.7 3.3 24 8.21 27.1 a
## rye 19.9 3.3 24 10.41 29.3 ab
## oat-clover 22.9 3.3 24 13.44 32.4 ab
## rye-vetch 25.8 3.3 24 16.29 35.2 abc
## oat-vetch 33.7 3.3 24 24.18 43.1 bc
## rye-clover 39.4 3.3 24 29.93 48.9 c
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 6 estimates
## P value adjustment: tukey method for comparing a family of 6 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Within the plots using pine agroforestry, cover crop type was found to be significant (p = 0.008) using a linear mixed-effects model with total C as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_tc_pin_cc <- lmer(c_gkg ~ cc_type + (1 | year), data = datPIN)
# Summarize the model results
summary(model_tc_pin_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ cc_type + (1 | year)
## Data: datPIN
##
## REML criterion at convergence: 119.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.73355 -0.34461 -0.03965 0.30985 2.18142
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 2.165 1.472
## Residual 15.146 3.892
## Number of obs: 24, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 12.9322 1.8017 9.4567 7.178 4.03e-05 ***
## cc_typeradish-oat 0.9265 2.2469 18.0000 0.412 0.68496
## cc_typeradish-rye 4.3207 2.2469 18.0000 1.923 0.07046 .
## cc_typeradish-vetch 8.1270 2.2469 18.0000 3.617 0.00197 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typrdsh-t cc_typrdsh-r
## cc_typrdsh-t -0.624
## cc_typrdsh-r -0.624 0.500
## cc_typrdsh-v -0.624 0.500 0.500
# Extract fixed effects
fixef(model_tc_pin_cc)
## (Intercept) cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch
## 12.932167 0.926500 4.320667 8.127000
# Extract random effects (conditional modes)
ranef(model_tc_pin_cc)
## $year
## (Intercept)
## 2021 0.9941829
## 2022 -1.1405249
## 2023 0.1463420
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_pin_cc) # residuals vs fitted
qqnorm(resid(model_tc_pin_cc)); qqline(resid(model_tc_pin_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPIN$cc_type_f <- factor(datPIN$cc_type)
lmer_model_tc_pin_cc_factor <- lmer(c_gkg ~ cc_type_f + (1 | year), data = datPIN)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_tc_pin_cc_result <- emmeans(lmer_model_tc_pin_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_tc_pin_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## radish 12.9 1.8 9.46 8.89 17.0
## radish-oat 13.9 1.8 9.46 9.81 17.9
## radish-rye 17.3 1.8 9.46 13.21 21.3
## radish-vetch 21.1 1.8 9.46 17.01 25.1
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -0.926 2.25 18 -0.412 0.9756
## radish - (radish-rye) -4.321 2.25 18 -1.923 0.2537
## radish - (radish-vetch) -8.127 2.25 18 -3.617 0.0097
## (radish-oat) - (radish-rye) -3.394 2.25 18 -1.511 0.4520
## (radish-oat) - (radish-vetch) -7.200 2.25 18 -3.205 0.0231
## (radish-rye) - (radish-vetch) -3.806 2.25 18 -1.694 0.3553
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_pin_cc <- mixed(
c_gkg ~ cc_type_f + (1 | year),
data = datPIN,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_tc_pin_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ cc_type_f + (1 | year)
## Data: datPIN
## Effect df F p.value
## 1 cc_type_f 3, 18 5.40 ** .008
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_pin_cc <- anova_kr_tc_pin_cc$Anova
car_table_tc_pin_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.cc_pin <- emmeans(model_tc_pin_cc, "cc_type")
pairs(c_gkg.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -0.926 2.25 18 -0.412 0.9756
## radish - (radish-rye) -4.321 2.25 18 -1.923 0.2537
## radish - (radish-vetch) -8.127 2.25 18 -3.617 0.0097
## (radish-oat) - (radish-rye) -3.394 2.25 18 -1.511 0.4520
## (radish-oat) - (radish-vetch) -7.200 2.25 18 -3.205 0.0231
## (radish-rye) - (radish-vetch) -3.806 2.25 18 -1.694 0.3553
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
cld(c_gkg.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 12.9 1.8 9.46 7.41 18.5 a
## radish-oat 13.9 1.8 9.46 8.34 19.4 a
## radish-rye 17.3 1.8 9.46 11.73 22.8 ab
## radish-vetch 21.1 1.8 9.46 15.54 26.6 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: tukey method for comparing a family of 4 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Tillage was found to be NOT significant (p = 0.56) using a linear mixed-effects model with total C as the response variable, tillage as the fixed effect, and (1 / year) as the random intercept.
model_tc_till <- lmer(c_gkg ~ tillage + (1 | year), data = till_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_till)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ tillage + (1 | year)
## Data: till_nocntrl
##
## REML criterion at convergence: 441.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.2385 -0.6705 -0.3403 0.4684 3.4501
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.0 0.00
## Residual 105.3 10.26
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 21.650 1.873 58.000 11.556 <2e-16 ***
## tillageno_till 1.574 2.650 58.000 0.594 0.555
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## tillagn_tll -0.707
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_till)
## (Intercept) tillageno_till
## 21.64977 1.57380
# Extract random effects (conditional modes)
ranef(model_tc_till)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_till) # residuals vs fitted
qqnorm(resid(model_tc_till)); qqline(resid(model_tc_till)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with tillage as a factor for pairwise comparisons
till_nocntrl$tillage_f <- factor(till_nocntrl$tillage)
lmer_model_tc_till_factor <- lmer(c_gkg ~ tillage_f + (1 | year), data = till_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ tillage_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `tillage_f` factor.
emmeans_tc_till_result <- emmeans(lmer_model_tc_till_factor, pairwise ~ tillage_f, adjust = "tukey")
# View the results
emmeans_tc_till_result
## $emmeans
## tillage_f emmean SE df lower.CL upper.CL
## min_till 21.6 1.87 7.72 17.3 26.0
## no_till 23.2 1.87 7.72 18.9 27.6
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## min_till - no_till -1.57 2.65 56 -0.594 0.5549
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_till <- mixed(
c_gkg ~ tillage_f + (1 | year),
data = till_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: tillage_f
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_till), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ tillage_f + (1 | year)
## Data: till_nocntrl
## Effect df F p.value
## 1 tillage_f 1, 56 0.35 .555
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tc_till <- anova_kr_tc_till$Anova
car_table_tc_till # prints a car::Anova-like table with F-tests and KR dfs
## NULL
c_gkg.emm.s.till <- emmeans(model_tc_till, "tillage")
pairs(c_gkg.emm.s.till, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## min_till - no_till -1.57 2.65 56 -0.594 0.5549
##
## Degrees-of-freedom method: kenward-roger
cld(c_gkg.emm.s.till, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## tillage emmean SE df lower.CL upper.CL .group
## min_till 21.6 1.87 7.72 16.5 26.8 a
## no_till 23.2 1.87 7.72 18.0 28.4 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
The interaction between agroforestry tree type and tillage was found to be NOT significant (p = 0.57) using a linear mixed-effects model with total C as the response variable, agro_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tc_agtil <- lmer(c_gkg ~ agro_type*tillage + (1 | year), data = ag_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_agtil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ agro_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 416.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.6227 -0.5422 -0.2398 0.3763 3.5274
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.00 0.000
## Residual 81.47 9.026
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 25.214 2.128 56.000 11.851 <2e-16 ***
## agro_typepine -8.911 3.364 56.000 -2.649 0.0105 *
## tillageno_till 2.660 3.009 56.000 0.884 0.3805
## agro_typepine:tillageno_till -2.715 4.757 56.000 -0.571 0.5705
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) agr_ty tllgn_
## agro_typepn -0.632
## tillagn_tll -0.707 0.447
## agr_typpn:_ 0.447 -0.707 -0.632
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_agtil)
## (Intercept) agro_typepine
## 25.214056 -8.910722
## tillageno_till agro_typepine:tillageno_till
## 2.659833 -2.715083
# Extract random effects (conditional modes)
ranef(model_tc_agtil)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_agtil) # residuals vs fitted
qqnorm(resid(model_tc_agtil)); qqline(resid(model_tc_agtil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_tc_agtil_factor <- lmer(c_gkg ~ agro_type_f*tillage_f + (1 | year), data = ag_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_tc_agtil_result <- emmeans(lmer_model_tc_agtil_factor, pairwise ~ agro_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_tc_agtil_result
## $emmeans
## agro_type_f tillage_f emmean SE df lower.CL upper.CL
## pecan min_till 25.2 2.13 18.5 20.8 29.7
## pine min_till 16.3 2.61 31.4 11.0 21.6
## pecan no_till 27.9 2.13 18.5 23.4 32.3
## pine no_till 16.2 2.61 31.4 10.9 21.6
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan min_till - pine min_till 8.9107 3.36 54 2.649 0.0502
## pecan min_till - pecan no_till -2.6598 3.01 54 -0.884 0.8131
## pecan min_till - pine no_till 8.9660 3.36 54 2.665 0.0483
## pine min_till - pecan no_till -11.5706 3.36 54 -3.440 0.0060
## pine min_till - pine no_till 0.0553 3.68 54 0.015 1.0000
## pecan no_till - pine no_till 11.6258 3.36 54 3.456 0.0058
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_agtil <- mixed(
c_gkg ~ agro_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f, tillage
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_agtil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ agro_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 54 18.64 *** <.001
## 2 tillage 1, 54 0.30 .586
## 3 agro_type_f:tillage 1, 54 0.33 .571
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
The interaction between cover crop type and tillage was found to be NOT significant (p = 0.85) using a linear mixed-effects model with total C as the response variable, cc_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tc_cctil <- lmer(c_gkg ~ cc_type*tillage + (1 | year), data = ag_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_tc_cctil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: c_gkg ~ cc_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 291.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.49537 -0.48099 -0.04576 0.28176 2.45360
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.00 0.000
## Residual 49.88 7.063
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 17.677000 4.077635 40.000000 4.335
## cc_typeoat-clover 4.170667 5.766646 40.000000 0.723
## cc_typeoat-vetch 9.797000 5.766646 40.000000 1.699
## cc_typeradish -3.841667 5.766646 40.000000 -0.666
## cc_typeradish-oat -4.921667 5.766646 40.000000 -0.853
## cc_typeradish-rye -0.041333 5.766646 40.000000 -0.007
## cc_typeradish-vetch 3.310000 5.766646 40.000000 0.574
## cc_typerye 2.868667 5.766646 40.000000 0.497
## cc_typerye-clover 22.047000 5.766646 40.000000 3.823
## cc_typerye-vetch 6.339000 5.766646 40.000000 1.099
## tillageno_till -0.006667 5.766646 40.000000 -0.001
## cc_typeoat-clover:tillageno_till 2.116000 8.155270 40.000000 0.259
## cc_typeoat-vetch:tillageno_till 12.359333 8.155270 40.000000 1.516
## cc_typeradish:tillageno_till -1.799667 8.155270 40.000000 -0.221
## cc_typeradish-oat:tillageno_till 2.213333 8.155270 40.000000 0.271
## cc_typeradish-rye:tillageno_till -0.759000 8.155270 40.000000 -0.093
## cc_typeradish-vetch:tillageno_till 0.151000 8.155270 40.000000 0.019
## cc_typerye:tillageno_till -1.321333 8.155270 40.000000 -0.162
## cc_typerye-clover:tillageno_till -0.651000 8.155270 40.000000 -0.080
## cc_typerye-vetch:tillageno_till 3.496000 8.155270 40.000000 0.429
## Pr(>|t|)
## (Intercept) 9.57e-05 ***
## cc_typeoat-clover 0.473741
## cc_typeoat-vetch 0.097103 .
## cc_typeradish 0.509116
## cc_typeradish-oat 0.398480
## cc_typeradish-rye 0.994317
## cc_typeradish-vetch 0.569188
## cc_typerye 0.621590
## cc_typerye-clover 0.000451 ***
## cc_typerye-vetch 0.278230
## tillageno_till 0.999083
## cc_typeoat-clover:tillageno_till 0.796608
## cc_typeoat-vetch:tillageno_till 0.137508
## cc_typeradish:tillageno_till 0.826468
## cc_typeradish-oat:tillageno_till 0.787480
## cc_typeradish-rye:tillageno_till 0.926314
## cc_typeradish-vetch:tillageno_till 0.985320
## cc_typerye:tillageno_till 0.872104
## cc_typerye-clover:tillageno_till 0.936774
## cc_typerye-vetch:tillageno_till 0.670456
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_tc_cctil)
## (Intercept) cc_typeoat-clover
## 17.677000000 4.170666667
## cc_typeoat-vetch cc_typeradish
## 9.797000000 -3.841666667
## cc_typeradish-oat cc_typeradish-rye
## -4.921666667 -0.041333333
## cc_typeradish-vetch cc_typerye
## 3.310000000 2.868666667
## cc_typerye-clover cc_typerye-vetch
## 22.047000000 6.339000000
## tillageno_till cc_typeoat-clover:tillageno_till
## -0.006666667 2.116000000
## cc_typeoat-vetch:tillageno_till cc_typeradish:tillageno_till
## 12.359333333 -1.799666667
## cc_typeradish-oat:tillageno_till cc_typeradish-rye:tillageno_till
## 2.213333333 -0.759000000
## cc_typeradish-vetch:tillageno_till cc_typerye:tillageno_till
## 0.151000000 -1.321333333
## cc_typerye-clover:tillageno_till cc_typerye-vetch:tillageno_till
## -0.651000000 3.496000000
# Extract random effects (conditional modes)
ranef(model_tc_cctil)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tc_cctil) # residuals vs fitted
qqnorm(resid(model_tc_cctil)); qqline(resid(model_tc_cctil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$cc_type_f <- factor(ag_nocntrl$cc_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_tc_cctil_factor <- lmer(c_gkg ~ cc_type_f*tillage_f + (1 | year), data = ag_nocntrl)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_tc_cctil_result <- emmeans(lmer_model_tc_cctil_factor, pairwise ~ cc_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_tc_cctil_result
## $emmeans
## cc_type_f tillage_f emmean SE df lower.CL upper.CL
## oat min_till 17.7 4.08 40 9.44 25.9
## oat-clover min_till 21.8 4.08 40 13.61 30.1
## oat-vetch min_till 27.5 4.08 40 19.23 35.7
## radish min_till 13.8 4.08 40 5.59 22.1
## radish-oat min_till 12.8 4.08 40 4.51 21.0
## radish-rye min_till 17.6 4.08 40 9.39 25.9
## radish-vetch min_till 21.0 4.08 40 12.75 29.2
## rye min_till 20.5 4.08 40 12.30 28.8
## rye-clover min_till 39.7 4.08 40 31.48 48.0
## rye-vetch min_till 24.0 4.08 40 15.77 32.3
## oat no_till 17.7 4.08 40 9.43 25.9
## oat-clover no_till 24.0 4.08 40 15.72 32.2
## oat-vetch no_till 39.8 4.08 40 31.59 48.1
## radish no_till 12.0 4.08 40 3.79 20.3
## radish-oat no_till 15.0 4.08 40 6.72 23.2
## radish-rye no_till 16.9 4.08 40 8.63 25.1
## radish-vetch no_till 21.1 4.08 40 12.89 29.4
## rye no_till 19.2 4.08 40 10.98 27.5
## rye-clover no_till 39.1 4.08 40 30.83 47.3
## rye-vetch no_till 27.5 4.08 40 19.26 35.7
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## oat min_till - (oat-clover min_till) -4.17067 5.77 38 -0.723
## oat min_till - (oat-vetch min_till) -9.79700 5.77 38 -1.699
## oat min_till - radish min_till 3.84167 5.77 38 0.666
## oat min_till - (radish-oat min_till) 4.92167 5.77 38 0.853
## oat min_till - (radish-rye min_till) 0.04133 5.77 38 0.007
## oat min_till - (radish-vetch min_till) -3.31000 5.77 38 -0.574
## oat min_till - rye min_till -2.86867 5.77 38 -0.497
## oat min_till - (rye-clover min_till) -22.04700 5.77 38 -3.823
## oat min_till - (rye-vetch min_till) -6.33900 5.77 38 -1.099
## oat min_till - oat no_till 0.00667 5.77 38 0.001
## oat min_till - (oat-clover no_till) -6.28000 5.77 38 -1.089
## oat min_till - (oat-vetch no_till) -22.14967 5.77 38 -3.841
## oat min_till - radish no_till 5.64800 5.77 38 0.979
## oat min_till - (radish-oat no_till) 2.71500 5.77 38 0.471
## oat min_till - (radish-rye no_till) 0.80700 5.77 38 0.140
## oat min_till - (radish-vetch no_till) -3.45433 5.77 38 -0.599
## oat min_till - rye no_till -1.54067 5.77 38 -0.267
## oat min_till - (rye-clover no_till) -21.38933 5.77 38 -3.709
## oat min_till - (rye-vetch no_till) -9.82833 5.77 38 -1.704
## (oat-clover min_till) - (oat-vetch min_till) -5.62633 5.77 38 -0.976
## (oat-clover min_till) - radish min_till 8.01233 5.77 38 1.389
## (oat-clover min_till) - (radish-oat min_till) 9.09233 5.77 38 1.577
## (oat-clover min_till) - (radish-rye min_till) 4.21200 5.77 38 0.730
## (oat-clover min_till) - (radish-vetch min_till) 0.86067 5.77 38 0.149
## (oat-clover min_till) - rye min_till 1.30200 5.77 38 0.226
## (oat-clover min_till) - (rye-clover min_till) -17.87633 5.77 38 -3.100
## (oat-clover min_till) - (rye-vetch min_till) -2.16833 5.77 38 -0.376
## (oat-clover min_till) - oat no_till 4.17733 5.77 38 0.724
## (oat-clover min_till) - (oat-clover no_till) -2.10933 5.77 38 -0.366
## (oat-clover min_till) - (oat-vetch no_till) -17.97900 5.77 38 -3.118
## (oat-clover min_till) - radish no_till 9.81867 5.77 38 1.703
## (oat-clover min_till) - (radish-oat no_till) 6.88567 5.77 38 1.194
## (oat-clover min_till) - (radish-rye no_till) 4.97767 5.77 38 0.863
## (oat-clover min_till) - (radish-vetch no_till) 0.71633 5.77 38 0.124
## (oat-clover min_till) - rye no_till 2.63000 5.77 38 0.456
## (oat-clover min_till) - (rye-clover no_till) -17.21867 5.77 38 -2.986
## (oat-clover min_till) - (rye-vetch no_till) -5.65767 5.77 38 -0.981
## (oat-vetch min_till) - radish min_till 13.63867 5.77 38 2.365
## (oat-vetch min_till) - (radish-oat min_till) 14.71867 5.77 38 2.552
## (oat-vetch min_till) - (radish-rye min_till) 9.83833 5.77 38 1.706
## (oat-vetch min_till) - (radish-vetch min_till) 6.48700 5.77 38 1.125
## (oat-vetch min_till) - rye min_till 6.92833 5.77 38 1.201
## (oat-vetch min_till) - (rye-clover min_till) -12.25000 5.77 38 -2.124
## (oat-vetch min_till) - (rye-vetch min_till) 3.45800 5.77 38 0.600
## (oat-vetch min_till) - oat no_till 9.80367 5.77 38 1.700
## (oat-vetch min_till) - (oat-clover no_till) 3.51700 5.77 38 0.610
## (oat-vetch min_till) - (oat-vetch no_till) -12.35267 5.77 38 -2.142
## (oat-vetch min_till) - radish no_till 15.44500 5.77 38 2.678
## (oat-vetch min_till) - (radish-oat no_till) 12.51200 5.77 38 2.170
## (oat-vetch min_till) - (radish-rye no_till) 10.60400 5.77 38 1.839
## (oat-vetch min_till) - (radish-vetch no_till) 6.34267 5.77 38 1.100
## (oat-vetch min_till) - rye no_till 8.25633 5.77 38 1.432
## (oat-vetch min_till) - (rye-clover no_till) -11.59233 5.77 38 -2.010
## (oat-vetch min_till) - (rye-vetch no_till) -0.03133 5.77 38 -0.005
## radish min_till - (radish-oat min_till) 1.08000 5.77 38 0.187
## radish min_till - (radish-rye min_till) -3.80033 5.77 38 -0.659
## radish min_till - (radish-vetch min_till) -7.15167 5.77 38 -1.240
## radish min_till - rye min_till -6.71033 5.77 38 -1.164
## radish min_till - (rye-clover min_till) -25.88867 5.77 38 -4.489
## radish min_till - (rye-vetch min_till) -10.18067 5.77 38 -1.765
## radish min_till - oat no_till -3.83500 5.77 38 -0.665
## radish min_till - (oat-clover no_till) -10.12167 5.77 38 -1.755
## radish min_till - (oat-vetch no_till) -25.99133 5.77 38 -4.507
## radish min_till - radish no_till 1.80633 5.77 38 0.313
## radish min_till - (radish-oat no_till) -1.12667 5.77 38 -0.195
## radish min_till - (radish-rye no_till) -3.03467 5.77 38 -0.526
## radish min_till - (radish-vetch no_till) -7.29600 5.77 38 -1.265
## radish min_till - rye no_till -5.38233 5.77 38 -0.933
## radish min_till - (rye-clover no_till) -25.23100 5.77 38 -4.375
## radish min_till - (rye-vetch no_till) -13.67000 5.77 38 -2.371
## (radish-oat min_till) - (radish-rye min_till) -4.88033 5.77 38 -0.846
## (radish-oat min_till) - (radish-vetch min_till) -8.23167 5.77 38 -1.427
## (radish-oat min_till) - rye min_till -7.79033 5.77 38 -1.351
## (radish-oat min_till) - (rye-clover min_till) -26.96867 5.77 38 -4.677
## (radish-oat min_till) - (rye-vetch min_till) -11.26067 5.77 38 -1.953
## (radish-oat min_till) - oat no_till -4.91500 5.77 38 -0.852
## (radish-oat min_till) - (oat-clover no_till) -11.20167 5.77 38 -1.942
## (radish-oat min_till) - (oat-vetch no_till) -27.07133 5.77 38 -4.694
## (radish-oat min_till) - radish no_till 0.72633 5.77 38 0.126
## (radish-oat min_till) - (radish-oat no_till) -2.20667 5.77 38 -0.383
## (radish-oat min_till) - (radish-rye no_till) -4.11467 5.77 38 -0.714
## (radish-oat min_till) - (radish-vetch no_till) -8.37600 5.77 38 -1.452
## (radish-oat min_till) - rye no_till -6.46233 5.77 38 -1.121
## (radish-oat min_till) - (rye-clover no_till) -26.31100 5.77 38 -4.563
## (radish-oat min_till) - (rye-vetch no_till) -14.75000 5.77 38 -2.558
## (radish-rye min_till) - (radish-vetch min_till) -3.35133 5.77 38 -0.581
## (radish-rye min_till) - rye min_till -2.91000 5.77 38 -0.505
## (radish-rye min_till) - (rye-clover min_till) -22.08833 5.77 38 -3.830
## (radish-rye min_till) - (rye-vetch min_till) -6.38033 5.77 38 -1.106
## (radish-rye min_till) - oat no_till -0.03467 5.77 38 -0.006
## (radish-rye min_till) - (oat-clover no_till) -6.32133 5.77 38 -1.096
## (radish-rye min_till) - (oat-vetch no_till) -22.19100 5.77 38 -3.848
## (radish-rye min_till) - radish no_till 5.60667 5.77 38 0.972
## (radish-rye min_till) - (radish-oat no_till) 2.67367 5.77 38 0.464
## (radish-rye min_till) - (radish-rye no_till) 0.76567 5.77 38 0.133
## (radish-rye min_till) - (radish-vetch no_till) -3.49567 5.77 38 -0.606
## (radish-rye min_till) - rye no_till -1.58200 5.77 38 -0.274
## (radish-rye min_till) - (rye-clover no_till) -21.43067 5.77 38 -3.716
## (radish-rye min_till) - (rye-vetch no_till) -9.86967 5.77 38 -1.712
## (radish-vetch min_till) - rye min_till 0.44133 5.77 38 0.077
## (radish-vetch min_till) - (rye-clover min_till) -18.73700 5.77 38 -3.249
## (radish-vetch min_till) - (rye-vetch min_till) -3.02900 5.77 38 -0.525
## (radish-vetch min_till) - oat no_till 3.31667 5.77 38 0.575
## (radish-vetch min_till) - (oat-clover no_till) -2.97000 5.77 38 -0.515
## (radish-vetch min_till) - (oat-vetch no_till) -18.83967 5.77 38 -3.267
## (radish-vetch min_till) - radish no_till 8.95800 5.77 38 1.553
## (radish-vetch min_till) - (radish-oat no_till) 6.02500 5.77 38 1.045
## (radish-vetch min_till) - (radish-rye no_till) 4.11700 5.77 38 0.714
## (radish-vetch min_till) - (radish-vetch no_till) -0.14433 5.77 38 -0.025
## (radish-vetch min_till) - rye no_till 1.76933 5.77 38 0.307
## (radish-vetch min_till) - (rye-clover no_till) -18.07933 5.77 38 -3.135
## (radish-vetch min_till) - (rye-vetch no_till) -6.51833 5.77 38 -1.130
## rye min_till - (rye-clover min_till) -19.17833 5.77 38 -3.326
## rye min_till - (rye-vetch min_till) -3.47033 5.77 38 -0.602
## rye min_till - oat no_till 2.87533 5.77 38 0.499
## rye min_till - (oat-clover no_till) -3.41133 5.77 38 -0.592
## rye min_till - (oat-vetch no_till) -19.28100 5.77 38 -3.344
## rye min_till - radish no_till 8.51667 5.77 38 1.477
## rye min_till - (radish-oat no_till) 5.58367 5.77 38 0.968
## rye min_till - (radish-rye no_till) 3.67567 5.77 38 0.637
## rye min_till - (radish-vetch no_till) -0.58567 5.77 38 -0.102
## rye min_till - rye no_till 1.32800 5.77 38 0.230
## rye min_till - (rye-clover no_till) -18.52067 5.77 38 -3.212
## rye min_till - (rye-vetch no_till) -6.95967 5.77 38 -1.207
## (rye-clover min_till) - (rye-vetch min_till) 15.70800 5.77 38 2.724
## (rye-clover min_till) - oat no_till 22.05367 5.77 38 3.824
## (rye-clover min_till) - (oat-clover no_till) 15.76700 5.77 38 2.734
## (rye-clover min_till) - (oat-vetch no_till) -0.10267 5.77 38 -0.018
## (rye-clover min_till) - radish no_till 27.69500 5.77 38 4.803
## (rye-clover min_till) - (radish-oat no_till) 24.76200 5.77 38 4.294
## (rye-clover min_till) - (radish-rye no_till) 22.85400 5.77 38 3.963
## (rye-clover min_till) - (radish-vetch no_till) 18.59267 5.77 38 3.224
## (rye-clover min_till) - rye no_till 20.50633 5.77 38 3.556
## (rye-clover min_till) - (rye-clover no_till) 0.65767 5.77 38 0.114
## (rye-clover min_till) - (rye-vetch no_till) 12.21867 5.77 38 2.119
## (rye-vetch min_till) - oat no_till 6.34567 5.77 38 1.100
## (rye-vetch min_till) - (oat-clover no_till) 0.05900 5.77 38 0.010
## (rye-vetch min_till) - (oat-vetch no_till) -15.81067 5.77 38 -2.742
## (rye-vetch min_till) - radish no_till 11.98700 5.77 38 2.079
## (rye-vetch min_till) - (radish-oat no_till) 9.05400 5.77 38 1.570
## (rye-vetch min_till) - (radish-rye no_till) 7.14600 5.77 38 1.239
## (rye-vetch min_till) - (radish-vetch no_till) 2.88467 5.77 38 0.500
## (rye-vetch min_till) - rye no_till 4.79833 5.77 38 0.832
## (rye-vetch min_till) - (rye-clover no_till) -15.05033 5.77 38 -2.610
## (rye-vetch min_till) - (rye-vetch no_till) -3.48933 5.77 38 -0.605
## oat no_till - (oat-clover no_till) -6.28667 5.77 38 -1.090
## oat no_till - (oat-vetch no_till) -22.15633 5.77 38 -3.842
## oat no_till - radish no_till 5.64133 5.77 38 0.978
## oat no_till - (radish-oat no_till) 2.70833 5.77 38 0.470
## oat no_till - (radish-rye no_till) 0.80033 5.77 38 0.139
## oat no_till - (radish-vetch no_till) -3.46100 5.77 38 -0.600
## oat no_till - rye no_till -1.54733 5.77 38 -0.268
## oat no_till - (rye-clover no_till) -21.39600 5.77 38 -3.710
## oat no_till - (rye-vetch no_till) -9.83500 5.77 38 -1.705
## (oat-clover no_till) - (oat-vetch no_till) -15.86967 5.77 38 -2.752
## (oat-clover no_till) - radish no_till 11.92800 5.77 38 2.068
## (oat-clover no_till) - (radish-oat no_till) 8.99500 5.77 38 1.560
## (oat-clover no_till) - (radish-rye no_till) 7.08700 5.77 38 1.229
## (oat-clover no_till) - (radish-vetch no_till) 2.82567 5.77 38 0.490
## (oat-clover no_till) - rye no_till 4.73933 5.77 38 0.822
## (oat-clover no_till) - (rye-clover no_till) -15.10933 5.77 38 -2.620
## (oat-clover no_till) - (rye-vetch no_till) -3.54833 5.77 38 -0.615
## (oat-vetch no_till) - radish no_till 27.79767 5.77 38 4.820
## (oat-vetch no_till) - (radish-oat no_till) 24.86467 5.77 38 4.312
## (oat-vetch no_till) - (radish-rye no_till) 22.95667 5.77 38 3.981
## (oat-vetch no_till) - (radish-vetch no_till) 18.69533 5.77 38 3.242
## (oat-vetch no_till) - rye no_till 20.60900 5.77 38 3.574
## (oat-vetch no_till) - (rye-clover no_till) 0.76033 5.77 38 0.132
## (oat-vetch no_till) - (rye-vetch no_till) 12.32133 5.77 38 2.137
## radish no_till - (radish-oat no_till) -2.93300 5.77 38 -0.509
## radish no_till - (radish-rye no_till) -4.84100 5.77 38 -0.839
## radish no_till - (radish-vetch no_till) -9.10233 5.77 38 -1.578
## radish no_till - rye no_till -7.18867 5.77 38 -1.247
## radish no_till - (rye-clover no_till) -27.03733 5.77 38 -4.689
## radish no_till - (rye-vetch no_till) -15.47633 5.77 38 -2.684
## (radish-oat no_till) - (radish-rye no_till) -1.90800 5.77 38 -0.331
## (radish-oat no_till) - (radish-vetch no_till) -6.16933 5.77 38 -1.070
## (radish-oat no_till) - rye no_till -4.25567 5.77 38 -0.738
## (radish-oat no_till) - (rye-clover no_till) -24.10433 5.77 38 -4.180
## (radish-oat no_till) - (rye-vetch no_till) -12.54333 5.77 38 -2.175
## (radish-rye no_till) - (radish-vetch no_till) -4.26133 5.77 38 -0.739
## (radish-rye no_till) - rye no_till -2.34767 5.77 38 -0.407
## (radish-rye no_till) - (rye-clover no_till) -22.19633 5.77 38 -3.849
## (radish-rye no_till) - (rye-vetch no_till) -10.63533 5.77 38 -1.844
## (radish-vetch no_till) - rye no_till 1.91367 5.77 38 0.332
## (radish-vetch no_till) - (rye-clover no_till) -17.93500 5.77 38 -3.110
## (radish-vetch no_till) - (rye-vetch no_till) -6.37400 5.77 38 -1.105
## rye no_till - (rye-clover no_till) -19.84867 5.77 38 -3.442
## rye no_till - (rye-vetch no_till) -8.28767 5.77 38 -1.437
## (rye-clover no_till) - (rye-vetch no_till) 11.56100 5.77 38 2.005
## p.value
## 1.0000
## 0.9691
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.0474
## 0.9998
## 1.0000
## 0.9998
## 0.0453
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.0626
## 0.9682
## 1.0000
## 0.9962
## 0.9850
## 1.0000
## 1.0000
## 1.0000
## 0.2348
## 1.0000
## 1.0000
## 1.0000
## 0.2270
## 0.9685
## 0.9994
## 1.0000
## 1.0000
## 1.0000
## 0.2892
## 1.0000
## 0.6812
## 0.5551
## 0.9679
## 0.9997
## 0.9994
## 0.8247
## 1.0000
## 0.9689
## 1.0000
## 0.8153
## 0.4708
## 0.8003
## 0.9384
## 0.9998
## 0.9947
## 0.8785
## 1.0000
## 1.0000
## 1.0000
## 0.9991
## 0.9996
## 0.0081
## 0.9564
## 1.0000
## 0.9585
## 0.0077
## 1.0000
## 1.0000
## 1.0000
## 0.9988
## 1.0000
## 0.0111
## 0.6776
## 1.0000
## 0.9948
## 0.9973
## 0.0047
## 0.9015
## 1.0000
## 0.9053
## 0.0045
## 1.0000
## 1.0000
## 1.0000
## 0.9937
## 0.9998
## 0.0066
## 0.5514
## 1.0000
## 1.0000
## 0.0465
## 0.9998
## 1.0000
## 0.9998
## 0.0445
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.0616
## 0.9669
## 1.0000
## 0.1751
## 1.0000
## 1.0000
## 1.0000
## 0.1688
## 0.9871
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 0.2195
## 0.9997
## 0.1494
## 1.0000
## 1.0000
## 1.0000
## 0.1439
## 0.9925
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.1889
## 0.9993
## 0.4413
## 0.0472
## 0.4347
## 1.0000
## 0.0033
## 0.0138
## 0.0333
## 0.1842
## 0.0898
## 1.0000
## 0.8275
## 0.9998
## 1.0000
## 0.4299
## 0.8475
## 0.9856
## 0.9991
## 1.0000
## 1.0000
## 0.5162
## 1.0000
## 0.9998
## 0.0452
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.0625
## 0.9680
## 0.4235
## 0.8524
## 0.9866
## 0.9992
## 1.0000
## 1.0000
## 0.5094
## 1.0000
## 0.0031
## 0.0132
## 0.0318
## 0.1777
## 0.0862
## 1.0000
## 0.8182
## 1.0000
## 1.0000
## 0.9848
## 0.9990
## 0.0046
## 0.4672
## 1.0000
## 0.9999
## 1.0000
## 0.0188
## 0.7973
## 1.0000
## 1.0000
## 0.0444
## 0.9369
## 1.0000
## 0.2303
## 0.9998
## 0.1162
## 0.9944
## 0.8808
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 20 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tc_cctil <- mixed(
c_gkg ~ cc_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f, tillage
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_tc_cctil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: c_gkg ~ cc_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 38 8.64 *** <.001
## 2 tillage 1, 38 0.74 .394
## 3 cc_type_f:tillage 9, 38 0.52 .851
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
Agroforestry treatment was found to be NOT significant (p = 0.74) using a linear mixed-effects model with total N as the response variable, agro_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tn_ag_treats2 <- lmer(n_gkg ~ agro_treatment + (1 | year), data = ag_treats2)
# Summarize the model results
summary(model_tn_ag_treats2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ agro_treatment + (1 | year)
## Data: ag_treats2
##
## REML criterion at convergence: 27.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.52932 -0.53724 -0.04749 0.55323 1.98485
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05196 0.228
## Residual 0.07784 0.279
## Number of obs: 62, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.24767 0.13645 2.01303 9.144 0.0115 *
## agro_treatmentno_agroforestry -0.06867 0.20204 58.13231 -0.340 0.7352
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agr_trtmnt_ -0.047
# Extract fixed effects
fixef(model_tn_ag_treats2)
## (Intercept) agro_treatmentno_agroforestry
## 1.2476667 -0.0686726
# Extract random effects (conditional modes)
ranef(model_tn_ag_treats2)
## $year
## (Intercept)
## 2021 0.03798813
## 2022 -0.23656953
## 2023 0.19858140
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_ag_treats2) # residuals vs fitted
qqnorm(resid(model_tn_ag_treats2)); qqline(resid(model_tn_ag_treats2)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_treatment as a factor for pairwise comparisons
ag_treats2$agro_treatment_f <- factor(ag_treats2$agro_treatment)
lmer_model_tn_ag_treats2_factor <- lmer(n_gkg ~ agro_treatment_f + (1 | year), data = ag_treats2)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_tn_ag_treats2_result <- emmeans(lmer_model_tn_ag_treats2_factor, pairwise ~ agro_treatment_f, adjust = "tukey")
# View the results
emmeans_tn_ag_treats2_result
## $emmeans
## agro_treatment_f emmean SE df lower.CL upper.CL
## agroforestry 1.25 0.136 2.01 0.662 1.83
## no_agroforestry 1.18 0.239 16.26 0.674 1.68
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 0.0687 0.202 58.1 0.340 0.7354
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_ag_treats2 <- mixed(
n_gkg ~ agro_treatment_f + (1 | year),
data = ag_treats2,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_treatment_f
# Nice ANOVA table
print(nice(anova_kr_tn_ag_treats2), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ agro_treatment_f + (1 | year)
## Data: ag_treats2
## Effect df F p.value
## 1 agro_treatment_f 1, 58.13 0.12 .735
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_ag_treats2 <- anova_kr_tn_ag_treats2$Anova
car_table_tn_ag_treats2 # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.ag_treats2 <- emmeans(model_tn_ag_treats2, "agro_treatment")
pairs(n_gkg.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 0.0687 0.202 58.1 0.340 0.7354
##
## Degrees-of-freedom method: kenward-roger
cld(n_gkg.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_treatment emmean SE df lower.CL upper.CL .group
## no_agroforestry 1.18 0.239 16.26 0.591 1.77 a
## agroforestry 1.25 0.136 2.01 0.410 2.09 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Agroforestry tree type was found to be significant (p < 0.001) using a linear mixed-effects model with total N as the response variable, agro_type as the fixed effect, and (1 / year) as the random intercept.
model_tn_ag <- lmer(n_gkg ~ agro_type + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_tn_ag)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ agro_type + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 10.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5074 -0.5556 -0.0379 0.6482 1.8186
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05498 0.2345
## Residual 0.05595 0.2365
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.37075 0.14100 2.13110 9.722 0.00842 **
## agro_typepine -0.30771 0.06233 56.00001 -4.937 7.51e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agro_typepn -0.177
# Extract fixed effects
fixef(model_tn_ag)
## (Intercept) agro_typepine
## 1.3707500 -0.3077083
# Extract random effects (conditional modes)
ranef(model_tn_ag)
## $year
## (Intercept)
## 2021 0.03885629
## 2022 -0.24566692
## 2023 0.20681063
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_ag) # residuals vs fitted
qqnorm(resid(model_tn_ag)); qqline(resid(model_tn_ag)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
lmer_model_tn_ag_factor <- lmer(n_gkg ~ agro_type_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_type_f` factor.
emmeans_tn_ag_result <- emmeans(lmer_model_tn_ag_factor, pairwise ~ agro_type_f, adjust = "tukey")
# View the results
emmeans_tn_ag_result
## $emmeans
## agro_type_f emmean SE df lower.CL upper.CL
## pecan 1.37 0.141 2.13 0.798 1.94
## pine 1.06 0.144 2.30 0.516 1.61
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan - pine 0.308 0.0623 56 4.937 <.0001
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_ag <- mixed(
n_gkg ~ agro_type_f + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f
# Nice ANOVA table
print(nice(anova_kr_tn_ag), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ agro_type_f + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 56 24.37 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_ag <- anova_kr_tn_ag$Anova
car_table_tn_ag # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.ag <- emmeans(model_tn_ag, "agro_type")
pairs(n_gkg.emm.s.ag, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## pecan - pine 0.308 0.0623 56 4.937 <.0001
##
## Degrees-of-freedom method: kenward-roger
cld(n_gkg.emm.s.ag, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_type emmean SE df lower.CL upper.CL .group
## pine 1.06 0.144 2.30 0.308 1.82 a
## pecan 1.37 0.141 2.13 0.566 2.18 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop treatment was found to be NOT significant (p = 0.52) using a linear mixed-effects model with total N as the response variable, cc_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tn_cc_treats <- lmer(n_gkg ~ cc_treatment + (1 | year), data = dat)
# Summarize the model results
summary(model_tn_cc_treats)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ cc_treatment + (1 | year)
## Data: dat
##
## REML criterion at convergence: 27.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.54288 -0.53885 -0.05313 0.56150 1.98993
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05253 0.2292
## Residual 0.07702 0.2775
## Number of obs: 64, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.24767 0.13709 2.02447 9.101 0.0114 *
## cc_treatmentno_cc 0.09461 0.14538 60.25158 0.651 0.5177
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## cc_trtmntn_ -0.064
# Extract fixed effects
fixef(model_tn_cc_treats)
## (Intercept) cc_treatmentno_cc
## 1.24766667 0.09460538
# Extract random effects (conditional modes)
ranef(model_tn_cc_treats)
## $year
## (Intercept)
## 2021 0.03804409
## 2022 -0.23812331
## 2023 0.20007921
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_cc_treats) # residuals vs fitted
qqnorm(resid(model_tn_cc_treats)); qqline(resid(model_tn_cc_treats)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_treatment as a factor for pairwise comparisons
dat$cc_treatment_f <- factor(dat$cc_treatment)
lmer_model_tn_cc_treats_factor <- lmer(n_gkg ~ cc_treatment_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_tn_cc_treats_result <- emmeans(lmer_model_tn_cc_treats_factor, pairwise ~ cc_treatment_f, adjust = "tukey")
# View the results
emmeans_tn_cc_treats_result
## $emmeans
## cc_treatment_f emmean SE df lower.CL upper.CL
## covercrop 1.25 0.137 2.01 0.661 1.83
## no_cc 1.34 0.194 7.67 0.893 1.79
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc -0.0946 0.146 60.2 -0.649 0.5186
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_cc_treats <- mixed(
n_gkg ~ cc_treatment_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_treatment_f
# Nice ANOVA table
print(nice(anova_kr_tn_cc_treats), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ cc_treatment_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_treatment_f 1, 60.24 0.42 .519
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_cc_treats <- anova_kr_tn_cc_treats$Anova
car_table_tn_cc_treats # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.cc_treats <- emmeans(model_tn_cc_treats, "cc_treatment")
pairs(n_gkg.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc -0.0946 0.146 60.2 -0.649 0.5186
##
## Degrees-of-freedom method: kenward-roger
cld(n_gkg.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_treatment emmean SE df lower.CL upper.CL .group
## covercrop 1.25 0.137 2.01 0.409 2.09 a
## no_cc 1.34 0.194 7.67 0.806 1.88 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop class (mix, mono, control) was found to be NOT significant (p = 0.14) using a linear mixed-effects model with total N as the response variable, cc_class as the fixed effect, and (1 / year) as the random intercept.
model_tn_cc_c <- lmer(n_gkg ~ cc_class + (1 | year), data = dat)
# Summarize the model results
summary(model_tn_cc_c)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ cc_class + (1 | year)
## Data: dat
##
## REML criterion at convergence: 27.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.76180 -0.60641 -0.07631 0.68299 1.86965
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05267 0.2295
## Residual 0.07372 0.2715
## Number of obs: 64, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.29171 0.13897 2.13837 9.295 0.00915 **
## cc_classmono -0.14683 0.07649 59.01132 -1.919 0.05976 .
## cc_classnone 0.05062 0.14408 59.23195 0.351 0.72661
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_clssm
## cc_classmon -0.165
## cc_classnon -0.088 0.159
# Extract fixed effects
fixef(model_tn_cc_c)
## (Intercept) cc_classmono cc_classnone
## 1.29171429 -0.14682540 0.05061696
# Extract random effects (conditional modes)
ranef(model_tn_cc_c)
## $year
## (Intercept)
## 2021 0.03816249
## 2022 -0.23880610
## 2023 0.20064360
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_cc_c) # residuals vs fitted
qqnorm(resid(model_tn_cc_c)); qqline(resid(model_tn_cc_c)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_class as a factor for pairwise comparisons
dat$cc_class_f <- factor(dat$cc_class)
lmer_model_tn_cc_c_factor <- lmer(n_gkg ~ cc_class_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_class_f` factor.
emmeans_tn_cc_c_result <- emmeans(lmer_model_tn_cc_c_factor, pairwise ~ cc_class_f, adjust = "tukey")
# View the results
emmeans_tn_cc_c_result
## $emmeans
## cc_class_f emmean SE df lower.CL upper.CL
## mixed 1.29 0.139 2.13 0.727 1.86
## mono 1.14 0.147 2.67 0.642 1.65
## none 1.34 0.191 7.36 0.894 1.79
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## mixed - mono 0.1468 0.0765 59.0 1.919 0.1422
## mixed - none -0.0506 0.1440 59.2 -0.351 0.9346
## mono - none -0.1974 0.1520 59.2 -1.297 0.4026
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_cc_c <- mixed(
n_gkg ~ cc_class_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_class_f
# Nice ANOVA table
print(nice(anova_kr_tn_cc_c), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ cc_class_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_class_f 2, 59.11 2.06 .136
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_cc_c <- anova_kr_tn_cc_c$Anova
car_table_tn_cc_c # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.cc_c <- emmeans(model_tn_cc_c, "cc_class")
pairs(n_gkg.emm.s.cc_c, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## mixed - mono 0.1468 0.0765 59.0 1.919 0.1422
## mixed - none -0.0506 0.1440 59.2 -0.351 0.9346
## mono - none -0.1974 0.1520 59.2 -1.297 0.4026
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
cld(n_gkg.emm.s.cc_c, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_class emmean SE df lower.CL upper.CL .group
## mono 1.14 0.147 2.67 0.355 1.93 a
## mixed 1.29 0.139 2.13 0.323 2.26 a
## none 1.34 0.191 7.36 0.755 1.93 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 3 estimates
## P value adjustment: tukey method for comparing a family of 3 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop type was found to be significant (p < 0.001) using a linear mixed-effects model with total N as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_tn_cc <- lmer(n_gkg ~ cc_type + (1 | year), data = cc_nocntrl)
# Summarize the model results
summary(model_tn_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ cc_type + (1 | year)
## Data: cc_nocntrl
##
## REML criterion at convergence: 10.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5069 -0.3703 0.0692 0.5236 2.3794
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05556 0.2357
## Residual 0.04438 0.2107
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.21233 0.16098 3.60357 7.531 0.00250 **
## cc_typeoat-clover 0.10033 0.12162 48.00000 0.825 0.41348
## cc_typeoat-vetch 0.37817 0.12162 48.00000 3.109 0.00315 **
## cc_typeradish -0.28900 0.12162 48.00000 -2.376 0.02153 *
## cc_typeradish-oat -0.23183 0.12162 48.00000 -1.906 0.06263 .
## cc_typeradish-rye -0.02450 0.12162 48.00000 -0.201 0.84121
## cc_typeradish-vetch -0.05183 0.12162 48.00000 -0.426 0.67188
## cc_typerye 0.08667 0.12162 48.00000 0.713 0.47956
## cc_typerye-clover 0.31817 0.12162 48.00000 2.616 0.01186 *
## cc_typerye-vetch 0.06717 0.12162 48.00000 0.552 0.58334
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typrd cc_typrdsh-t cc_typrdsh-r
## cc_typt-clv -0.378
## cc_typt-vtc -0.378 0.500
## cc_typerdsh -0.378 0.500 0.500
## cc_typrdsh-t -0.378 0.500 0.500 0.500
## cc_typrdsh-r -0.378 0.500 0.500 0.500 0.500
## cc_typrdsh-v -0.378 0.500 0.500 0.500 0.500 0.500
## cc_typerye -0.378 0.500 0.500 0.500 0.500 0.500
## cc_typry-cl -0.378 0.500 0.500 0.500 0.500 0.500
## cc_typry-vt -0.378 0.500 0.500 0.500 0.500 0.500
## cc_typrdsh-v cc_typry cc_typry-c
## cc_typt-clv
## cc_typt-vtc
## cc_typerdsh
## cc_typrdsh-t
## cc_typrdsh-r
## cc_typrdsh-v
## cc_typerye 0.500
## cc_typry-cl 0.500 0.500
## cc_typry-vt 0.500 0.500 0.500
# Extract fixed effects
fixef(model_tn_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typeradish
## 1.21233333 0.10033333 0.37816667 -0.28900000
## cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch cc_typerye
## -0.23183333 -0.02450000 -0.05183333 0.08666667
## cc_typerye-clover cc_typerye-vetch
## 0.31816667 0.06716667
# Extract random effects (conditional modes)
ranef(model_tn_cc)
## $year
## (Intercept)
## 2021 0.03926514
## 2022 -0.24825186
## 2023 0.20898671
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_cc) # residuals vs fitted
qqnorm(resid(model_tn_cc)); qqline(resid(model_tn_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
cc_nocntrl$cc_type_f <- factor(cc_nocntrl$cc_type)
lmer_model_tn_cc_factor <- lmer(n_gkg ~ cc_type_f + (1 | year), data = cc_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_tn_cc_result <- emmeans(lmer_model_tn_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_tn_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 1.212 0.161 3.6 0.745 1.68
## oat-clover 1.313 0.161 3.6 0.846 1.78
## oat-vetch 1.591 0.161 3.6 1.123 2.06
## radish 0.923 0.161 3.6 0.456 1.39
## radish-oat 0.981 0.161 3.6 0.513 1.45
## radish-rye 1.188 0.161 3.6 0.721 1.65
## radish-vetch 1.161 0.161 3.6 0.693 1.63
## rye 1.299 0.161 3.6 0.832 1.77
## rye-clover 1.530 0.161 3.6 1.063 2.00
## rye-vetch 1.280 0.161 3.6 0.812 1.75
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.1003 0.122 48 -0.825 0.9978
## oat - (oat-vetch) -0.3782 0.122 48 -3.109 0.0831
## oat - radish 0.2890 0.122 48 2.376 0.3623
## oat - (radish-oat) 0.2318 0.122 48 1.906 0.6650
## oat - (radish-rye) 0.0245 0.122 48 0.201 1.0000
## oat - (radish-vetch) 0.0518 0.122 48 0.426 1.0000
## oat - rye -0.0867 0.122 48 -0.713 0.9993
## oat - (rye-clover) -0.3182 0.122 48 -2.616 0.2385
## oat - (rye-vetch) -0.0672 0.122 48 -0.552 0.9999
## (oat-clover) - (oat-vetch) -0.2778 0.122 48 -2.284 0.4173
## (oat-clover) - radish 0.3893 0.122 48 3.201 0.0667
## (oat-clover) - (radish-oat) 0.3322 0.122 48 2.731 0.1907
## (oat-clover) - (radish-rye) 0.1248 0.122 48 1.026 0.9891
## (oat-clover) - (radish-vetch) 0.1522 0.122 48 1.251 0.9595
## (oat-clover) - rye 0.0137 0.122 48 0.112 1.0000
## (oat-clover) - (rye-clover) -0.2178 0.122 48 -1.791 0.7373
## (oat-clover) - (rye-vetch) 0.0332 0.122 48 0.273 1.0000
## (oat-vetch) - radish 0.6672 0.122 48 5.485 0.0001
## (oat-vetch) - (radish-oat) 0.6100 0.122 48 5.015 0.0003
## (oat-vetch) - (radish-rye) 0.4027 0.122 48 3.311 0.0507
## (oat-vetch) - (radish-vetch) 0.4300 0.122 48 3.535 0.0282
## (oat-vetch) - rye 0.2915 0.122 48 2.397 0.3505
## (oat-vetch) - (rye-clover) 0.0600 0.122 48 0.493 1.0000
## (oat-vetch) - (rye-vetch) 0.3110 0.122 48 2.557 0.2660
## radish - (radish-oat) -0.0572 0.122 48 -0.470 1.0000
## radish - (radish-rye) -0.2645 0.122 48 -2.175 0.4872
## radish - (radish-vetch) -0.2372 0.122 48 -1.950 0.6363
## radish - rye -0.3757 0.122 48 -3.089 0.0873
## radish - (rye-clover) -0.6072 0.122 48 -4.992 0.0003
## radish - (rye-vetch) -0.3562 0.122 48 -2.928 0.1258
## (radish-oat) - (radish-rye) -0.2073 0.122 48 -1.705 0.7873
## (radish-oat) - (radish-vetch) -0.1800 0.122 48 -1.480 0.8934
## (radish-oat) - rye -0.3185 0.122 48 -2.619 0.2373
## (radish-oat) - (rye-clover) -0.5500 0.122 48 -4.522 0.0015
## (radish-oat) - (rye-vetch) -0.2990 0.122 48 -2.458 0.3163
## (radish-rye) - (radish-vetch) 0.0273 0.122 48 0.225 1.0000
## (radish-rye) - rye -0.1112 0.122 48 -0.914 0.9952
## (radish-rye) - (rye-clover) -0.3427 0.122 48 -2.817 0.1597
## (radish-rye) - (rye-vetch) -0.0917 0.122 48 -0.754 0.9989
## (radish-vetch) - rye -0.1385 0.122 48 -1.139 0.9778
## (radish-vetch) - (rye-clover) -0.3700 0.122 48 -3.042 0.0973
## (radish-vetch) - (rye-vetch) -0.1190 0.122 48 -0.978 0.9922
## rye - (rye-clover) -0.2315 0.122 48 -1.903 0.6668
## rye - (rye-vetch) 0.0195 0.122 48 0.160 1.0000
## (rye-clover) - (rye-vetch) 0.2510 0.122 48 2.064 0.5606
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_cc <- mixed(
n_gkg ~ cc_type_f + (1 | year),
data = cc_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_tn_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ cc_type_f + (1 | year)
## Data: cc_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 48 5.92 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_cc <- anova_kr_tn_cc$Anova
car_table_tn_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.cc <- emmeans(model_tn_cc, "cc_type")
pairs(n_gkg.emm.s.cc, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.1003 0.122 48 -0.825 0.9978
## oat - (oat-vetch) -0.3782 0.122 48 -3.109 0.0831
## oat - radish 0.2890 0.122 48 2.376 0.3623
## oat - (radish-oat) 0.2318 0.122 48 1.906 0.6650
## oat - (radish-rye) 0.0245 0.122 48 0.201 1.0000
## oat - (radish-vetch) 0.0518 0.122 48 0.426 1.0000
## oat - rye -0.0867 0.122 48 -0.713 0.9993
## oat - (rye-clover) -0.3182 0.122 48 -2.616 0.2385
## oat - (rye-vetch) -0.0672 0.122 48 -0.552 0.9999
## (oat-clover) - (oat-vetch) -0.2778 0.122 48 -2.284 0.4173
## (oat-clover) - radish 0.3893 0.122 48 3.201 0.0667
## (oat-clover) - (radish-oat) 0.3322 0.122 48 2.731 0.1907
## (oat-clover) - (radish-rye) 0.1248 0.122 48 1.026 0.9891
## (oat-clover) - (radish-vetch) 0.1522 0.122 48 1.251 0.9595
## (oat-clover) - rye 0.0137 0.122 48 0.112 1.0000
## (oat-clover) - (rye-clover) -0.2178 0.122 48 -1.791 0.7373
## (oat-clover) - (rye-vetch) 0.0332 0.122 48 0.273 1.0000
## (oat-vetch) - radish 0.6672 0.122 48 5.485 0.0001
## (oat-vetch) - (radish-oat) 0.6100 0.122 48 5.015 0.0003
## (oat-vetch) - (radish-rye) 0.4027 0.122 48 3.311 0.0507
## (oat-vetch) - (radish-vetch) 0.4300 0.122 48 3.535 0.0282
## (oat-vetch) - rye 0.2915 0.122 48 2.397 0.3505
## (oat-vetch) - (rye-clover) 0.0600 0.122 48 0.493 1.0000
## (oat-vetch) - (rye-vetch) 0.3110 0.122 48 2.557 0.2660
## radish - (radish-oat) -0.0572 0.122 48 -0.470 1.0000
## radish - (radish-rye) -0.2645 0.122 48 -2.175 0.4872
## radish - (radish-vetch) -0.2372 0.122 48 -1.950 0.6363
## radish - rye -0.3757 0.122 48 -3.089 0.0873
## radish - (rye-clover) -0.6072 0.122 48 -4.992 0.0003
## radish - (rye-vetch) -0.3562 0.122 48 -2.928 0.1258
## (radish-oat) - (radish-rye) -0.2073 0.122 48 -1.705 0.7873
## (radish-oat) - (radish-vetch) -0.1800 0.122 48 -1.480 0.8934
## (radish-oat) - rye -0.3185 0.122 48 -2.619 0.2373
## (radish-oat) - (rye-clover) -0.5500 0.122 48 -4.522 0.0015
## (radish-oat) - (rye-vetch) -0.2990 0.122 48 -2.458 0.3163
## (radish-rye) - (radish-vetch) 0.0273 0.122 48 0.225 1.0000
## (radish-rye) - rye -0.1112 0.122 48 -0.914 0.9952
## (radish-rye) - (rye-clover) -0.3427 0.122 48 -2.817 0.1597
## (radish-rye) - (rye-vetch) -0.0917 0.122 48 -0.754 0.9989
## (radish-vetch) - rye -0.1385 0.122 48 -1.139 0.9778
## (radish-vetch) - (rye-clover) -0.3700 0.122 48 -3.042 0.0973
## (radish-vetch) - (rye-vetch) -0.1190 0.122 48 -0.978 0.9922
## rye - (rye-clover) -0.2315 0.122 48 -1.903 0.6668
## rye - (rye-vetch) 0.0195 0.122 48 0.160 1.0000
## (rye-clover) - (rye-vetch) 0.2510 0.122 48 2.064 0.5606
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
cld(n_gkg.emm.s.cc, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 0.923 0.161 3.6 -0.057588 1.90 a
## radish-oat 0.981 0.161 3.6 -0.000421 1.96 a
## radish-vetch 1.161 0.161 3.6 0.179579 2.14 ab
## radish-rye 1.188 0.161 3.6 0.206912 2.17 abc
## oat 1.212 0.161 3.6 0.231412 2.19 abc
## rye-vetch 1.280 0.161 3.6 0.298579 2.26 abc
## rye 1.299 0.161 3.6 0.318079 2.28 abc
## oat-clover 1.313 0.161 3.6 0.331745 2.29 abc
## rye-clover 1.530 0.161 3.6 0.549579 2.51 bc
## oat-vetch 1.591 0.161 3.6 0.609579 2.57 c
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 10 estimates
## P value adjustment: tukey method for comparing a family of 10 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Within the plots using pecan agroforestry, cover crop type was found to be significant (p = 0.039) using a linear mixed-effects model with total N as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_tn_pec_cc <- lmer(n_gkg ~ cc_type + (1 | year), data = datPEC)
# Summarize the model results
summary(model_tn_pec_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ cc_type + (1 | year)
## Data: datPEC
##
## REML criterion at convergence: 12.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3211 -0.3642 0.1421 0.4430 2.1778
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.06602 0.2569
## Residual 0.05085 0.2255
## Number of obs: 36, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.21233 0.17459 3.36626 6.944 0.00417 **
## cc_typeoat-clover 0.10033 0.13019 28.00000 0.771 0.44737
## cc_typeoat-vetch 0.37817 0.13019 28.00000 2.905 0.00710 **
## cc_typerye 0.08667 0.13019 28.00000 0.666 0.51107
## cc_typerye-clover 0.31817 0.13019 28.00000 2.444 0.02109 *
## cc_typerye-vetch 0.06717 0.13019 28.00000 0.516 0.60998
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typ cc_typry-c
## cc_typt-clv -0.373
## cc_typt-vtc -0.373 0.500
## cc_typerye -0.373 0.500 0.500
## cc_typry-cl -0.373 0.500 0.500 0.500
## cc_typry-vt -0.373 0.500 0.500 0.500 0.500
# Extract fixed effects
fixef(model_tn_pec_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typerye
## 1.21233333 0.10033333 0.37816667 0.08666667
## cc_typerye-clover cc_typerye-vetch
## 0.31816667 0.06716667
# Extract random effects (conditional modes)
ranef(model_tn_pec_cc)
## $year
## (Intercept)
## 2021 0.04941188
## 2022 -0.27008173
## 2023 0.22066985
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_pec_cc) # residuals vs fitted
qqnorm(resid(model_tn_pec_cc)); qqline(resid(model_tn_pec_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPEC$cc_type_f <- factor(datPEC$cc_type)
lmer_model_tn_pec_cc_factor <- lmer(n_gkg ~ cc_type_f + (1 | year), data = datPEC)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_tn_pec_cc_result <- emmeans(lmer_model_tn_pec_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_tn_pec_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 1.21 0.175 3.37 0.689 1.74
## oat-clover 1.31 0.175 3.37 0.790 1.84
## oat-vetch 1.59 0.175 3.37 1.068 2.11
## rye 1.30 0.175 3.37 0.776 1.82
## rye-clover 1.53 0.175 3.37 1.008 2.05
## rye-vetch 1.28 0.175 3.37 0.757 1.80
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.1003 0.13 28 -0.771 0.9703
## oat - (oat-vetch) -0.3782 0.13 28 -2.905 0.0697
## oat - rye -0.0867 0.13 28 -0.666 0.9843
## oat - (rye-clover) -0.3182 0.13 28 -2.444 0.1759
## oat - (rye-vetch) -0.0672 0.13 28 -0.516 0.9951
## (oat-clover) - (oat-vetch) -0.2778 0.13 28 -2.134 0.2997
## (oat-clover) - rye 0.0137 0.13 28 0.105 1.0000
## (oat-clover) - (rye-clover) -0.2178 0.13 28 -1.673 0.5597
## (oat-clover) - (rye-vetch) 0.0332 0.13 28 0.255 0.9998
## (oat-vetch) - rye 0.2915 0.13 28 2.239 0.2525
## (oat-vetch) - (rye-clover) 0.0600 0.13 28 0.461 0.9971
## (oat-vetch) - (rye-vetch) 0.3110 0.13 28 2.389 0.1945
## rye - (rye-clover) -0.2315 0.13 28 -1.778 0.4951
## rye - (rye-vetch) 0.0195 0.13 28 0.150 1.0000
## (rye-clover) - (rye-vetch) 0.2510 0.13 28 1.928 0.4071
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_pec_cc <- mixed(
n_gkg ~ cc_type_f + (1 | year),
data = datPEC,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_tn_pec_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ cc_type_f + (1 | year)
## Data: datPEC
## Effect df F p.value
## 1 cc_type_f 5, 28 2.73 * .039
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_pec_cc <- anova_kr_tn_pec_cc$Anova
car_table_tn_pec_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.cc_pec <- emmeans(model_tn_pec_cc, "cc_type")
pairs(n_gkg.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.1003 0.13 28 -0.771 0.9703
## oat - (oat-vetch) -0.3782 0.13 28 -2.905 0.0697
## oat - rye -0.0867 0.13 28 -0.666 0.9843
## oat - (rye-clover) -0.3182 0.13 28 -2.444 0.1759
## oat - (rye-vetch) -0.0672 0.13 28 -0.516 0.9951
## (oat-clover) - (oat-vetch) -0.2778 0.13 28 -2.134 0.2997
## (oat-clover) - rye 0.0137 0.13 28 0.105 1.0000
## (oat-clover) - (rye-clover) -0.2178 0.13 28 -1.673 0.5597
## (oat-clover) - (rye-vetch) 0.0332 0.13 28 0.255 0.9998
## (oat-vetch) - rye 0.2915 0.13 28 2.239 0.2525
## (oat-vetch) - (rye-clover) 0.0600 0.13 28 0.461 0.9971
## (oat-vetch) - (rye-vetch) 0.3110 0.13 28 2.389 0.1945
## rye - (rye-clover) -0.2315 0.13 28 -1.778 0.4951
## rye - (rye-vetch) 0.0195 0.13 28 0.150 1.0000
## (rye-clover) - (rye-vetch) 0.2510 0.13 28 1.928 0.4071
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
cld(n_gkg.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## oat 1.21 0.175 3.37 0.246 2.18 a
## rye-vetch 1.28 0.175 3.37 0.313 2.25 a
## rye 1.30 0.175 3.37 0.333 2.27 a
## oat-clover 1.31 0.175 3.37 0.346 2.28 a
## rye-clover 1.53 0.175 3.37 0.564 2.50 a
## oat-vetch 1.59 0.175 3.37 0.624 2.56 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 6 estimates
## P value adjustment: tukey method for comparing a family of 6 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Within the plots using pine agroforestry, cover crop type was found to be NOT significant (p = 0.071) using a linear mixed-effects model with total N as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_tn_pin_cc <- lmer(n_gkg ~ cc_type + (1 | year), data = datPIN)
# Summarize the model results
summary(model_tn_pin_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ cc_type + (1 | year)
## Data: datPIN
##
## REML criterion at convergence: 2.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.80978 -0.41658 -0.02672 0.56522 1.77850
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.03685 0.1920
## Residual 0.03707 0.1925
## Number of obs: 24, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 0.92333 0.13588 3.52097 6.795 0.00384 **
## cc_typeradish-oat 0.05717 0.11116 18.00000 0.514 0.61332
## cc_typeradish-rye 0.26450 0.11116 18.00000 2.379 0.02861 *
## cc_typeradish-vetch 0.23717 0.11116 18.00000 2.134 0.04690 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typrdsh-t cc_typrdsh-r
## cc_typrdsh-t -0.409
## cc_typrdsh-r -0.409 0.500
## cc_typrdsh-v -0.409 0.500 0.500
# Extract fixed effects
fixef(model_tn_pin_cc)
## (Intercept) cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch
## 0.92333333 0.05716667 0.26450000 0.23716667
# Extract random effects (conditional modes)
ranef(model_tn_pin_cc)
## $year
## (Intercept)
## 2021 0.02061608
## 2022 -0.19035635
## 2023 0.16974028
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_pin_cc) # residuals vs fitted
qqnorm(resid(model_tn_pin_cc)); qqline(resid(model_tn_pin_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPIN$cc_type_f <- factor(datPIN$cc_type)
lmer_model_tn_pin_cc_factor <- lmer(n_gkg ~ cc_type_f + (1 | year), data = datPIN)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_tn_pin_cc_result <- emmeans(lmer_model_tn_pin_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_tn_pin_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## radish 0.923 0.136 3.52 0.525 1.32
## radish-oat 0.981 0.136 3.52 0.582 1.38
## radish-rye 1.188 0.136 3.52 0.789 1.59
## radish-vetch 1.161 0.136 3.52 0.762 1.56
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -0.0572 0.111 18 -0.514 0.9546
## radish - (radish-rye) -0.2645 0.111 18 -2.379 0.1172
## radish - (radish-vetch) -0.2372 0.111 18 -2.134 0.1803
## (radish-oat) - (radish-rye) -0.2073 0.111 18 -1.865 0.2772
## (radish-oat) - (radish-vetch) -0.1800 0.111 18 -1.619 0.3932
## (radish-rye) - (radish-vetch) 0.0273 0.111 18 0.246 0.9946
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_pin_cc <- mixed(
n_gkg ~ cc_type_f + (1 | year),
data = datPIN,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_tn_pin_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ cc_type_f + (1 | year)
## Data: datPIN
## Effect df F p.value
## 1 cc_type_f 3, 18 2.77 + .071
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_pin_cc <- anova_kr_tn_pin_cc$Anova
car_table_tn_pin_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.cc_pin <- emmeans(model_tn_pin_cc, "cc_type")
pairs(n_gkg.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -0.0572 0.111 18 -0.514 0.9546
## radish - (radish-rye) -0.2645 0.111 18 -2.379 0.1172
## radish - (radish-vetch) -0.2372 0.111 18 -2.134 0.1803
## (radish-oat) - (radish-rye) -0.2073 0.111 18 -1.865 0.2772
## (radish-oat) - (radish-vetch) -0.1800 0.111 18 -1.619 0.3932
## (radish-rye) - (radish-vetch) 0.0273 0.111 18 0.246 0.9946
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
cld(n_gkg.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 0.923 0.136 3.52 0.287 1.56 a
## radish-oat 0.981 0.136 3.52 0.344 1.62 a
## radish-vetch 1.161 0.136 3.52 0.524 1.80 a
## radish-rye 1.188 0.136 3.52 0.551 1.82 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: tukey method for comparing a family of 4 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Tillage was found to be NOT significant (p = 0.36) using a linear mixed-effects model with total N as the response variable, tillage as the fixed effect, and (1 / year) as the random intercept.
model_tn_till <- lmer(n_gkg ~ tillage + (1 | year), data = till_nocntrl)
# Summarize the model results
summary(model_tn_till)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ tillage + (1 | year)
## Data: till_nocntrl
##
## REML criterion at convergence: 29.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.39062 -0.54271 -0.07164 0.53408 2.07361
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05382 0.2320
## Residual 0.07910 0.2813
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.21433 0.14345 2.28282 8.465 0.00904 **
## tillageno_till 0.06667 0.07262 56.00000 0.918 0.36254
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## tillagn_tll -0.253
# Extract fixed effects
fixef(model_tn_till)
## (Intercept) tillageno_till
## 1.21433333 0.06666667
# Extract random effects (conditional modes)
ranef(model_tn_till)
## $year
## (Intercept)
## 2021 0.03803796
## 2022 -0.24049308
## 2023 0.20245511
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_till) # residuals vs fitted
qqnorm(resid(model_tn_till)); qqline(resid(model_tn_till)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with tillage as a factor for pairwise comparisons
till_nocntrl$tillage_f <- factor(till_nocntrl$tillage)
lmer_model_tn_till_factor <- lmer(n_gkg ~ tillage_f + (1 | year), data = till_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ tillage_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `tillage_f` factor.
emmeans_tn_till_result <- emmeans(lmer_model_tn_till_factor, pairwise ~ tillage_f, adjust = "tukey")
# View the results
emmeans_tn_till_result
## $emmeans
## tillage_f emmean SE df lower.CL upper.CL
## min_till 1.21 0.143 2.28 0.665 1.76
## no_till 1.28 0.143 2.28 0.732 1.83
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## min_till - no_till -0.0667 0.0726 56 -0.918 0.3625
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_till <- mixed(
n_gkg ~ tillage_f + (1 | year),
data = till_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: tillage_f
# Nice ANOVA table
print(nice(anova_kr_tn_till), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ tillage_f + (1 | year)
## Data: till_nocntrl
## Effect df F p.value
## 1 tillage_f 1, 56 0.84 .363
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_tn_till <- anova_kr_tn_till$Anova
car_table_tn_till # prints a car::Anova-like table with F-tests and KR dfs
## NULL
n_gkg.emm.s.till <- emmeans(model_tn_till, "tillage")
pairs(n_gkg.emm.s.till, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## min_till - no_till -0.0667 0.0726 56 -0.918 0.3625
##
## Degrees-of-freedom method: kenward-roger
cld(n_gkg.emm.s.till, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## tillage emmean SE df lower.CL upper.CL .group
## min_till 1.21 0.143 2.28 0.455 1.97 a
## no_till 1.28 0.143 2.28 0.522 2.04 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
The interaction between agroforestry tree type and tillage was found to be NOT significant (p = 0.84) using a linear mixed-effects model with total N as the response variable, agro_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tn_agtil <- lmer(n_gkg ~ agro_type*tillage + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_tn_agtil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ agro_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 15
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3646 -0.5593 -0.0344 0.5835 1.8922
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05494 0.2344
## Residual 0.05674 0.2382
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.34261 0.14651 2.48335 9.164 0.005634 **
## agro_typepine -0.32069 0.08877 54.00000 -3.613 0.000666 ***
## tillageno_till 0.05628 0.07940 54.00000 0.709 0.481507
## agro_typepine:tillageno_till 0.02597 0.12554 54.00000 0.207 0.836882
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) agr_ty tllgn_
## agro_typepn -0.242
## tillagn_tll -0.271 0.447
## agr_typpn:_ 0.171 -0.707 -0.632
# Extract fixed effects
fixef(model_tn_agtil)
## (Intercept) agro_typepine
## 1.34261111 -0.32069444
## tillageno_till agro_typepine:tillageno_till
## 0.05627778 0.02597222
# Extract random effects (conditional modes)
ranef(model_tn_agtil)
## $year
## (Intercept)
## 2021 0.03882827
## 2022 -0.24548977
## 2023 0.20666150
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_agtil) # residuals vs fitted
qqnorm(resid(model_tn_agtil)); qqline(resid(model_tn_agtil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_tn_agtil_factor <- lmer(n_gkg ~ agro_type_f*tillage_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_tn_agtil_result <- emmeans(lmer_model_tn_agtil_factor, pairwise ~ agro_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_tn_agtil_result
## $emmeans
## agro_type_f tillage_f emmean SE df lower.CL upper.CL
## pecan min_till 1.34 0.147 2.48 0.816 1.87
## pine min_till 1.02 0.152 2.86 0.525 1.52
## pecan no_till 1.40 0.147 2.48 0.873 1.93
## pine no_till 1.10 0.152 2.86 0.607 1.60
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan min_till - pine min_till 0.3207 0.0888 54 3.613 0.0036
## pecan min_till - pecan no_till -0.0563 0.0794 54 -0.709 0.8932
## pecan min_till - pine no_till 0.2384 0.0888 54 2.686 0.0459
## pine min_till - pecan no_till -0.3770 0.0888 54 -4.247 0.0005
## pine min_till - pine no_till -0.0823 0.0972 54 -0.846 0.8323
## pecan no_till - pine no_till 0.2947 0.0888 54 3.320 0.0085
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_agtil <- mixed(
n_gkg ~ agro_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f, tillage
# Nice ANOVA table
print(nice(anova_kr_tn_agtil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ agro_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 54 24.03 *** <.001
## 2 tillage 1, 54 1.22 .275
## 3 agro_type_f:tillage 1, 54 0.04 .837
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
The interaction between cover crop type and tillage was found to be NOT significant (0.26) using a linear mixed-effects model with total N as the response variable, cc_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_tn_cctil <- lmer(n_gkg ~ cc_type*tillage + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_tn_cctil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: n_gkg ~ cc_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 14.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.53444 -0.54713 0.00835 0.58283 1.54157
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.05571 0.2360
## Residual 0.04130 0.2032
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 1.15900 0.17982 5.50479 6.445
## cc_typeoat-clover 0.12867 0.16593 38.00000 0.775
## cc_typeoat-vetch 0.55433 0.16593 38.00000 3.341
## cc_typeradish -0.16800 0.16593 38.00000 -1.013
## cc_typeradish-oat -0.28133 0.16593 38.00000 -1.696
## cc_typeradish-rye -0.03333 0.16593 38.00000 -0.201
## cc_typeradish-vetch -0.06567 0.16593 38.00000 -0.396
## cc_typerye 0.17000 0.16593 38.00000 1.025
## cc_typerye-clover 0.35200 0.16593 38.00000 2.121
## cc_typerye-vetch -0.10333 0.16593 38.00000 -0.623
## tillageno_till 0.10667 0.16593 38.00000 0.643
## cc_typeoat-clover:tillageno_till -0.05667 0.23465 38.00000 -0.241
## cc_typeoat-vetch:tillageno_till -0.35233 0.23465 38.00000 -1.501
## cc_typeradish:tillageno_till -0.24200 0.23465 38.00000 -1.031
## cc_typeradish-oat:tillageno_till 0.09900 0.23465 38.00000 0.422
## cc_typeradish-rye:tillageno_till 0.01767 0.23465 38.00000 0.075
## cc_typeradish-vetch:tillageno_till 0.02767 0.23465 38.00000 0.118
## cc_typerye:tillageno_till -0.16667 0.23465 38.00000 -0.710
## cc_typerye-clover:tillageno_till -0.06767 0.23465 38.00000 -0.288
## cc_typerye-vetch:tillageno_till 0.34100 0.23465 38.00000 1.453
## Pr(>|t|)
## (Intercept) 0.000927 ***
## cc_typeoat-clover 0.442875
## cc_typeoat-vetch 0.001883 **
## cc_typeradish 0.317702
## cc_typeradish-oat 0.098154 .
## cc_typeradish-rye 0.841854
## cc_typeradish-vetch 0.694496
## cc_typerye 0.312052
## cc_typerye-clover 0.040466 *
## cc_typerye-vetch 0.537156
## tillageno_till 0.524177
## cc_typeoat-clover:tillageno_till 0.810474
## cc_typeoat-vetch:tillageno_till 0.141491
## cc_typeradish:tillageno_till 0.308918
## cc_typeradish-oat:tillageno_till 0.675478
## cc_typeradish-rye:tillageno_till 0.940381
## cc_typeradish-vetch:tillageno_till 0.906765
## cc_typerye:tillageno_till 0.481877
## cc_typerye-clover:tillageno_till 0.774633
## cc_typerye-vetch:tillageno_till 0.154377
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
# Extract fixed effects
fixef(model_tn_cctil)
## (Intercept) cc_typeoat-clover
## 1.15900000 0.12866667
## cc_typeoat-vetch cc_typeradish
## 0.55433333 -0.16800000
## cc_typeradish-oat cc_typeradish-rye
## -0.28133333 -0.03333333
## cc_typeradish-vetch cc_typerye
## -0.06566667 0.17000000
## cc_typerye-clover cc_typerye-vetch
## 0.35200000 -0.10333333
## tillageno_till cc_typeoat-clover:tillageno_till
## 0.10666667 -0.05666667
## cc_typeoat-vetch:tillageno_till cc_typeradish:tillageno_till
## -0.35233333 -0.24200000
## cc_typeradish-oat:tillageno_till cc_typeradish-rye:tillageno_till
## 0.09900000 0.01766667
## cc_typeradish-vetch:tillageno_till cc_typerye:tillageno_till
## 0.02766667 -0.16666667
## cc_typerye-clover:tillageno_till cc_typerye-vetch:tillageno_till
## -0.06766667 0.34100000
# Extract random effects (conditional modes)
ranef(model_tn_cctil)
## $year
## (Intercept)
## 2021 0.03937398
## 2022 -0.24894000
## 2023 0.20956602
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_tn_cctil) # residuals vs fitted
qqnorm(resid(model_tn_cctil)); qqline(resid(model_tn_cctil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$cc_type_f <- factor(ag_nocntrl$cc_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_tn_cctil_factor <- lmer(n_gkg ~ cc_type_f*tillage_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_tn_cctil_result <- emmeans(lmer_model_tn_cctil_factor, pairwise ~ cc_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_tn_cctil_result
## $emmeans
## cc_type_f tillage_f emmean SE df lower.CL upper.CL
## oat min_till 1.159 0.18 5.5 0.709 1.61
## oat-clover min_till 1.288 0.18 5.5 0.838 1.74
## oat-vetch min_till 1.713 0.18 5.5 1.264 2.16
## radish min_till 0.991 0.18 5.5 0.541 1.44
## radish-oat min_till 0.878 0.18 5.5 0.428 1.33
## radish-rye min_till 1.126 0.18 5.5 0.676 1.58
## radish-vetch min_till 1.093 0.18 5.5 0.644 1.54
## rye min_till 1.329 0.18 5.5 0.879 1.78
## rye-clover min_till 1.511 0.18 5.5 1.061 1.96
## rye-vetch min_till 1.056 0.18 5.5 0.606 1.51
## oat no_till 1.266 0.18 5.5 0.816 1.72
## oat-clover no_till 1.338 0.18 5.5 0.888 1.79
## oat-vetch no_till 1.468 0.18 5.5 1.018 1.92
## radish no_till 0.856 0.18 5.5 0.406 1.31
## radish-oat no_till 1.083 0.18 5.5 0.634 1.53
## radish-rye no_till 1.250 0.18 5.5 0.800 1.70
## radish-vetch no_till 1.228 0.18 5.5 0.778 1.68
## rye no_till 1.269 0.18 5.5 0.819 1.72
## rye-clover no_till 1.550 0.18 5.5 1.100 2.00
## rye-vetch no_till 1.503 0.18 5.5 1.054 1.95
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## oat min_till - (oat-clover min_till) -0.12867 0.166 38 -0.775
## oat min_till - (oat-vetch min_till) -0.55433 0.166 38 -3.341
## oat min_till - radish min_till 0.16800 0.166 38 1.013
## oat min_till - (radish-oat min_till) 0.28133 0.166 38 1.696
## oat min_till - (radish-rye min_till) 0.03333 0.166 38 0.201
## oat min_till - (radish-vetch min_till) 0.06567 0.166 38 0.396
## oat min_till - rye min_till -0.17000 0.166 38 -1.025
## oat min_till - (rye-clover min_till) -0.35200 0.166 38 -2.121
## oat min_till - (rye-vetch min_till) 0.10333 0.166 38 0.623
## oat min_till - oat no_till -0.10667 0.166 38 -0.643
## oat min_till - (oat-clover no_till) -0.17867 0.166 38 -1.077
## oat min_till - (oat-vetch no_till) -0.30867 0.166 38 -1.860
## oat min_till - radish no_till 0.30333 0.166 38 1.828
## oat min_till - (radish-oat no_till) 0.07567 0.166 38 0.456
## oat min_till - (radish-rye no_till) -0.09100 0.166 38 -0.548
## oat min_till - (radish-vetch no_till) -0.06867 0.166 38 -0.414
## oat min_till - rye no_till -0.11000 0.166 38 -0.663
## oat min_till - (rye-clover no_till) -0.39100 0.166 38 -2.356
## oat min_till - (rye-vetch no_till) -0.34433 0.166 38 -2.075
## (oat-clover min_till) - (oat-vetch min_till) -0.42567 0.166 38 -2.565
## (oat-clover min_till) - radish min_till 0.29667 0.166 38 1.788
## (oat-clover min_till) - (radish-oat min_till) 0.41000 0.166 38 2.471
## (oat-clover min_till) - (radish-rye min_till) 0.16200 0.166 38 0.976
## (oat-clover min_till) - (radish-vetch min_till) 0.19433 0.166 38 1.171
## (oat-clover min_till) - rye min_till -0.04133 0.166 38 -0.249
## (oat-clover min_till) - (rye-clover min_till) -0.22333 0.166 38 -1.346
## (oat-clover min_till) - (rye-vetch min_till) 0.23200 0.166 38 1.398
## (oat-clover min_till) - oat no_till 0.02200 0.166 38 0.133
## (oat-clover min_till) - (oat-clover no_till) -0.05000 0.166 38 -0.301
## (oat-clover min_till) - (oat-vetch no_till) -0.18000 0.166 38 -1.085
## (oat-clover min_till) - radish no_till 0.43200 0.166 38 2.604
## (oat-clover min_till) - (radish-oat no_till) 0.20433 0.166 38 1.231
## (oat-clover min_till) - (radish-rye no_till) 0.03767 0.166 38 0.227
## (oat-clover min_till) - (radish-vetch no_till) 0.06000 0.166 38 0.362
## (oat-clover min_till) - rye no_till 0.01867 0.166 38 0.112
## (oat-clover min_till) - (rye-clover no_till) -0.26233 0.166 38 -1.581
## (oat-clover min_till) - (rye-vetch no_till) -0.21567 0.166 38 -1.300
## (oat-vetch min_till) - radish min_till 0.72233 0.166 38 4.353
## (oat-vetch min_till) - (radish-oat min_till) 0.83567 0.166 38 5.036
## (oat-vetch min_till) - (radish-rye min_till) 0.58767 0.166 38 3.542
## (oat-vetch min_till) - (radish-vetch min_till) 0.62000 0.166 38 3.737
## (oat-vetch min_till) - rye min_till 0.38433 0.166 38 2.316
## (oat-vetch min_till) - (rye-clover min_till) 0.20233 0.166 38 1.219
## (oat-vetch min_till) - (rye-vetch min_till) 0.65767 0.166 38 3.964
## (oat-vetch min_till) - oat no_till 0.44767 0.166 38 2.698
## (oat-vetch min_till) - (oat-clover no_till) 0.37567 0.166 38 2.264
## (oat-vetch min_till) - (oat-vetch no_till) 0.24567 0.166 38 1.481
## (oat-vetch min_till) - radish no_till 0.85767 0.166 38 5.169
## (oat-vetch min_till) - (radish-oat no_till) 0.63000 0.166 38 3.797
## (oat-vetch min_till) - (radish-rye no_till) 0.46333 0.166 38 2.792
## (oat-vetch min_till) - (radish-vetch no_till) 0.48567 0.166 38 2.927
## (oat-vetch min_till) - rye no_till 0.44433 0.166 38 2.678
## (oat-vetch min_till) - (rye-clover no_till) 0.16333 0.166 38 0.984
## (oat-vetch min_till) - (rye-vetch no_till) 0.21000 0.166 38 1.266
## radish min_till - (radish-oat min_till) 0.11333 0.166 38 0.683
## radish min_till - (radish-rye min_till) -0.13467 0.166 38 -0.812
## radish min_till - (radish-vetch min_till) -0.10233 0.166 38 -0.617
## radish min_till - rye min_till -0.33800 0.166 38 -2.037
## radish min_till - (rye-clover min_till) -0.52000 0.166 38 -3.134
## radish min_till - (rye-vetch min_till) -0.06467 0.166 38 -0.390
## radish min_till - oat no_till -0.27467 0.166 38 -1.655
## radish min_till - (oat-clover no_till) -0.34667 0.166 38 -2.089
## radish min_till - (oat-vetch no_till) -0.47667 0.166 38 -2.873
## radish min_till - radish no_till 0.13533 0.166 38 0.816
## radish min_till - (radish-oat no_till) -0.09233 0.166 38 -0.556
## radish min_till - (radish-rye no_till) -0.25900 0.166 38 -1.561
## radish min_till - (radish-vetch no_till) -0.23667 0.166 38 -1.426
## radish min_till - rye no_till -0.27800 0.166 38 -1.675
## radish min_till - (rye-clover no_till) -0.55900 0.166 38 -3.369
## radish min_till - (rye-vetch no_till) -0.51233 0.166 38 -3.088
## (radish-oat min_till) - (radish-rye min_till) -0.24800 0.166 38 -1.495
## (radish-oat min_till) - (radish-vetch min_till) -0.21567 0.166 38 -1.300
## (radish-oat min_till) - rye min_till -0.45133 0.166 38 -2.720
## (radish-oat min_till) - (rye-clover min_till) -0.63333 0.166 38 -3.817
## (radish-oat min_till) - (rye-vetch min_till) -0.17800 0.166 38 -1.073
## (radish-oat min_till) - oat no_till -0.38800 0.166 38 -2.338
## (radish-oat min_till) - (oat-clover no_till) -0.46000 0.166 38 -2.772
## (radish-oat min_till) - (oat-vetch no_till) -0.59000 0.166 38 -3.556
## (radish-oat min_till) - radish no_till 0.02200 0.166 38 0.133
## (radish-oat min_till) - (radish-oat no_till) -0.20567 0.166 38 -1.240
## (radish-oat min_till) - (radish-rye no_till) -0.37233 0.166 38 -2.244
## (radish-oat min_till) - (radish-vetch no_till) -0.35000 0.166 38 -2.109
## (radish-oat min_till) - rye no_till -0.39133 0.166 38 -2.358
## (radish-oat min_till) - (rye-clover no_till) -0.67233 0.166 38 -4.052
## (radish-oat min_till) - (rye-vetch no_till) -0.62567 0.166 38 -3.771
## (radish-rye min_till) - (radish-vetch min_till) 0.03233 0.166 38 0.195
## (radish-rye min_till) - rye min_till -0.20333 0.166 38 -1.225
## (radish-rye min_till) - (rye-clover min_till) -0.38533 0.166 38 -2.322
## (radish-rye min_till) - (rye-vetch min_till) 0.07000 0.166 38 0.422
## (radish-rye min_till) - oat no_till -0.14000 0.166 38 -0.844
## (radish-rye min_till) - (oat-clover no_till) -0.21200 0.166 38 -1.278
## (radish-rye min_till) - (oat-vetch no_till) -0.34200 0.166 38 -2.061
## (radish-rye min_till) - radish no_till 0.27000 0.166 38 1.627
## (radish-rye min_till) - (radish-oat no_till) 0.04233 0.166 38 0.255
## (radish-rye min_till) - (radish-rye no_till) -0.12433 0.166 38 -0.749
## (radish-rye min_till) - (radish-vetch no_till) -0.10200 0.166 38 -0.615
## (radish-rye min_till) - rye no_till -0.14333 0.166 38 -0.864
## (radish-rye min_till) - (rye-clover no_till) -0.42433 0.166 38 -2.557
## (radish-rye min_till) - (rye-vetch no_till) -0.37767 0.166 38 -2.276
## (radish-vetch min_till) - rye min_till -0.23567 0.166 38 -1.420
## (radish-vetch min_till) - (rye-clover min_till) -0.41767 0.166 38 -2.517
## (radish-vetch min_till) - (rye-vetch min_till) 0.03767 0.166 38 0.227
## (radish-vetch min_till) - oat no_till -0.17233 0.166 38 -1.039
## (radish-vetch min_till) - (oat-clover no_till) -0.24433 0.166 38 -1.473
## (radish-vetch min_till) - (oat-vetch no_till) -0.37433 0.166 38 -2.256
## (radish-vetch min_till) - radish no_till 0.23767 0.166 38 1.432
## (radish-vetch min_till) - (radish-oat no_till) 0.01000 0.166 38 0.060
## (radish-vetch min_till) - (radish-rye no_till) -0.15667 0.166 38 -0.944
## (radish-vetch min_till) - (radish-vetch no_till) -0.13433 0.166 38 -0.810
## (radish-vetch min_till) - rye no_till -0.17567 0.166 38 -1.059
## (radish-vetch min_till) - (rye-clover no_till) -0.45667 0.166 38 -2.752
## (radish-vetch min_till) - (rye-vetch no_till) -0.41000 0.166 38 -2.471
## rye min_till - (rye-clover min_till) -0.18200 0.166 38 -1.097
## rye min_till - (rye-vetch min_till) 0.27333 0.166 38 1.647
## rye min_till - oat no_till 0.06333 0.166 38 0.382
## rye min_till - (oat-clover no_till) -0.00867 0.166 38 -0.052
## rye min_till - (oat-vetch no_till) -0.13867 0.166 38 -0.836
## rye min_till - radish no_till 0.47333 0.166 38 2.853
## rye min_till - (radish-oat no_till) 0.24567 0.166 38 1.481
## rye min_till - (radish-rye no_till) 0.07900 0.166 38 0.476
## rye min_till - (radish-vetch no_till) 0.10133 0.166 38 0.611
## rye min_till - rye no_till 0.06000 0.166 38 0.362
## rye min_till - (rye-clover no_till) -0.22100 0.166 38 -1.332
## rye min_till - (rye-vetch no_till) -0.17433 0.166 38 -1.051
## (rye-clover min_till) - (rye-vetch min_till) 0.45533 0.166 38 2.744
## (rye-clover min_till) - oat no_till 0.24533 0.166 38 1.479
## (rye-clover min_till) - (oat-clover no_till) 0.17333 0.166 38 1.045
## (rye-clover min_till) - (oat-vetch no_till) 0.04333 0.166 38 0.261
## (rye-clover min_till) - radish no_till 0.65533 0.166 38 3.950
## (rye-clover min_till) - (radish-oat no_till) 0.42767 0.166 38 2.577
## (rye-clover min_till) - (radish-rye no_till) 0.26100 0.166 38 1.573
## (rye-clover min_till) - (radish-vetch no_till) 0.28333 0.166 38 1.708
## (rye-clover min_till) - rye no_till 0.24200 0.166 38 1.458
## (rye-clover min_till) - (rye-clover no_till) -0.03900 0.166 38 -0.235
## (rye-clover min_till) - (rye-vetch no_till) 0.00767 0.166 38 0.046
## (rye-vetch min_till) - oat no_till -0.21000 0.166 38 -1.266
## (rye-vetch min_till) - (oat-clover no_till) -0.28200 0.166 38 -1.700
## (rye-vetch min_till) - (oat-vetch no_till) -0.41200 0.166 38 -2.483
## (rye-vetch min_till) - radish no_till 0.20000 0.166 38 1.205
## (rye-vetch min_till) - (radish-oat no_till) -0.02767 0.166 38 -0.167
## (rye-vetch min_till) - (radish-rye no_till) -0.19433 0.166 38 -1.171
## (rye-vetch min_till) - (radish-vetch no_till) -0.17200 0.166 38 -1.037
## (rye-vetch min_till) - rye no_till -0.21333 0.166 38 -1.286
## (rye-vetch min_till) - (rye-clover no_till) -0.49433 0.166 38 -2.979
## (rye-vetch min_till) - (rye-vetch no_till) -0.44767 0.166 38 -2.698
## oat no_till - (oat-clover no_till) -0.07200 0.166 38 -0.434
## oat no_till - (oat-vetch no_till) -0.20200 0.166 38 -1.217
## oat no_till - radish no_till 0.41000 0.166 38 2.471
## oat no_till - (radish-oat no_till) 0.18233 0.166 38 1.099
## oat no_till - (radish-rye no_till) 0.01567 0.166 38 0.094
## oat no_till - (radish-vetch no_till) 0.03800 0.166 38 0.229
## oat no_till - rye no_till -0.00333 0.166 38 -0.020
## oat no_till - (rye-clover no_till) -0.28433 0.166 38 -1.714
## oat no_till - (rye-vetch no_till) -0.23767 0.166 38 -1.432
## (oat-clover no_till) - (oat-vetch no_till) -0.13000 0.166 38 -0.783
## (oat-clover no_till) - radish no_till 0.48200 0.166 38 2.905
## (oat-clover no_till) - (radish-oat no_till) 0.25433 0.166 38 1.533
## (oat-clover no_till) - (radish-rye no_till) 0.08767 0.166 38 0.528
## (oat-clover no_till) - (radish-vetch no_till) 0.11000 0.166 38 0.663
## (oat-clover no_till) - rye no_till 0.06867 0.166 38 0.414
## (oat-clover no_till) - (rye-clover no_till) -0.21233 0.166 38 -1.280
## (oat-clover no_till) - (rye-vetch no_till) -0.16567 0.166 38 -0.998
## (oat-vetch no_till) - radish no_till 0.61200 0.166 38 3.688
## (oat-vetch no_till) - (radish-oat no_till) 0.38433 0.166 38 2.316
## (oat-vetch no_till) - (radish-rye no_till) 0.21767 0.166 38 1.312
## (oat-vetch no_till) - (radish-vetch no_till) 0.24000 0.166 38 1.446
## (oat-vetch no_till) - rye no_till 0.19867 0.166 38 1.197
## (oat-vetch no_till) - (rye-clover no_till) -0.08233 0.166 38 -0.496
## (oat-vetch no_till) - (rye-vetch no_till) -0.03567 0.166 38 -0.215
## radish no_till - (radish-oat no_till) -0.22767 0.166 38 -1.372
## radish no_till - (radish-rye no_till) -0.39433 0.166 38 -2.377
## radish no_till - (radish-vetch no_till) -0.37200 0.166 38 -2.242
## radish no_till - rye no_till -0.41333 0.166 38 -2.491
## radish no_till - (rye-clover no_till) -0.69433 0.166 38 -4.185
## radish no_till - (rye-vetch no_till) -0.64767 0.166 38 -3.903
## (radish-oat no_till) - (radish-rye no_till) -0.16667 0.166 38 -1.004
## (radish-oat no_till) - (radish-vetch no_till) -0.14433 0.166 38 -0.870
## (radish-oat no_till) - rye no_till -0.18567 0.166 38 -1.119
## (radish-oat no_till) - (rye-clover no_till) -0.46667 0.166 38 -2.813
## (radish-oat no_till) - (rye-vetch no_till) -0.42000 0.166 38 -2.531
## (radish-rye no_till) - (radish-vetch no_till) 0.02233 0.166 38 0.135
## (radish-rye no_till) - rye no_till -0.01900 0.166 38 -0.115
## (radish-rye no_till) - (rye-clover no_till) -0.30000 0.166 38 -1.808
## (radish-rye no_till) - (rye-vetch no_till) -0.25333 0.166 38 -1.527
## (radish-vetch no_till) - rye no_till -0.04133 0.166 38 -0.249
## (radish-vetch no_till) - (rye-clover no_till) -0.32233 0.166 38 -1.943
## (radish-vetch no_till) - (rye-vetch no_till) -0.27567 0.166 38 -1.661
## rye no_till - (rye-clover no_till) -0.28100 0.166 38 -1.694
## rye no_till - (rye-vetch no_till) -0.23433 0.166 38 -1.412
## (rye-clover no_till) - (rye-vetch no_till) 0.04667 0.166 38 0.281
## p.value
## 1.0000
## 0.1447
## 0.9999
## 0.9697
## 1.0000
## 1.0000
## 0.9999
## 0.8261
## 1.0000
## 1.0000
## 0.9999
## 0.9323
## 0.9413
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.6868
## 0.8491
## 0.5463
## 0.9513
## 0.6104
## 1.0000
## 0.9996
## 1.0000
## 0.9974
## 0.9959
## 1.0000
## 1.0000
## 0.9998
## 0.5205
## 0.9991
## 1.0000
## 1.0000
## 1.0000
## 0.9846
## 0.9983
## 0.0118
## 0.0017
## 0.0928
## 0.0586
## 0.7127
## 0.9992
## 0.0332
## 0.4580
## 0.7453
## 0.9923
## 0.0011
## 0.0506
## 0.3983
## 0.3203
## 0.4711
## 1.0000
## 0.9988
## 1.0000
## 1.0000
## 1.0000
## 0.8668
## 0.2201
## 1.0000
## 0.9758
## 0.8423
## 0.3507
## 1.0000
## 1.0000
## 0.9865
## 0.9949
## 0.9729
## 0.1362
## 0.2403
## 0.9914
## 0.9983
## 0.4437
## 0.0481
## 0.9999
## 0.6985
## 0.4107
## 0.0899
## 1.0000
## 0.9991
## 0.7575
## 0.8323
## 0.6855
## 0.0264
## 0.0539
## 1.0000
## 0.9992
## 0.7089
## 1.0000
## 1.0000
## 0.9986
## 0.8558
## 0.9795
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.5517
## 0.7379
## 0.9951
## 0.5790
## 1.0000
## 0.9999
## 0.9927
## 0.7502
## 0.9946
## 1.0000
## 1.0000
## 1.0000
## 0.9999
## 0.4233
## 0.6104
## 0.9998
## 0.9769
## 1.0000
## 1.0000
## 1.0000
## 0.3623
## 0.9923
## 1.0000
## 1.0000
## 1.0000
## 0.9977
## 0.9999
## 0.4284
## 0.9924
## 0.9999
## 1.0000
## 0.0344
## 0.5381
## 0.9854
## 0.9676
## 0.9934
## 1.0000
## 1.0000
## 0.9988
## 0.9690
## 0.6022
## 0.9993
## 1.0000
## 0.9996
## 0.9999
## 0.9985
## 0.2927
## 0.4580
## 1.0000
## 0.9993
## 0.6104
## 0.9998
## 1.0000
## 1.0000
## 1.0000
## 0.9666
## 0.9946
## 1.0000
## 0.3325
## 0.9888
## 1.0000
## 1.0000
## 1.0000
## 0.9986
## 1.0000
## 0.0658
## 0.7127
## 0.9981
## 0.9940
## 0.9994
## 1.0000
## 1.0000
## 0.9967
## 0.6736
## 0.7587
## 0.5968
## 0.0186
## 0.0387
## 0.9999
## 1.0000
## 0.9998
## 0.3861
## 0.5695
## 1.0000
## 1.0000
## 0.9465
## 0.9893
## 1.0000
## 0.9052
## 0.9749
## 0.9700
## 0.9954
## 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 20 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_tn_cctil <- mixed(
n_gkg ~ cc_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f, tillage
# Nice ANOVA table
print(nice(anova_kr_tn_cctil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: n_gkg ~ cc_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 38 6.37 *** <.001
## 2 tillage 1, 38 1.61 .212
## 3 cc_type_f:tillage 9, 38 1.33 .255
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
Agroforestry treatment was found to be NOT significant (p = 0.27) using a linear mixed-effects model with respiration as the response variable, agro_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_cmin_ag_treats2 <- lmer(Resp_mg_CO2_g_dry_weight ~ agro_treatment + (1 | year), data = ag_treats2)
# Summarize the model results
summary(model_cmin_ag_treats2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ agro_treatment + (1 | year)
## Data: ag_treats2
##
## REML criterion at convergence: 206.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1169 -0.6794 -0.1160 0.6106 3.0884
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4597 0.678
## Residual 1.5815 1.258
## Number of obs: 62, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.4738 0.4238 2.0030 8.197 0.0145 *
## agro_treatmentno_agroforestry -1.0197 0.9101 58.2520 -1.120 0.2672
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agr_trtmnt_ -0.068
# Extract fixed effects
fixef(model_cmin_ag_treats2)
## (Intercept) agro_treatmentno_agroforestry
## 3.473833 -1.019663
# Extract random effects (conditional modes)
ranef(model_cmin_ag_treats2)
## $year
## (Intercept)
## 2021 -0.6846595
## 2022 0.1373205
## 2023 0.5473390
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_ag_treats2) # residuals vs fitted
qqnorm(resid(model_cmin_ag_treats2)); qqline(resid(model_cmin_ag_treats2)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_treatment as a factor for pairwise comparisons
ag_treats2$agro_treatment_f <- factor(ag_treats2$agro_treatment)
lmer_model_cmin_ag_treats2_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ agro_treatment_f + (1 | year), data = ag_treats2)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_cmin_ag_treats2_result <- emmeans(lmer_model_cmin_ag_treats2_factor, pairwise ~ agro_treatment_f, adjust = "tukey")
# View the results
emmeans_cmin_ag_treats2_result
## $emmeans
## agro_treatment_f emmean SE df lower.CL upper.CL
## agroforestry 3.47 0.424 2.01 1.663 5.28
## no_agroforestry 2.45 0.979 34.18 0.464 4.44
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 1.02 0.912 58.3 1.118 0.2683
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_ag_treats2 <- mixed(
Resp_mg_CO2_g_dry_weight ~ agro_treatment_f + (1 | year),
data = ag_treats2,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_treatment_f
# Nice ANOVA table
print(nice(anova_kr_cmin_ag_treats2), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ agro_treatment_f + (1 | year)
## Data: ag_treats2
## Effect df F p.value
## 1 agro_treatment_f 1, 58.26 1.25 .268
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_ag_treats2 <- anova_kr_cmin_ag_treats2$Anova
car_table_cmin_ag_treats2 # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.ag_treats2 <- emmeans(model_cmin_ag_treats2, "agro_treatment")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 1.02 0.912 58.3 1.118 0.2683
##
## Degrees-of-freedom method: kenward-roger
cld(Resp_mg_CO2_g_dry_weight.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_treatment emmean SE df lower.CL upper.CL .group
## no_agroforestry 2.45 0.979 34.18 0.163 4.74 a
## agroforestry 3.47 0.424 2.01 0.884 6.06 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Agroforestry tree type was found to be significant (p < 0.001) using a linear mixed-effects model with respiration as the response variable, agro_type as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_cmin_ag <- lmer(Resp_mg_CO2_g_dry_weight ~ agro_type + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_cmin_ag)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ agro_type + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 187.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.76948 -0.58116 -0.05979 0.56371 3.05863
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4834 0.6952
## Residual 1.2163 1.1029
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.9852 0.4415 2.3086 9.027 0.00754 **
## agro_typepine -1.2785 0.2906 56.0000 -4.399 4.92e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agro_typepn -0.263
# Extract fixed effects
fixef(model_cmin_ag)
## (Intercept) agro_typepine
## 3.985250 -1.278542
# Extract random effects (conditional modes)
ranef(model_cmin_ag)
## $year
## (Intercept)
## 2021 -0.7127591
## 2022 0.1365384
## 2023 0.5762207
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_ag) # residuals vs fitted
qqnorm(resid(model_cmin_ag)); qqline(resid(model_cmin_ag)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
lmer_model_cmin_ag_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ agro_type_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_cmin_ag_result <- emmeans(lmer_model_cmin_ag_factor, pairwise ~ agro_type_f, adjust = "tukey")
# View the results
emmeans_cmin_ag_result
## $emmeans
## agro_type_f emmean SE df lower.CL upper.CL
## pecan 3.99 0.441 2.31 2.31 5.66
## pine 2.71 0.460 2.72 1.15 4.26
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan - pine 1.28 0.291 56 4.399 <.0001
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_ag <- mixed(
Resp_mg_CO2_g_dry_weight ~ agro_type_f + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f
# Nice ANOVA table
print(nice(anova_kr_cmin_ag), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ agro_type_f + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 56 19.35 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_ag <- anova_kr_cmin_ag$Anova
car_table_cmin_ag # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.ag <- emmeans(model_cmin_ag, "agro_type")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.ag, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## pecan - pine 1.28 0.291 56 4.399 <.0001
##
## Degrees-of-freedom method: kenward-roger
cld(Resp_mg_CO2_g_dry_weight.emm.s.ag, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_type emmean SE df lower.CL upper.CL .group
## pine 2.71 0.460 2.72 0.643 4.77 a
## pecan 3.99 0.441 2.31 1.675 6.30 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop treatment was found to be NOT significant (p = 0.31) using a linear mixed-effects model with respiration as the response variable, cc_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_cmin_cc_treats <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_treatment + (1 | year), data = dat)
# Summarize the model results
summary(model_cmin_cc_treats)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ cc_treatment + (1 | year)
## Data: dat
##
## REML criterion at convergence: 212.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1276 -0.6711 -0.1313 0.6429 3.1407
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4714 0.6866
## Residual 1.5439 1.2425
## Number of obs: 64, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.4738 0.4276 2.0064 8.124 0.0147 *
## cc_treatmentno_cc -0.6726 0.6502 60.4658 -1.034 0.3050
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## cc_trtmntn_ -0.093
# Extract fixed effects
fixef(model_cmin_cc_treats)
## (Intercept) cc_treatmentno_cc
## 3.4738333 -0.6725912
# Extract random effects (conditional modes)
ranef(model_cmin_cc_treats)
## $year
## (Intercept)
## 2021 -0.6895158
## 2022 0.1187267
## 2023 0.5707891
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_cc_treats) # residuals vs fitted
qqnorm(resid(model_cmin_cc_treats)); qqline(resid(model_cmin_cc_treats)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_treatment as a factor for pairwise comparisons
dat$cc_treatment_f <- factor(dat$cc_treatment)
lmer_model_cmin_cc_treats_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_treatment_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_cmin_cc_treats_result <- emmeans(lmer_model_cmin_cc_treats_factor, pairwise ~ cc_treatment_f, adjust = "tukey")
# View the results
emmeans_cmin_cc_treats_result
## $emmeans
## cc_treatment_f emmean SE df lower.CL upper.CL
## covercrop 3.47 0.428 2.03 1.66 5.29
## no_cc 2.80 0.747 16.06 1.22 4.38
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc 0.673 0.653 60.5 1.030 0.3071
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_cc_treats <- mixed(
Resp_mg_CO2_g_dry_weight ~ cc_treatment_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_treatment_f
# Nice ANOVA table
print(nice(anova_kr_cmin_cc_treats), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ cc_treatment_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_treatment_f 1, 60.48 1.06 .307
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_cc_treats <- anova_kr_cmin_cc_treats$Anova
car_table_cmin_cc_treats # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.cc_treats <- emmeans(model_cmin_cc_treats, "cc_treatment")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc 0.673 0.653 60.5 1.030 0.3071
##
## Degrees-of-freedom method: kenward-roger
cld(Resp_mg_CO2_g_dry_weight.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_treatment emmean SE df lower.CL upper.CL .group
## no_cc 2.80 0.747 16.06 0.96 4.64 a
## covercrop 3.47 0.428 2.03 0.88 6.07 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop class (mix, mono, control) was found to be NOT significant (p = 0.24) using a linear mixed-effects model with respiration as the response variable, cc_class as the fixed effect, and (1 / year) as the random intercept.
model_cmin_cc_c <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_class + (1 | year), data = dat)
# Summarize the model results
summary(model_cmin_cc_c)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ cc_class + (1 | year)
## Data: dat
##
## REML criterion at convergence: 210.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2581 -0.5919 -0.1950 0.7193 3.0477
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4725 0.6874
## Residual 1.5221 1.2338
## Number of obs: 64, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.6159 0.4402 2.2517 8.215 0.0101 *
## cc_classmono -0.4735 0.3476 58.9807 -1.362 0.1783
## cc_classnone -0.8154 0.6540 59.4408 -1.247 0.2173
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_clssm
## cc_classmon -0.237
## cc_classnon -0.126 0.159
# Extract fixed effects
fixef(model_cmin_cc_c)
## (Intercept) cc_classmono cc_classnone
## 3.6158810 -0.4734921 -0.8154357
# Extract random effects (conditional modes)
ranef(model_cmin_cc_c)
## $year
## (Intercept)
## 2021 -0.6911094
## 2022 0.1190425
## 2023 0.5720669
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_cc_c) # residuals vs fitted
qqnorm(resid(model_cmin_cc_c)); qqline(resid(model_cmin_cc_c)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_class as a factor for pairwise comparisons
dat$cc_class_f <- factor(dat$cc_class)
lmer_model_cmin_cc_c_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_class_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_class_f` factor.
emmeans_cmin_cc_c_result <- emmeans(lmer_model_cmin_cc_c_factor, pairwise ~ cc_class_f, adjust = "tukey")
# View the results
emmeans_cmin_cc_c_result
## $emmeans
## cc_class_f emmean SE df lower.CL upper.CL
## mixed 3.62 0.440 2.27 1.92 5.31
## mono 3.14 0.492 3.54 1.70 4.58
## none 2.80 0.743 15.79 1.22 4.38
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## mixed - mono 0.473 0.348 59.0 1.362 0.3671
## mixed - none 0.815 0.657 59.5 1.242 0.4337
## mono - none 0.342 0.693 59.4 0.494 0.8746
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_cc_c <- mixed(
Resp_mg_CO2_g_dry_weight ~ cc_class_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_class_f
# Nice ANOVA table
print(nice(anova_kr_cmin_cc_c), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ cc_class_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_class_f 2, 59.24 1.47 .239
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_cc_c <- anova_kr_cmin_cc_c$Anova
car_table_cmin_cc_c # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.cc_c <- emmeans(model_cmin_cc_c, "cc_class")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.cc_c, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## mixed - mono 0.473 0.348 59.0 1.362 0.3671
## mixed - none 0.815 0.657 59.5 1.242 0.4337
## mono - none 0.342 0.693 59.4 0.494 0.8746
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
cld(Resp_mg_CO2_g_dry_weight.emm.s.cc_c, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_class emmean SE df lower.CL upper.CL .group
## none 2.80 0.743 15.79 0.817 4.78 a
## mono 3.14 0.492 3.54 1.047 5.24 a
## mixed 3.62 0.440 2.27 0.799 6.43 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 3 estimates
## P value adjustment: tukey method for comparing a family of 3 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Cover crop type was found to be significant (p = 0.002) using a linear mixed-effects model with respiration as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_cmin_cc <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type + (1 | year), data = cc_nocntrl)
# Summarize the model results
summary(model_cmin_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ cc_type + (1 | year)
## Data: cc_nocntrl
##
## REML criterion at convergence: 171.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.80815 -0.65168 -0.02163 0.40201 2.72058
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4865 0.6975
## Residual 1.1544 1.0744
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.6888 0.5954 7.3616 6.195 0.000366 ***
## cc_typeoat-clover 0.2565 0.6203 48.0000 0.413 0.681088
## cc_typeoat-vetch 0.9122 0.6203 48.0000 1.470 0.147962
## cc_typeradish -0.8737 0.6203 48.0000 -1.408 0.165458
## cc_typeradish-oat -1.3608 0.6203 48.0000 -2.194 0.033129 *
## cc_typeradish-rye -0.7595 0.6203 48.0000 -1.224 0.226793
## cc_typeradish-vetch -0.9345 0.6203 48.0000 -1.506 0.138501
## cc_typerye -0.7657 0.6203 48.0000 -1.234 0.223101
## cc_typerye-clover 0.7457 0.6203 48.0000 1.202 0.235239
## cc_typerye-vetch 0.6298 0.6203 48.0000 1.015 0.315041
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typrd cc_typrdsh-t cc_typrdsh-r
## cc_typt-clv -0.521
## cc_typt-vtc -0.521 0.500
## cc_typerdsh -0.521 0.500 0.500
## cc_typrdsh-t -0.521 0.500 0.500 0.500
## cc_typrdsh-r -0.521 0.500 0.500 0.500 0.500
## cc_typrdsh-v -0.521 0.500 0.500 0.500 0.500 0.500
## cc_typerye -0.521 0.500 0.500 0.500 0.500 0.500
## cc_typry-cl -0.521 0.500 0.500 0.500 0.500 0.500
## cc_typry-vt -0.521 0.500 0.500 0.500 0.500 0.500
## cc_typrdsh-v cc_typry cc_typry-c
## cc_typt-clv
## cc_typt-vtc
## cc_typerdsh
## cc_typrdsh-t
## cc_typrdsh-r
## cc_typrdsh-v
## cc_typerye 0.500
## cc_typry-cl 0.500 0.500
## cc_typry-vt 0.500 0.500 0.500
# Extract fixed effects
fixef(model_cmin_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typeradish
## 3.6888333 0.2565000 0.9121667 -0.8736667
## cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch cc_typerye
## -1.3608333 -0.7595000 -0.9345000 -0.7656667
## cc_typerye-clover cc_typerye-vetch
## 0.7456667 0.6298333
# Extract random effects (conditional modes)
ranef(model_cmin_cc)
## $year
## (Intercept)
## 2021 -0.7173201
## 2022 0.1374121
## 2023 0.5799080
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_cc) # residuals vs fitted
qqnorm(resid(model_cmin_cc)); qqline(resid(model_cmin_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
cc_nocntrl$cc_type_f <- factor(cc_nocntrl$cc_type)
lmer_model_cmin_cc_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year), data = cc_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_cmin_cc_result <- emmeans(lmer_model_cmin_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_cmin_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 3.69 0.595 7.36 2.295 5.08
## oat-clover 3.95 0.595 7.36 2.551 5.34
## oat-vetch 4.60 0.595 7.36 3.207 6.00
## radish 2.82 0.595 7.36 1.421 4.21
## radish-oat 2.33 0.595 7.36 0.934 3.72
## radish-rye 2.93 0.595 7.36 1.535 4.32
## radish-vetch 2.75 0.595 7.36 1.360 4.15
## rye 2.92 0.595 7.36 1.529 4.32
## rye-clover 4.43 0.595 7.36 3.040 5.83
## rye-vetch 4.32 0.595 7.36 2.925 5.71
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.25650 0.62 48 -0.413 1.0000
## oat - (oat-vetch) -0.91217 0.62 48 -1.470 0.8970
## oat - radish 0.87367 0.62 48 1.408 0.9186
## oat - (radish-oat) 1.36083 0.62 48 2.194 0.4748
## oat - (radish-rye) 0.75950 0.62 48 1.224 0.9646
## oat - (radish-vetch) 0.93450 0.62 48 1.506 0.8830
## oat - rye 0.76567 0.62 48 1.234 0.9628
## oat - (rye-clover) -0.74567 0.62 48 -1.202 0.9685
## oat - (rye-vetch) -0.62983 0.62 48 -1.015 0.9899
## (oat-clover) - (oat-vetch) -0.65567 0.62 48 -1.057 0.9866
## (oat-clover) - radish 1.13017 0.62 48 1.822 0.7184
## (oat-clover) - (radish-oat) 1.61733 0.62 48 2.607 0.2425
## (oat-clover) - (radish-rye) 1.01600 0.62 48 1.638 0.8229
## (oat-clover) - (radish-vetch) 1.19100 0.62 48 1.920 0.6560
## (oat-clover) - rye 1.02217 0.62 48 1.648 0.8178
## (oat-clover) - (rye-clover) -0.48917 0.62 48 -0.789 0.9984
## (oat-clover) - (rye-vetch) -0.37333 0.62 48 -0.602 0.9998
## (oat-vetch) - radish 1.78583 0.62 48 2.879 0.1401
## (oat-vetch) - (radish-oat) 2.27300 0.62 48 3.664 0.0198
## (oat-vetch) - (radish-rye) 1.67167 0.62 48 2.695 0.2049
## (oat-vetch) - (radish-vetch) 1.84667 0.62 48 2.977 0.1129
## (oat-vetch) - rye 1.67783 0.62 48 2.705 0.2009
## (oat-vetch) - (rye-clover) 0.16650 0.62 48 0.268 1.0000
## (oat-vetch) - (rye-vetch) 0.28233 0.62 48 0.455 1.0000
## radish - (radish-oat) 0.48717 0.62 48 0.785 0.9985
## radish - (radish-rye) -0.11417 0.62 48 -0.184 1.0000
## radish - (radish-vetch) 0.06083 0.62 48 0.098 1.0000
## radish - rye -0.10800 0.62 48 -0.174 1.0000
## radish - (rye-clover) -1.61933 0.62 48 -2.610 0.2410
## radish - (rye-vetch) -1.50350 0.62 48 -2.424 0.3353
## (radish-oat) - (radish-rye) -0.60133 0.62 48 -0.969 0.9927
## (radish-oat) - (radish-vetch) -0.42633 0.62 48 -0.687 0.9995
## (radish-oat) - rye -0.59517 0.62 48 -0.959 0.9932
## (radish-oat) - (rye-clover) -2.10650 0.62 48 -3.396 0.0408
## (radish-oat) - (rye-vetch) -1.99067 0.62 48 -3.209 0.0654
## (radish-rye) - (radish-vetch) 0.17500 0.62 48 0.282 1.0000
## (radish-rye) - rye 0.00617 0.62 48 0.010 1.0000
## (radish-rye) - (rye-clover) -1.50517 0.62 48 -2.426 0.3338
## (radish-rye) - (rye-vetch) -1.38933 0.62 48 -2.240 0.4453
## (radish-vetch) - rye -0.16883 0.62 48 -0.272 1.0000
## (radish-vetch) - (rye-clover) -1.68017 0.62 48 -2.709 0.1994
## (radish-vetch) - (rye-vetch) -1.56433 0.62 48 -2.522 0.2833
## rye - (rye-clover) -1.51133 0.62 48 -2.436 0.3283
## rye - (rye-vetch) -1.39550 0.62 48 -2.250 0.4390
## (rye-clover) - (rye-vetch) 0.11583 0.62 48 0.187 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_cc <- mixed(
Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year),
data = cc_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_cmin_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year)
## Data: cc_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 48 3.49 ** .002
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_cc <- anova_kr_cmin_cc$Anova
car_table_cmin_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.cc <- emmeans(model_cmin_cc, "cc_type")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.cc, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.25650 0.62 48 -0.413 1.0000
## oat - (oat-vetch) -0.91217 0.62 48 -1.470 0.8970
## oat - radish 0.87367 0.62 48 1.408 0.9186
## oat - (radish-oat) 1.36083 0.62 48 2.194 0.4748
## oat - (radish-rye) 0.75950 0.62 48 1.224 0.9646
## oat - (radish-vetch) 0.93450 0.62 48 1.506 0.8830
## oat - rye 0.76567 0.62 48 1.234 0.9628
## oat - (rye-clover) -0.74567 0.62 48 -1.202 0.9685
## oat - (rye-vetch) -0.62983 0.62 48 -1.015 0.9899
## (oat-clover) - (oat-vetch) -0.65567 0.62 48 -1.057 0.9866
## (oat-clover) - radish 1.13017 0.62 48 1.822 0.7184
## (oat-clover) - (radish-oat) 1.61733 0.62 48 2.607 0.2425
## (oat-clover) - (radish-rye) 1.01600 0.62 48 1.638 0.8229
## (oat-clover) - (radish-vetch) 1.19100 0.62 48 1.920 0.6560
## (oat-clover) - rye 1.02217 0.62 48 1.648 0.8178
## (oat-clover) - (rye-clover) -0.48917 0.62 48 -0.789 0.9984
## (oat-clover) - (rye-vetch) -0.37333 0.62 48 -0.602 0.9998
## (oat-vetch) - radish 1.78583 0.62 48 2.879 0.1401
## (oat-vetch) - (radish-oat) 2.27300 0.62 48 3.664 0.0198
## (oat-vetch) - (radish-rye) 1.67167 0.62 48 2.695 0.2049
## (oat-vetch) - (radish-vetch) 1.84667 0.62 48 2.977 0.1129
## (oat-vetch) - rye 1.67783 0.62 48 2.705 0.2009
## (oat-vetch) - (rye-clover) 0.16650 0.62 48 0.268 1.0000
## (oat-vetch) - (rye-vetch) 0.28233 0.62 48 0.455 1.0000
## radish - (radish-oat) 0.48717 0.62 48 0.785 0.9985
## radish - (radish-rye) -0.11417 0.62 48 -0.184 1.0000
## radish - (radish-vetch) 0.06083 0.62 48 0.098 1.0000
## radish - rye -0.10800 0.62 48 -0.174 1.0000
## radish - (rye-clover) -1.61933 0.62 48 -2.610 0.2410
## radish - (rye-vetch) -1.50350 0.62 48 -2.424 0.3353
## (radish-oat) - (radish-rye) -0.60133 0.62 48 -0.969 0.9927
## (radish-oat) - (radish-vetch) -0.42633 0.62 48 -0.687 0.9995
## (radish-oat) - rye -0.59517 0.62 48 -0.959 0.9932
## (radish-oat) - (rye-clover) -2.10650 0.62 48 -3.396 0.0408
## (radish-oat) - (rye-vetch) -1.99067 0.62 48 -3.209 0.0654
## (radish-rye) - (radish-vetch) 0.17500 0.62 48 0.282 1.0000
## (radish-rye) - rye 0.00617 0.62 48 0.010 1.0000
## (radish-rye) - (rye-clover) -1.50517 0.62 48 -2.426 0.3338
## (radish-rye) - (rye-vetch) -1.38933 0.62 48 -2.240 0.4453
## (radish-vetch) - rye -0.16883 0.62 48 -0.272 1.0000
## (radish-vetch) - (rye-clover) -1.68017 0.62 48 -2.709 0.1994
## (radish-vetch) - (rye-vetch) -1.56433 0.62 48 -2.522 0.2833
## rye - (rye-clover) -1.51133 0.62 48 -2.436 0.3283
## rye - (rye-vetch) -1.39550 0.62 48 -2.250 0.4390
## (rye-clover) - (rye-vetch) 0.11583 0.62 48 0.187 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
cld(Resp_mg_CO2_g_dry_weight.emm.s.cc, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish-oat 2.33 0.595 7.36 -0.0138 4.67 a
## radish-vetch 2.75 0.595 7.36 0.4125 5.10 ab
## radish 2.82 0.595 7.36 0.4734 5.16 ab
## rye 2.92 0.595 7.36 0.5814 5.26 ab
## radish-rye 2.93 0.595 7.36 0.5875 5.27 ab
## oat 3.69 0.595 7.36 1.3470 6.03 ab
## oat-clover 3.95 0.595 7.36 1.6035 6.29 ab
## rye-vetch 4.32 0.595 7.36 1.9769 6.66 ab
## rye-clover 4.43 0.595 7.36 2.0927 6.78 b
## oat-vetch 4.60 0.595 7.36 2.2592 6.94 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 10 estimates
## P value adjustment: tukey method for comparing a family of 10 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Within the plots using pecan agroforestry, cover crop type was found to be NOT significant (p = 0.18) using a linear mixed-effects model with respiration as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_cmin_pec_cc <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type + (1 | year), data = datPEC)
# Summarize the model results
summary(model_cmin_pec_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ cc_type + (1 | year)
## Data: datPEC
##
## REML criterion at convergence: 109.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.45153 -0.69274 0.00273 0.48199 2.37409
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.5253 0.7248
## Residual 1.4002 1.1833
## Number of obs: 36, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.6888 0.6391 6.8812 5.772 0.000727 ***
## cc_typeoat-clover 0.2565 0.6832 28.0000 0.375 0.710159
## cc_typeoat-vetch 0.9122 0.6832 28.0000 1.335 0.192578
## cc_typerye -0.7657 0.6832 28.0000 -1.121 0.271926
## cc_typerye-clover 0.7457 0.6832 28.0000 1.091 0.284378
## cc_typerye-vetch 0.6298 0.6832 28.0000 0.922 0.364456
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typ cc_typry-c
## cc_typt-clv -0.534
## cc_typt-vtc -0.534 0.500
## cc_typerye -0.534 0.500 0.500
## cc_typry-cl -0.534 0.500 0.500 0.500
## cc_typry-vt -0.534 0.500 0.500 0.500 0.500
# Extract fixed effects
fixef(model_cmin_pec_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typerye
## 3.6888333 0.2565000 0.9121667 -0.7656667
## cc_typerye-clover cc_typerye-vetch
## 0.7456667 0.6298333
# Extract random effects (conditional modes)
ranef(model_cmin_pec_cc)
## $year
## (Intercept)
## 2021 -0.7440503
## 2022 0.2511988
## 2023 0.4928515
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_pec_cc) # residuals vs fitted
qqnorm(resid(model_cmin_pec_cc)); qqline(resid(model_cmin_pec_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPEC$cc_type_f <- factor(datPEC$cc_type)
lmer_model_cmin_pec_cc_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year), data = datPEC)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_cmin_pec_cc_result <- emmeans(lmer_model_cmin_pec_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_cmin_pec_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 3.69 0.639 6.88 2.17 5.21
## oat-clover 3.95 0.639 6.88 2.43 5.46
## oat-vetch 4.60 0.639 6.88 3.08 6.12
## rye 2.92 0.639 6.88 1.41 4.44
## rye-clover 4.43 0.639 6.88 2.92 5.95
## rye-vetch 4.32 0.639 6.88 2.80 5.84
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.257 0.683 28 -0.375 0.9989
## oat - (oat-vetch) -0.912 0.683 28 -1.335 0.7634
## oat - rye 0.766 0.683 28 1.121 0.8687
## oat - (rye-clover) -0.746 0.683 28 -1.091 0.8807
## oat - (rye-vetch) -0.630 0.683 28 -0.922 0.9375
## (oat-clover) - (oat-vetch) -0.656 0.683 28 -0.960 0.9267
## (oat-clover) - rye 1.022 0.683 28 1.496 0.6694
## (oat-clover) - (rye-clover) -0.489 0.683 28 -0.716 0.9784
## (oat-clover) - (rye-vetch) -0.373 0.683 28 -0.546 0.9936
## (oat-vetch) - rye 1.678 0.683 28 2.456 0.1720
## (oat-vetch) - (rye-clover) 0.167 0.683 28 0.244 0.9999
## (oat-vetch) - (rye-vetch) 0.282 0.683 28 0.413 0.9983
## rye - (rye-clover) -1.511 0.683 28 -2.212 0.2640
## rye - (rye-vetch) -1.395 0.683 28 -2.043 0.3450
## (rye-clover) - (rye-vetch) 0.116 0.683 28 0.170 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_pec_cc <- mixed(
Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year),
data = datPEC,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_cmin_pec_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year)
## Data: datPEC
## Effect df F p.value
## 1 cc_type_f 5, 28 1.64 .183
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_pec_cc <- anova_kr_cmin_pec_cc$Anova
car_table_cmin_pec_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.cc_pec <- emmeans(model_cmin_pec_cc, "cc_type")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) -0.257 0.683 28 -0.375 0.9989
## oat - (oat-vetch) -0.912 0.683 28 -1.335 0.7634
## oat - rye 0.766 0.683 28 1.121 0.8687
## oat - (rye-clover) -0.746 0.683 28 -1.091 0.8807
## oat - (rye-vetch) -0.630 0.683 28 -0.922 0.9375
## (oat-clover) - (oat-vetch) -0.656 0.683 28 -0.960 0.9267
## (oat-clover) - rye 1.022 0.683 28 1.496 0.6694
## (oat-clover) - (rye-clover) -0.489 0.683 28 -0.716 0.9784
## (oat-clover) - (rye-vetch) -0.373 0.683 28 -0.546 0.9936
## (oat-vetch) - rye 1.678 0.683 28 2.456 0.1720
## (oat-vetch) - (rye-clover) 0.167 0.683 28 0.244 0.9999
## (oat-vetch) - (rye-vetch) 0.282 0.683 28 0.413 0.9983
## rye - (rye-clover) -1.511 0.683 28 -2.212 0.2640
## rye - (rye-vetch) -1.395 0.683 28 -2.043 0.3450
## (rye-clover) - (rye-vetch) 0.116 0.683 28 0.170 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
cld(Resp_mg_CO2_g_dry_weight.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## rye 2.92 0.639 6.88 0.595 5.25 a
## oat 3.69 0.639 6.88 1.361 6.02 a
## oat-clover 3.95 0.639 6.88 1.618 6.27 a
## rye-vetch 4.32 0.639 6.88 1.991 6.65 a
## rye-clover 4.43 0.639 6.88 2.107 6.76 a
## oat-vetch 4.60 0.639 6.88 2.273 6.93 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 6 estimates
## P value adjustment: tukey method for comparing a family of 6 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Within the plots using pine agroforestry, cover crop type was found to be NOT significant (p = 0.69) using a linear mixed-effects model with respiration as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_cmin_pin_cc <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type + (1 | year), data = datPIN)
# Summarize the model results
summary(model_cmin_pin_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ cc_type + (1 | year)
## Data: datPIN
##
## REML criterion at convergence: 63.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.90701 -0.62389 -0.03448 0.37563 1.77853
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.3622 0.6018
## Residual 0.8385 0.9157
## Number of obs: 24, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 2.81517 0.51037 5.33127 5.516 0.00219 **
## cc_typeradish-oat -0.48717 0.52867 18.00000 -0.921 0.36898
## cc_typeradish-rye 0.11417 0.52867 18.00000 0.216 0.83146
## cc_typeradish-vetch -0.06083 0.52867 18.00000 -0.115 0.90967
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typrdsh-t cc_typrdsh-r
## cc_typrdsh-t -0.518
## cc_typrdsh-r -0.518 0.500
## cc_typrdsh-v -0.518 0.500 0.500
# Extract fixed effects
fixef(model_cmin_pin_cc)
## (Intercept) cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch
## 2.81516667 -0.48716667 0.11416667 -0.06083333
# Extract random effects (conditional modes)
ranef(model_cmin_pin_cc)
## $year
## (Intercept)
## 2021 -0.4979806
## 2022 -0.0591049
## 2023 0.5570854
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_pin_cc) # residuals vs fitted
qqnorm(resid(model_cmin_pin_cc)); qqline(resid(model_cmin_pin_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPIN$cc_type_f <- factor(datPIN$cc_type)
lmer_model_cmin_pin_cc_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year), data = datPIN)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_cmin_pin_cc_result <- emmeans(lmer_model_cmin_pin_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_cmin_pin_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## radish 2.82 0.51 5.33 1.53 4.10
## radish-oat 2.33 0.51 5.33 1.04 3.62
## radish-rye 2.93 0.51 5.33 1.64 4.22
## radish-vetch 2.75 0.51 5.33 1.47 4.04
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) 0.4872 0.529 18 0.921 0.7938
## radish - (radish-rye) -0.1142 0.529 18 -0.216 0.9963
## radish - (radish-vetch) 0.0608 0.529 18 0.115 0.9994
## (radish-oat) - (radish-rye) -0.6013 0.529 18 -1.137 0.6720
## (radish-oat) - (radish-vetch) -0.4263 0.529 18 -0.806 0.8506
## (radish-rye) - (radish-vetch) 0.1750 0.529 18 0.331 0.9871
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_pin_cc <- mixed(
Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year),
data = datPIN,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
# Nice ANOVA table
print(nice(anova_kr_cmin_pin_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ cc_type_f + (1 | year)
## Data: datPIN
## Effect df F p.value
## 1 cc_type_f 3, 18 0.49 .691
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_pin_cc <- anova_kr_cmin_pin_cc$Anova
car_table_cmin_pin_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.cc_pin <- emmeans(model_cmin_pin_cc, "cc_type")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) 0.4872 0.529 18 0.921 0.7938
## radish - (radish-rye) -0.1142 0.529 18 -0.216 0.9963
## radish - (radish-vetch) 0.0608 0.529 18 0.115 0.9994
## (radish-oat) - (radish-rye) -0.6013 0.529 18 -1.137 0.6720
## (radish-oat) - (radish-vetch) -0.4263 0.529 18 -0.806 0.8506
## (radish-rye) - (radish-vetch) 0.1750 0.529 18 0.331 0.9871
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
cld(Resp_mg_CO2_g_dry_weight.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish-oat 2.33 0.51 5.33 0.449 4.21 a
## radish-vetch 2.75 0.51 5.33 0.876 4.63 a
## radish 2.82 0.51 5.33 0.937 4.69 a
## radish-rye 2.93 0.51 5.33 1.051 4.81 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: tukey method for comparing a family of 4 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
Tillage was found to be NOT significant (p = 0.80) using a linear mixed-effects model with respiration as the response variable, tillage as the fixed effect, and (1 / year) as the random intercept.
model_cmin_till <- lmer(Resp_mg_CO2_g_dry_weight ~ tillage + (1 | year), data = till_nocntrl)
# Summarize the model results
summary(model_cmin_till)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ tillage + (1 | year)
## Data: till_nocntrl
##
## REML criterion at convergence: 203.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1095 -0.6919 -0.1854 0.6476 3.0755
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4624 0.680
## Residual 1.6348 1.279
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.43210 0.45677 2.64378 7.514 0.00746 **
## tillageno_till 0.08347 0.33013 56.00001 0.253 0.80132
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## tillagn_tll -0.361
# Extract fixed effects
fixef(model_cmin_till)
## (Intercept) tillageno_till
## 3.43210000 0.08346667
# Extract random effects (conditional modes)
ranef(model_cmin_till)
## $year
## (Intercept)
## 2021 -0.6819059
## 2022 0.1306280
## 2023 0.5512778
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_till) # residuals vs fitted
qqnorm(resid(model_cmin_till)); qqline(resid(model_cmin_till)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with tillage as a factor for pairwise comparisons
till_nocntrl$tillage_f <- factor(till_nocntrl$tillage)
lmer_model_cmin_till_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ tillage_f + (1 | year), data = till_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ tillage_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `tillage_f` factor.
emmeans_cmin_till_result <- emmeans(lmer_model_cmin_till_factor, pairwise ~ tillage_f, adjust = "tukey")
# View the results
emmeans_cmin_till_result
## $emmeans
## tillage_f emmean SE df lower.CL upper.CL
## min_till 3.43 0.457 2.64 1.86 5.00
## no_till 3.52 0.457 2.64 1.94 5.09
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## min_till - no_till -0.0835 0.33 56 -0.253 0.8013
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_till <- mixed(
Resp_mg_CO2_g_dry_weight ~ tillage_f + (1 | year),
data = till_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: tillage_f
# Nice ANOVA table
print(nice(anova_kr_cmin_till), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ tillage_f + (1 | year)
## Data: till_nocntrl
## Effect df F p.value
## 1 tillage_f 1, 56 0.06 .801
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_cmin_till <- anova_kr_cmin_till$Anova
car_table_cmin_till # prints a car::Anova-like table with F-tests and KR dfs
## NULL
Resp_mg_CO2_g_dry_weight.emm.s.till <- emmeans(model_cmin_till, "tillage")
pairs(Resp_mg_CO2_g_dry_weight.emm.s.till, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## min_till - no_till -0.0835 0.33 56 -0.253 0.8013
##
## Degrees-of-freedom method: kenward-roger
cld(Resp_mg_CO2_g_dry_weight.emm.s.till, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## tillage emmean SE df lower.CL upper.CL .group
## min_till 3.43 0.457 2.64 1.33 5.53 a
## no_till 3.52 0.457 2.64 1.41 5.62 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
Significance Summary:
The interaction between agroforestry tree type and tillage was found to be NOT significant (p = 0.25) using a linear mixed-effects model with respiration as the response variable, agro_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_cmin_agtil <- lmer(Resp_mg_CO2_g_dry_weight ~ agro_type*tillage + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_cmin_agtil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ agro_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 185.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.9188 -0.6646 -0.1270 0.5902 3.2021
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4827 0.6948
## Residual 1.2291 1.1086
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.8087 0.4787 3.1847 7.956 0.00333 **
## agro_typepine -0.9414 0.4132 54.0000 -2.279 0.02667 *
## tillageno_till 0.3532 0.3695 54.0000 0.956 0.34350
## agro_typepine:tillageno_till -0.6742 0.5843 54.0000 -1.154 0.25361
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) agr_ty tllgn_
## agro_typepn -0.345
## tillagn_tll -0.386 0.447
## agr_typpn:_ 0.244 -0.707 -0.632
# Extract fixed effects
fixef(model_cmin_agtil)
## (Intercept) agro_typepine
## 3.8086667 -0.9414167
## tillageno_till agro_typepine:tillageno_till
## 0.3531667 -0.6742500
# Extract random effects (conditional modes)
ranef(model_cmin_agtil)
## $year
## (Intercept)
## 2021 -0.7118147
## 2022 0.1363575
## 2023 0.5754572
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_agtil) # residuals vs fitted
qqnorm(resid(model_cmin_agtil)); qqline(resid(model_cmin_agtil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_cmin_agtil_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ agro_type_f*tillage_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_cmin_agtil_result <- emmeans(lmer_model_cmin_agtil_factor, pairwise ~ agro_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_cmin_agtil_result
## $emmeans
## agro_type_f tillage_f emmean SE df lower.CL upper.CL
## pecan min_till 3.81 0.479 3.18 2.33 5.28
## pine min_till 2.87 0.513 4.18 1.47 4.27
## pecan no_till 4.16 0.479 3.18 2.69 5.64
## pine no_till 2.55 0.513 4.18 1.15 3.95
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan min_till - pine min_till 0.941 0.413 54 2.279 0.1158
## pecan min_till - pecan no_till -0.353 0.370 54 -0.956 0.7749
## pecan min_till - pine no_till 1.262 0.413 54 3.056 0.0178
## pine min_till - pecan no_till -1.295 0.413 54 -3.133 0.0144
## pine min_till - pine no_till 0.321 0.453 54 0.709 0.8929
## pecan no_till - pine no_till 1.616 0.413 54 3.910 0.0014
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_agtil <- mixed(
Resp_mg_CO2_g_dry_weight ~ agro_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f, tillage
# Nice ANOVA table
print(nice(anova_kr_cmin_agtil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ agro_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 54 19.15 *** <.001
## 2 tillage 1, 54 0.00 .956
## 3 agro_type_f:tillage 1, 54 1.33 .254
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
The interaction between cover crop type and tillage was found to be NOT significant (p = 0.80) using a linear mixed-effects model with respiration as the response variable, cc_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_cmin_cctil <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type*tillage + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_cmin_cctil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Resp_mg_CO2_g_dry_weight ~ cc_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 149.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.4551 -0.5372 -0.0397 0.4947 2.4272
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.4803 0.6931
## Residual 1.2771 1.1301
## Number of obs: 60, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 3.5677 0.7654 16.5338 4.661 0.00024
## cc_typeoat-clover 0.4397 0.9227 38.0000 0.476 0.63645
## cc_typeoat-vetch 0.3897 0.9227 38.0000 0.422 0.67518
## cc_typeradish -0.3660 0.9227 38.0000 -0.397 0.69384
## cc_typeradish-oat -1.5060 0.9227 38.0000 -1.632 0.11091
## cc_typeradish-rye -0.6767 0.9227 38.0000 -0.733 0.46785
## cc_typeradish-vetch -0.2530 0.9227 38.0000 -0.274 0.78542
## cc_typerye -0.9273 0.9227 38.0000 -1.005 0.32125
## cc_typerye-clover 1.0487 0.9227 38.0000 1.137 0.26286
## cc_typerye-vetch 0.4953 0.9227 38.0000 0.537 0.59452
## tillageno_till 0.2423 0.9227 38.0000 0.263 0.79425
## cc_typeoat-clover:tillageno_till -0.3663 1.3049 38.0000 -0.281 0.78044
## cc_typeoat-vetch:tillageno_till 1.0450 1.3049 38.0000 0.801 0.42822
## cc_typeradish:tillageno_till -1.0153 1.3049 38.0000 -0.778 0.44134
## cc_typeradish-oat:tillageno_till 0.2903 1.3049 38.0000 0.222 0.82512
## cc_typeradish-rye:tillageno_till -0.1657 1.3049 38.0000 -0.127 0.89964
## cc_typeradish-vetch:tillageno_till -1.3630 1.3049 38.0000 -1.045 0.30285
## cc_typerye:tillageno_till 0.3233 1.3049 38.0000 0.248 0.80564
## cc_typerye-clover:tillageno_till -0.6060 1.3049 38.0000 -0.464 0.64501
## cc_typerye-vetch:tillageno_till 0.2690 1.3049 38.0000 0.206 0.83778
##
## (Intercept) ***
## cc_typeoat-clover
## cc_typeoat-vetch
## cc_typeradish
## cc_typeradish-oat
## cc_typeradish-rye
## cc_typeradish-vetch
## cc_typerye
## cc_typerye-clover
## cc_typerye-vetch
## tillageno_till
## cc_typeoat-clover:tillageno_till
## cc_typeoat-vetch:tillageno_till
## cc_typeradish:tillageno_till
## cc_typeradish-oat:tillageno_till
## cc_typeradish-rye:tillageno_till
## cc_typeradish-vetch:tillageno_till
## cc_typerye:tillageno_till
## cc_typerye-clover:tillageno_till
## cc_typerye-vetch:tillageno_till
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
# Extract fixed effects
fixef(model_cmin_cctil)
## (Intercept) cc_typeoat-clover
## 3.5676667 0.4396667
## cc_typeoat-vetch cc_typeradish
## 0.3896667 -0.3660000
## cc_typeradish-oat cc_typeradish-rye
## -1.5060000 -0.6766667
## cc_typeradish-vetch cc_typerye
## -0.2530000 -0.9273333
## cc_typerye-clover cc_typerye-vetch
## 1.0486667 0.4953333
## tillageno_till cc_typeoat-clover:tillageno_till
## 0.2423333 -0.3663333
## cc_typeoat-vetch:tillageno_till cc_typeradish:tillageno_till
## 1.0450000 -1.0153333
## cc_typeradish-oat:tillageno_till cc_typeradish-rye:tillageno_till
## 0.2903333 -0.1656667
## cc_typeradish-vetch:tillageno_till cc_typerye:tillageno_till
## -1.3630000 0.3233333
## cc_typerye-clover:tillageno_till cc_typerye-vetch:tillageno_till
## -0.6060000 0.2690000
# Extract random effects (conditional modes)
ranef(model_cmin_cctil)
## $year
## (Intercept)
## 2021 -0.7082746
## 2022 0.1356793
## 2023 0.5725953
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_cmin_cctil) # residuals vs fitted
qqnorm(resid(model_cmin_cctil)); qqline(resid(model_cmin_cctil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$cc_type_f <- factor(ag_nocntrl$cc_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_cmin_cctil_factor <- lmer(Resp_mg_CO2_g_dry_weight ~ cc_type_f*tillage_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_cmin_cctil_result <- emmeans(lmer_model_cmin_cctil_factor, pairwise ~ cc_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_cmin_cctil_result
## $emmeans
## cc_type_f tillage_f emmean SE df lower.CL upper.CL
## oat min_till 3.57 0.765 16.5 1.949 5.19
## oat-clover min_till 4.01 0.765 16.5 2.389 5.63
## oat-vetch min_till 3.96 0.765 16.5 2.339 5.58
## radish min_till 3.20 0.765 16.5 1.583 4.82
## radish-oat min_till 2.06 0.765 16.5 0.443 3.68
## radish-rye min_till 2.89 0.765 16.5 1.273 4.51
## radish-vetch min_till 3.31 0.765 16.5 1.696 4.93
## rye min_till 2.64 0.765 16.5 1.022 4.26
## rye-clover min_till 4.62 0.765 16.5 2.998 6.23
## rye-vetch min_till 4.06 0.765 16.5 2.445 5.68
## oat no_till 3.81 0.765 16.5 2.192 5.43
## oat-clover no_till 3.88 0.765 16.5 2.265 5.50
## oat-vetch no_till 5.24 0.765 16.5 3.626 6.86
## radish no_till 2.43 0.765 16.5 0.810 4.05
## radish-oat no_till 2.59 0.765 16.5 0.976 4.21
## radish-rye no_till 2.97 0.765 16.5 1.349 4.59
## radish-vetch no_till 2.19 0.765 16.5 0.576 3.81
## rye no_till 3.21 0.765 16.5 1.588 4.82
## rye-clover no_till 4.25 0.765 16.5 2.634 5.87
## rye-vetch no_till 4.57 0.765 16.5 2.956 6.19
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## oat min_till - (oat-clover min_till) -0.43967 0.923 38 -0.476
## oat min_till - (oat-vetch min_till) -0.38967 0.923 38 -0.422
## oat min_till - radish min_till 0.36600 0.923 38 0.397
## oat min_till - (radish-oat min_till) 1.50600 0.923 38 1.632
## oat min_till - (radish-rye min_till) 0.67667 0.923 38 0.733
## oat min_till - (radish-vetch min_till) 0.25300 0.923 38 0.274
## oat min_till - rye min_till 0.92733 0.923 38 1.005
## oat min_till - (rye-clover min_till) -1.04867 0.923 38 -1.137
## oat min_till - (rye-vetch min_till) -0.49533 0.923 38 -0.537
## oat min_till - oat no_till -0.24233 0.923 38 -0.263
## oat min_till - (oat-clover no_till) -0.31567 0.923 38 -0.342
## oat min_till - (oat-vetch no_till) -1.67700 0.923 38 -1.817
## oat min_till - radish no_till 1.13900 0.923 38 1.234
## oat min_till - (radish-oat no_till) 0.97333 0.923 38 1.055
## oat min_till - (radish-rye no_till) 0.60000 0.923 38 0.650
## oat min_till - (radish-vetch no_till) 1.37367 0.923 38 1.489
## oat min_till - rye no_till 0.36167 0.923 38 0.392
## oat min_till - (rye-clover no_till) -0.68500 0.923 38 -0.742
## oat min_till - (rye-vetch no_till) -1.00667 0.923 38 -1.091
## (oat-clover min_till) - (oat-vetch min_till) 0.05000 0.923 38 0.054
## (oat-clover min_till) - radish min_till 0.80567 0.923 38 0.873
## (oat-clover min_till) - (radish-oat min_till) 1.94567 0.923 38 2.109
## (oat-clover min_till) - (radish-rye min_till) 1.11633 0.923 38 1.210
## (oat-clover min_till) - (radish-vetch min_till) 0.69267 0.923 38 0.751
## (oat-clover min_till) - rye min_till 1.36700 0.923 38 1.482
## (oat-clover min_till) - (rye-clover min_till) -0.60900 0.923 38 -0.660
## (oat-clover min_till) - (rye-vetch min_till) -0.05567 0.923 38 -0.060
## (oat-clover min_till) - oat no_till 0.19733 0.923 38 0.214
## (oat-clover min_till) - (oat-clover no_till) 0.12400 0.923 38 0.134
## (oat-clover min_till) - (oat-vetch no_till) -1.23733 0.923 38 -1.341
## (oat-clover min_till) - radish no_till 1.57867 0.923 38 1.711
## (oat-clover min_till) - (radish-oat no_till) 1.41300 0.923 38 1.531
## (oat-clover min_till) - (radish-rye no_till) 1.03967 0.923 38 1.127
## (oat-clover min_till) - (radish-vetch no_till) 1.81333 0.923 38 1.965
## (oat-clover min_till) - rye no_till 0.80133 0.923 38 0.868
## (oat-clover min_till) - (rye-clover no_till) -0.24533 0.923 38 -0.266
## (oat-clover min_till) - (rye-vetch no_till) -0.56700 0.923 38 -0.614
## (oat-vetch min_till) - radish min_till 0.75567 0.923 38 0.819
## (oat-vetch min_till) - (radish-oat min_till) 1.89567 0.923 38 2.054
## (oat-vetch min_till) - (radish-rye min_till) 1.06633 0.923 38 1.156
## (oat-vetch min_till) - (radish-vetch min_till) 0.64267 0.923 38 0.696
## (oat-vetch min_till) - rye min_till 1.31700 0.923 38 1.427
## (oat-vetch min_till) - (rye-clover min_till) -0.65900 0.923 38 -0.714
## (oat-vetch min_till) - (rye-vetch min_till) -0.10567 0.923 38 -0.115
## (oat-vetch min_till) - oat no_till 0.14733 0.923 38 0.160
## (oat-vetch min_till) - (oat-clover no_till) 0.07400 0.923 38 0.080
## (oat-vetch min_till) - (oat-vetch no_till) -1.28733 0.923 38 -1.395
## (oat-vetch min_till) - radish no_till 1.52867 0.923 38 1.657
## (oat-vetch min_till) - (radish-oat no_till) 1.36300 0.923 38 1.477
## (oat-vetch min_till) - (radish-rye no_till) 0.98967 0.923 38 1.073
## (oat-vetch min_till) - (radish-vetch no_till) 1.76333 0.923 38 1.911
## (oat-vetch min_till) - rye no_till 0.75133 0.923 38 0.814
## (oat-vetch min_till) - (rye-clover no_till) -0.29533 0.923 38 -0.320
## (oat-vetch min_till) - (rye-vetch no_till) -0.61700 0.923 38 -0.669
## radish min_till - (radish-oat min_till) 1.14000 0.923 38 1.235
## radish min_till - (radish-rye min_till) 0.31067 0.923 38 0.337
## radish min_till - (radish-vetch min_till) -0.11300 0.923 38 -0.122
## radish min_till - rye min_till 0.56133 0.923 38 0.608
## radish min_till - (rye-clover min_till) -1.41467 0.923 38 -1.533
## radish min_till - (rye-vetch min_till) -0.86133 0.923 38 -0.933
## radish min_till - oat no_till -0.60833 0.923 38 -0.659
## radish min_till - (oat-clover no_till) -0.68167 0.923 38 -0.739
## radish min_till - (oat-vetch no_till) -2.04300 0.923 38 -2.214
## radish min_till - radish no_till 0.77300 0.923 38 0.838
## radish min_till - (radish-oat no_till) 0.60733 0.923 38 0.658
## radish min_till - (radish-rye no_till) 0.23400 0.923 38 0.254
## radish min_till - (radish-vetch no_till) 1.00767 0.923 38 1.092
## radish min_till - rye no_till -0.00433 0.923 38 -0.005
## radish min_till - (rye-clover no_till) -1.05100 0.923 38 -1.139
## radish min_till - (rye-vetch no_till) -1.37267 0.923 38 -1.488
## (radish-oat min_till) - (radish-rye min_till) -0.82933 0.923 38 -0.899
## (radish-oat min_till) - (radish-vetch min_till) -1.25300 0.923 38 -1.358
## (radish-oat min_till) - rye min_till -0.57867 0.923 38 -0.627
## (radish-oat min_till) - (rye-clover min_till) -2.55467 0.923 38 -2.769
## (radish-oat min_till) - (rye-vetch min_till) -2.00133 0.923 38 -2.169
## (radish-oat min_till) - oat no_till -1.74833 0.923 38 -1.895
## (radish-oat min_till) - (oat-clover no_till) -1.82167 0.923 38 -1.974
## (radish-oat min_till) - (oat-vetch no_till) -3.18300 0.923 38 -3.450
## (radish-oat min_till) - radish no_till -0.36700 0.923 38 -0.398
## (radish-oat min_till) - (radish-oat no_till) -0.53267 0.923 38 -0.577
## (radish-oat min_till) - (radish-rye no_till) -0.90600 0.923 38 -0.982
## (radish-oat min_till) - (radish-vetch no_till) -0.13233 0.923 38 -0.143
## (radish-oat min_till) - rye no_till -1.14433 0.923 38 -1.240
## (radish-oat min_till) - (rye-clover no_till) -2.19100 0.923 38 -2.375
## (radish-oat min_till) - (rye-vetch no_till) -2.51267 0.923 38 -2.723
## (radish-rye min_till) - (radish-vetch min_till) -0.42367 0.923 38 -0.459
## (radish-rye min_till) - rye min_till 0.25067 0.923 38 0.272
## (radish-rye min_till) - (rye-clover min_till) -1.72533 0.923 38 -1.870
## (radish-rye min_till) - (rye-vetch min_till) -1.17200 0.923 38 -1.270
## (radish-rye min_till) - oat no_till -0.91900 0.923 38 -0.996
## (radish-rye min_till) - (oat-clover no_till) -0.99233 0.923 38 -1.075
## (radish-rye min_till) - (oat-vetch no_till) -2.35367 0.923 38 -2.551
## (radish-rye min_till) - radish no_till 0.46233 0.923 38 0.501
## (radish-rye min_till) - (radish-oat no_till) 0.29667 0.923 38 0.322
## (radish-rye min_till) - (radish-rye no_till) -0.07667 0.923 38 -0.083
## (radish-rye min_till) - (radish-vetch no_till) 0.69700 0.923 38 0.755
## (radish-rye min_till) - rye no_till -0.31500 0.923 38 -0.341
## (radish-rye min_till) - (rye-clover no_till) -1.36167 0.923 38 -1.476
## (radish-rye min_till) - (rye-vetch no_till) -1.68333 0.923 38 -1.824
## (radish-vetch min_till) - rye min_till 0.67433 0.923 38 0.731
## (radish-vetch min_till) - (rye-clover min_till) -1.30167 0.923 38 -1.411
## (radish-vetch min_till) - (rye-vetch min_till) -0.74833 0.923 38 -0.811
## (radish-vetch min_till) - oat no_till -0.49533 0.923 38 -0.537
## (radish-vetch min_till) - (oat-clover no_till) -0.56867 0.923 38 -0.616
## (radish-vetch min_till) - (oat-vetch no_till) -1.93000 0.923 38 -2.092
## (radish-vetch min_till) - radish no_till 0.88600 0.923 38 0.960
## (radish-vetch min_till) - (radish-oat no_till) 0.72033 0.923 38 0.781
## (radish-vetch min_till) - (radish-rye no_till) 0.34700 0.923 38 0.376
## (radish-vetch min_till) - (radish-vetch no_till) 1.12067 0.923 38 1.215
## (radish-vetch min_till) - rye no_till 0.10867 0.923 38 0.118
## (radish-vetch min_till) - (rye-clover no_till) -0.93800 0.923 38 -1.017
## (radish-vetch min_till) - (rye-vetch no_till) -1.25967 0.923 38 -1.365
## rye min_till - (rye-clover min_till) -1.97600 0.923 38 -2.142
## rye min_till - (rye-vetch min_till) -1.42267 0.923 38 -1.542
## rye min_till - oat no_till -1.16967 0.923 38 -1.268
## rye min_till - (oat-clover no_till) -1.24300 0.923 38 -1.347
## rye min_till - (oat-vetch no_till) -2.60433 0.923 38 -2.822
## rye min_till - radish no_till 0.21167 0.923 38 0.229
## rye min_till - (radish-oat no_till) 0.04600 0.923 38 0.050
## rye min_till - (radish-rye no_till) -0.32733 0.923 38 -0.355
## rye min_till - (radish-vetch no_till) 0.44633 0.923 38 0.484
## rye min_till - rye no_till -0.56567 0.923 38 -0.613
## rye min_till - (rye-clover no_till) -1.61233 0.923 38 -1.747
## rye min_till - (rye-vetch no_till) -1.93400 0.923 38 -2.096
## (rye-clover min_till) - (rye-vetch min_till) 0.55333 0.923 38 0.600
## (rye-clover min_till) - oat no_till 0.80633 0.923 38 0.874
## (rye-clover min_till) - (oat-clover no_till) 0.73300 0.923 38 0.794
## (rye-clover min_till) - (oat-vetch no_till) -0.62833 0.923 38 -0.681
## (rye-clover min_till) - radish no_till 2.18767 0.923 38 2.371
## (rye-clover min_till) - (radish-oat no_till) 2.02200 0.923 38 2.191
## (rye-clover min_till) - (radish-rye no_till) 1.64867 0.923 38 1.787
## (rye-clover min_till) - (radish-vetch no_till) 2.42233 0.923 38 2.625
## (rye-clover min_till) - rye no_till 1.41033 0.923 38 1.528
## (rye-clover min_till) - (rye-clover no_till) 0.36367 0.923 38 0.394
## (rye-clover min_till) - (rye-vetch no_till) 0.04200 0.923 38 0.046
## (rye-vetch min_till) - oat no_till 0.25300 0.923 38 0.274
## (rye-vetch min_till) - (oat-clover no_till) 0.17967 0.923 38 0.195
## (rye-vetch min_till) - (oat-vetch no_till) -1.18167 0.923 38 -1.281
## (rye-vetch min_till) - radish no_till 1.63433 0.923 38 1.771
## (rye-vetch min_till) - (radish-oat no_till) 1.46867 0.923 38 1.592
## (rye-vetch min_till) - (radish-rye no_till) 1.09533 0.923 38 1.187
## (rye-vetch min_till) - (radish-vetch no_till) 1.86900 0.923 38 2.026
## (rye-vetch min_till) - rye no_till 0.85700 0.923 38 0.929
## (rye-vetch min_till) - (rye-clover no_till) -0.18967 0.923 38 -0.206
## (rye-vetch min_till) - (rye-vetch no_till) -0.51133 0.923 38 -0.554
## oat no_till - (oat-clover no_till) -0.07333 0.923 38 -0.079
## oat no_till - (oat-vetch no_till) -1.43467 0.923 38 -1.555
## oat no_till - radish no_till 1.38133 0.923 38 1.497
## oat no_till - (radish-oat no_till) 1.21567 0.923 38 1.317
## oat no_till - (radish-rye no_till) 0.84233 0.923 38 0.913
## oat no_till - (radish-vetch no_till) 1.61600 0.923 38 1.751
## oat no_till - rye no_till 0.60400 0.923 38 0.655
## oat no_till - (rye-clover no_till) -0.44267 0.923 38 -0.480
## oat no_till - (rye-vetch no_till) -0.76433 0.923 38 -0.828
## (oat-clover no_till) - (oat-vetch no_till) -1.36133 0.923 38 -1.475
## (oat-clover no_till) - radish no_till 1.45467 0.923 38 1.577
## (oat-clover no_till) - (radish-oat no_till) 1.28900 0.923 38 1.397
## (oat-clover no_till) - (radish-rye no_till) 0.91567 0.923 38 0.992
## (oat-clover no_till) - (radish-vetch no_till) 1.68933 0.923 38 1.831
## (oat-clover no_till) - rye no_till 0.67733 0.923 38 0.734
## (oat-clover no_till) - (rye-clover no_till) -0.36933 0.923 38 -0.400
## (oat-clover no_till) - (rye-vetch no_till) -0.69100 0.923 38 -0.749
## (oat-vetch no_till) - radish no_till 2.81600 0.923 38 3.052
## (oat-vetch no_till) - (radish-oat no_till) 2.65033 0.923 38 2.872
## (oat-vetch no_till) - (radish-rye no_till) 2.27700 0.923 38 2.468
## (oat-vetch no_till) - (radish-vetch no_till) 3.05067 0.923 38 3.306
## (oat-vetch no_till) - rye no_till 2.03867 0.923 38 2.209
## (oat-vetch no_till) - (rye-clover no_till) 0.99200 0.923 38 1.075
## (oat-vetch no_till) - (rye-vetch no_till) 0.67033 0.923 38 0.726
## radish no_till - (radish-oat no_till) -0.16567 0.923 38 -0.180
## radish no_till - (radish-rye no_till) -0.53900 0.923 38 -0.584
## radish no_till - (radish-vetch no_till) 0.23467 0.923 38 0.254
## radish no_till - rye no_till -0.77733 0.923 38 -0.842
## radish no_till - (rye-clover no_till) -1.82400 0.923 38 -1.977
## radish no_till - (rye-vetch no_till) -2.14567 0.923 38 -2.325
## (radish-oat no_till) - (radish-rye no_till) -0.37333 0.923 38 -0.405
## (radish-oat no_till) - (radish-vetch no_till) 0.40033 0.923 38 0.434
## (radish-oat no_till) - rye no_till -0.61167 0.923 38 -0.663
## (radish-oat no_till) - (rye-clover no_till) -1.65833 0.923 38 -1.797
## (radish-oat no_till) - (rye-vetch no_till) -1.98000 0.923 38 -2.146
## (radish-rye no_till) - (radish-vetch no_till) 0.77367 0.923 38 0.838
## (radish-rye no_till) - rye no_till -0.23833 0.923 38 -0.258
## (radish-rye no_till) - (rye-clover no_till) -1.28500 0.923 38 -1.393
## (radish-rye no_till) - (rye-vetch no_till) -1.60667 0.923 38 -1.741
## (radish-vetch no_till) - rye no_till -1.01200 0.923 38 -1.097
## (radish-vetch no_till) - (rye-clover no_till) -2.05867 0.923 38 -2.231
## (radish-vetch no_till) - (rye-vetch no_till) -2.38033 0.923 38 -2.580
## rye no_till - (rye-clover no_till) -1.04667 0.923 38 -1.134
## rye no_till - (rye-vetch no_till) -1.36833 0.923 38 -1.483
## (rye-clover no_till) - (rye-vetch no_till) -0.32167 0.923 38 -0.349
## p.value
## 1.0000
## 1.0000
## 1.0000
## 0.9789
## 1.0000
## 1.0000
## 0.9999
## 0.9997
## 1.0000
## 1.0000
## 1.0000
## 0.9441
## 0.9991
## 0.9999
## 1.0000
## 0.9918
## 1.0000
## 1.0000
## 0.9998
## 1.0000
## 1.0000
## 0.8327
## 0.9993
## 1.0000
## 0.9922
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9975
## 0.9670
## 0.9889
## 0.9997
## 0.8967
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.8589
## 0.9996
## 1.0000
## 0.9949
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9960
## 0.9756
## 0.9925
## 0.9999
## 0.9163
## 1.0000
## 1.0000
## 1.0000
## 0.9991
## 1.0000
## 1.0000
## 1.0000
## 0.9888
## 1.0000
## 1.0000
## 1.0000
## 0.7751
## 1.0000
## 1.0000
## 1.0000
## 0.9998
## 1.0000
## 0.9997
## 0.9919
## 1.0000
## 0.9971
## 1.0000
## 0.4130
## 0.8007
## 0.9217
## 0.8932
## 0.1143
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9991
## 0.6750
## 0.4418
## 1.0000
## 1.0000
## 0.9295
## 0.9987
## 1.0000
## 0.9999
## 0.5562
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9925
## 0.9423
## 1.0000
## 0.9955
## 1.0000
## 1.0000
## 1.0000
## 0.8412
## 1.0000
## 1.0000
## 1.0000
## 0.9993
## 1.0000
## 0.9999
## 0.9969
## 0.8156
## 0.9881
## 0.9988
## 0.9974
## 0.3801
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9601
## 0.8390
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.6774
## 0.7882
## 0.9516
## 0.5060
## 0.9891
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9986
## 0.9551
## 0.9835
## 0.9995
## 0.8719
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9870
## 0.9913
## 0.9980
## 1.0000
## 0.9593
## 1.0000
## 1.0000
## 1.0000
## 0.9926
## 0.9850
## 0.9960
## 1.0000
## 0.9406
## 1.0000
## 1.0000
## 1.0000
## 0.2568
## 0.3509
## 0.6126
## 0.1556
## 0.7779
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.8922
## 0.7069
## 1.0000
## 1.0000
## 1.0000
## 0.9491
## 0.8133
## 1.0000
## 1.0000
## 0.9961
## 0.9614
## 0.9998
## 0.7652
## 0.5366
## 0.9997
## 0.9921
## 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 20 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_cmin_cctil <- mixed(
Resp_mg_CO2_g_dry_weight ~ cc_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f, tillage
# Nice ANOVA table
print(nice(anova_kr_cmin_cctil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: Resp_mg_CO2_g_dry_weight ~ cc_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 38 3.15 ** .006
## 2 tillage 1, 38 0.08 .776
## 3 cc_type_f:tillage 9, 38 0.59 .797
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
Agroforestry treatment was found to be NOT significant (p = 0.66) using a linear mixed-effects model with MBC as the response variable, agro_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbc_ag_treats2 <- lmer(MBIO_C ~ agro_treatment + (1 | year), data = ag_treats2)
# Summarize the model results
summary(model_mbc_ag_treats2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ agro_treatment + (1 | year)
## Data: ag_treats2
##
## REML criterion at convergence: 599.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.0955 -0.5316 -0.1310 0.6139 2.3950
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 6575 81.09
## Residual 7781 88.21
## Number of obs: 52, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 146.589 48.554 1.958 3.019 0.0969 .
## agro_treatmentno_agroforestry 28.242 64.454 48.146 0.438 0.6632
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agr_trtmnt_ -0.057
# Extract fixed effects
fixef(model_mbc_ag_treats2)
## (Intercept) agro_treatmentno_agroforestry
## 146.58943 28.24207
# Extract random effects (conditional modes)
ranef(model_mbc_ag_treats2)
## $year
## (Intercept)
## 2021 41.13999
## 2022 -90.25905
## 2023 49.11906
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_ag_treats2) # residuals vs fitted
qqnorm(resid(model_mbc_ag_treats2)); qqline(resid(model_mbc_ag_treats2)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_treatment as a factor for pairwise comparisons
ag_treats2$agro_treatment_f <- factor(ag_treats2$agro_treatment)
lmer_model_mbc_ag_treats2_factor <- lmer(MBIO_C ~ agro_treatment_f + (1 | year), data = ag_treats2)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_mbc_ag_treats2_result <- emmeans(lmer_model_mbc_ag_treats2_factor, pairwise ~ agro_treatment_f, adjust = "tukey")
# View the results
emmeans_mbc_ag_treats2_result
## $emmeans
## agro_treatment_f emmean SE df lower.CL upper.CL
## agroforestry 147 48.6 2.01 -61.67 355
## no_agroforestry 175 78.5 12.30 4.24 345
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry -28.2 64.6 48.2 -0.437 0.6639
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_ag_treats2 <- mixed(
MBIO_C ~ agro_treatment_f + (1 | year),
data = ag_treats2,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_treatment_f
## Warning: Due to missing values, reduced number of observations to 52
# Nice ANOVA table
print(nice(anova_kr_mbc_ag_treats2), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ agro_treatment_f + (1 | year)
## Data: ag_treats2
## Effect df F p.value
## 1 agro_treatment_f 1, 48.19 0.19 .664
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_ag_treats2 <- anova_kr_mbc_ag_treats2$Anova
car_table_mbc_ag_treats2 # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.ag_treats2 <- emmeans(model_mbc_ag_treats2, "agro_treatment")
pairs(MBIO_C.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry -28.2 64.6 48.2 -0.437 0.6639
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_C.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_treatment emmean SE df lower.CL upper.CL .group
## agroforestry 147 48.6 2.01 -151.5 445 a
## no_agroforestry 175 78.5 12.30 -24.9 375 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Agroforestry tree type was found to be significant (p = 0.003) using a linear mixed-effects model with MBC as the response variable, agro_type as the fixed effect, and (1 / year) as the random intercept.
model_mbc_ag <- lmer(MBIO_C ~ agro_type + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_mbc_ag)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ agro_type + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 572.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.8944 -0.6620 0.1048 0.6008 2.6904
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 6044 77.75
## Residual 6986 83.58
## Number of obs: 50, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 174.57 47.62 2.13 3.666 0.06087 .
## agro_typepine -65.05 23.97 45.95 -2.714 0.00933 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agro_typepn -0.214
# Extract fixed effects
fixef(model_mbc_ag)
## (Intercept) agro_typepine
## 174.56827 -65.05277
# Extract random effects (conditional modes)
ranef(model_mbc_ag)
## $year
## (Intercept)
## 2021 40.64176
## 2022 -86.55551
## 2023 45.91375
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_ag) # residuals vs fitted
qqnorm(resid(model_mbc_ag)); qqline(resid(model_mbc_ag)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
lmer_model_mbc_ag_factor <- lmer(MBIO_C ~ agro_type_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_type_f` factor.
emmeans_mbc_ag_result <- emmeans(lmer_model_mbc_ag_factor, pairwise ~ agro_type_f, adjust = "tukey")
# View the results
emmeans_mbc_ag_result
## $emmeans
## agro_type_f emmean SE df lower.CL upper.CL
## pecan 175 47.6 2.19 -14.1 363
## pine 110 48.5 2.36 -71.3 290
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan - pine 65.1 24 46 2.714 0.0093
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_ag <- mixed(
MBIO_C ~ agro_type_f + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f
## Warning: Due to missing values, reduced number of observations to 50
# Nice ANOVA table
print(nice(anova_kr_mbc_ag), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ agro_type_f + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 46.01 7.36 ** .009
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_ag <- anova_kr_mbc_ag$Anova
car_table_mbc_ag # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.ag <- emmeans(model_mbc_ag, "agro_type")
pairs(MBIO_C.emm.s.ag, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## pecan - pine 65.1 24 46 2.714 0.0093
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_C.emm.s.ag, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_type emmean SE df lower.CL upper.CL .group
## pine 110 48.5 2.36 -138.4 357 a
## pecan 175 47.6 2.19 -88.8 438 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Cover crop treatment was found to be NOT significant (p = 0.21) using a linear mixed-effects model with MBC as the response variable, cc_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbc_cc_treats <- lmer(MBIO_C ~ cc_treatment + (1 | year), data = dat)
# Summarize the model results
summary(model_mbc_cc_treats)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ cc_treatment + (1 | year)
## Data: dat
##
## REML criterion at convergence: 624.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.10088 -0.53615 -0.08648 0.61593 2.39554
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 7427 86.18
## Residual 7760 88.09
## Number of obs: 54, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 145.526 51.388 1.977 2.832 0.107
## cc_treatmentno_cc 59.378 46.939 50.288 1.265 0.212
##
## Correlation of Fixed Effects:
## (Intr)
## cc_trtmntn_ -0.074
# Extract fixed effects
fixef(model_mbc_cc_treats)
## (Intercept) cc_treatmentno_cc
## 145.52570 59.37831
# Extract random effects (conditional modes)
ranef(model_mbc_cc_treats)
## $year
## (Intercept)
## 2021 42.43253
## 2022 -96.31227
## 2023 53.87974
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_cc_treats) # residuals vs fitted
qqnorm(resid(model_mbc_cc_treats)); qqline(resid(model_mbc_cc_treats)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_treatment as a factor for pairwise comparisons
dat$cc_treatment_f <- factor(dat$cc_treatment)
lmer_model_mbc_cc_treats_factor <- lmer(MBIO_C ~ cc_treatment_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_mbc_cc_treats_result <- emmeans(lmer_model_mbc_cc_treats_factor, pairwise ~ cc_treatment_f, adjust = "tukey")
# View the results
emmeans_mbc_cc_treats_result
## $emmeans
## cc_treatment_f emmean SE df lower.CL upper.CL
## covercrop 146 51.4 2.01 -74.2 365
## no_cc 205 67.1 5.69 38.6 371
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc -59.4 47.1 50.3 -1.261 0.2132
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_cc_treats <- mixed(
MBIO_C ~ cc_treatment_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_treatment_f
## Warning: Due to missing values, reduced number of observations to 54
# Nice ANOVA table
print(nice(anova_kr_mbc_cc_treats), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ cc_treatment_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_treatment_f 1, 50.32 1.59 .213
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_cc_treats <- anova_kr_mbc_cc_treats$Anova
car_table_mbc_cc_treats # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.cc_treats <- emmeans(model_mbc_cc_treats, "cc_treatment")
pairs(MBIO_C.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc -59.4 47.1 50.3 -1.261 0.2132
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_C.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_treatment emmean SE df lower.CL upper.CL .group
## covercrop 146 51.4 2.01 -168.55 460 a
## no_cc 205 67.1 5.69 3.06 407 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Cover crop class (mix, mono, control) was found to be NOT significant (p = 0.30) using a linear mixed-effects model with MBC as the response variable, cc_class as the fixed effect, and (1 / year) as the random intercept.
model_mbc_cc_c <- lmer(MBIO_C ~ cc_class + (1 | year), data = dat)
# Summarize the model results
summary(model_mbc_cc_c)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ cc_class + (1 | year)
## Data: dat
##
## REML criterion at convergence: 615
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2309 -0.4667 -0.1189 0.6235 2.4824
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 7344 85.70
## Residual 7785 88.23
## Number of obs: 54, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 138.033 51.758 2.077 2.667 0.112
## cc_classmono 25.305 27.244 48.970 0.929 0.358
## cc_classnone 66.619 47.661 49.262 1.398 0.168
##
## Correlation of Fixed Effects:
## (Intr) cc_clssm
## cc_classmon -0.156
## cc_classnon -0.098 0.164
# Extract fixed effects
fixef(model_mbc_cc_c)
## (Intercept) cc_classmono cc_classnone
## 138.03274 25.30463 66.61939
# Extract random effects (conditional modes)
ranef(model_mbc_cc_c)
## $year
## (Intercept)
## 2021 41.92875
## 2022 -95.70949
## 2023 53.78074
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_cc_c) # residuals vs fitted
qqnorm(resid(model_mbc_cc_c)); qqline(resid(model_mbc_cc_c)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_class as a factor for pairwise comparisons
dat$cc_class_f <- factor(dat$cc_class)
lmer_model_mbc_cc_c_factor <- lmer(MBIO_C ~ cc_class_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_class_f` factor.
emmeans_mbc_cc_c_result <- emmeans(lmer_model_mbc_cc_c_factor, pairwise ~ cc_class_f, adjust = "tukey")
# View the results
emmeans_mbc_cc_c_result
## $emmeans
## cc_class_f emmean SE df lower.CL upper.CL
## mixed 138 51.8 2.12 -73.4 349
## mono 163 54.6 2.62 -25.8 352
## none 205 66.9 5.74 39.2 370
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## mixed - mono -25.3 27.2 49.0 -0.929 0.6249
## mixed - none -66.6 47.8 49.3 -1.393 0.3522
## mono - none -41.3 51.0 49.3 -0.810 0.6989
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_cc_c <- mixed(
MBIO_C ~ cc_class_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_class_f
## Warning: Due to missing values, reduced number of observations to 54
# Nice ANOVA table
print(nice(anova_kr_mbc_cc_c), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ cc_class_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_class_f 2, 49.16 1.22 .303
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_cc_c <- anova_kr_mbc_cc_c$Anova
car_table_mbc_cc_c # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.cc_c <- emmeans(model_mbc_cc_c, "cc_class")
pairs(MBIO_C.emm.s.cc_c, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## mixed - mono -25.3 27.2 49.0 -0.929 0.6249
## mixed - none -66.6 47.8 49.3 -1.393 0.3522
## mono - none -41.3 51.0 49.3 -0.810 0.6989
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
cld(MBIO_C.emm.s.cc_c, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_class emmean SE df lower.CL upper.CL .group
## mixed 138 51.8 2.12 -225.0 501 a
## mono 163 54.6 2.62 -135.7 462 a
## none 205 66.9 5.74 -17.8 427 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 3 estimates
## P value adjustment: tukey method for comparing a family of 3 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Cover crop type was found to be weakly significant (p = 0.06) using a linear mixed-effects model with MBC as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_mbc_cc <- lmer(MBIO_C ~ cc_type + (1 | year), data = cc_nocntrl)
# Summarize the model results
summary(model_mbc_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ cc_type + (1 | year)
## Data: cc_nocntrl
##
## REML criterion at convergence: 486.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.06143 -0.59944 0.00812 0.54062 2.50601
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 5680 75.37
## Residual 6638 81.48
## Number of obs: 50, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 231.173 54.771 4.127 4.221 0.01261 *
## cc_typeoat-clover -94.391 49.473 37.970 -1.908 0.06398 .
## cc_typeoat-vetch 2.472 58.491 38.134 0.042 0.96651
## cc_typeradish -167.530 49.473 37.970 -3.386 0.00166 **
## cc_typeradish-oat -108.866 47.040 37.929 -2.314 0.02616 *
## cc_typeradish-rye -110.150 49.473 37.970 -2.226 0.03199 *
## cc_typeradish-vetch -100.982 49.473 37.970 -2.041 0.04823 *
## cc_typerye -36.029 53.386 38.145 -0.675 0.50382
## cc_typerye-clover -73.511 49.473 37.970 -1.486 0.14557
## cc_typerye-vetch -108.117 47.040 37.929 -2.298 0.02714 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typrd cc_typrdsh-t cc_typrdsh-r
## cc_typt-clv -0.408
## cc_typt-vtc -0.345 0.394
## cc_typerdsh -0.408 0.458 0.394
## cc_typrdsh-t -0.429 0.475 0.402 0.475
## cc_typrdsh-r -0.408 0.458 0.394 0.458 0.475
## cc_typrdsh-v -0.408 0.458 0.394 0.458 0.475 0.458
## cc_typerye -0.378 0.432 0.381 0.432 0.441 0.432
## cc_typry-cl -0.408 0.458 0.394 0.458 0.475 0.458
## cc_typry-vt -0.429 0.475 0.402 0.475 0.500 0.475
## cc_typrdsh-v cc_typry cc_typry-c
## cc_typt-clv
## cc_typt-vtc
## cc_typerdsh
## cc_typrdsh-t
## cc_typrdsh-r
## cc_typrdsh-v
## cc_typerye 0.432
## cc_typry-cl 0.458 0.432
## cc_typry-vt 0.475 0.441 0.475
# Extract fixed effects
fixef(model_mbc_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typeradish
## 231.173500 -94.390875 2.471988 -167.530075
## cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch cc_typerye
## -108.866000 -110.149675 -100.981675 -36.028687
## cc_typerye-clover cc_typerye-vetch
## -73.510675 -108.117333
# Extract random effects (conditional modes)
ranef(model_mbc_cc)
## $year
## (Intercept)
## 2021 40.65321
## 2022 -83.78387
## 2023 43.13066
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_cc) # residuals vs fitted
qqnorm(resid(model_mbc_cc)); qqline(resid(model_mbc_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
cc_nocntrl$cc_type_f <- factor(cc_nocntrl$cc_type)
lmer_model_mbc_cc_factor <- lmer(MBIO_C ~ cc_type_f + (1 | year), data = cc_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_mbc_cc_result <- emmeans(lmer_model_mbc_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_mbc_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 231.2 54.8 4.27 82.8 380
## oat-clover 136.8 56.9 4.92 -10.2 284
## oat-vetch 233.6 65.0 7.96 83.6 384
## radish 63.6 56.9 4.92 -83.3 211
## radish-oat 122.3 54.8 4.27 -26.1 271
## radish-rye 121.0 56.9 4.92 -25.9 268
## radish-vetch 130.2 56.9 4.92 -16.7 277
## rye 195.1 60.4 6.10 47.8 342
## rye-clover 157.7 56.9 4.92 10.7 305
## rye-vetch 123.1 54.8 4.27 -25.3 271
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 94.391 49.5 38.0 1.907 0.6646
## oat - (oat-vetch) -2.472 58.7 38.2 -0.042 1.0000
## oat - radish 167.530 49.5 38.0 3.384 0.0468
## oat - (radish-oat) 108.866 47.0 38.0 2.314 0.4036
## oat - (radish-rye) 110.150 49.5 38.0 2.225 0.4581
## oat - (radish-vetch) 100.982 49.5 38.0 2.040 0.5779
## oat - rye 36.029 53.5 38.2 0.673 0.9995
## oat - (rye-clover) 73.511 49.5 38.0 1.485 0.8897
## oat - (rye-vetch) 108.117 47.0 38.0 2.298 0.4131
## (oat-clover) - (oat-vetch) -96.863 60.0 38.1 -1.615 0.8327
## (oat-clover) - radish 73.139 51.5 38.0 1.419 0.9134
## (oat-clover) - (radish-oat) 14.475 49.5 38.0 0.292 1.0000
## (oat-clover) - (radish-rye) 15.759 51.5 38.0 0.306 1.0000
## (oat-clover) - (radish-vetch) 6.591 51.5 38.0 0.128 1.0000
## (oat-clover) - rye -58.362 55.0 38.1 -1.061 0.9857
## (oat-clover) - (rye-clover) -20.880 51.5 38.0 -0.405 1.0000
## (oat-clover) - (rye-vetch) 13.726 49.5 38.0 0.277 1.0000
## (oat-vetch) - radish 170.002 60.0 38.1 2.835 0.1612
## (oat-vetch) - (radish-oat) 111.338 58.7 38.2 1.898 0.6701
## (oat-vetch) - (radish-rye) 112.622 60.0 38.1 1.878 0.6831
## (oat-vetch) - (radish-vetch) 103.454 60.0 38.1 1.725 0.7748
## (oat-vetch) - rye 38.501 62.4 38.0 0.617 0.9998
## (oat-vetch) - (rye-clover) 75.983 60.0 38.1 1.267 0.9551
## (oat-vetch) - (rye-vetch) 110.589 58.7 38.2 1.885 0.6782
## radish - (radish-oat) -58.664 49.5 38.0 -1.185 0.9703
## radish - (radish-rye) -57.380 51.5 38.0 -1.114 0.9802
## radish - (radish-vetch) -66.548 51.5 38.0 -1.291 0.9496
## radish - rye -131.501 55.0 38.1 -2.392 0.3587
## radish - (rye-clover) -94.019 51.5 38.0 -1.825 0.7162
## radish - (rye-vetch) -59.413 49.5 38.0 -1.200 0.9678
## (radish-oat) - (radish-rye) 1.284 49.5 38.0 0.026 1.0000
## (radish-oat) - (radish-vetch) -7.884 49.5 38.0 -0.159 1.0000
## (radish-oat) - rye -72.837 53.5 38.2 -1.360 0.9317
## (radish-oat) - (rye-clover) -35.355 49.5 38.0 -0.714 0.9992
## (radish-oat) - (rye-vetch) -0.749 47.0 38.0 -0.016 1.0000
## (radish-rye) - (radish-vetch) -9.168 51.5 38.0 -0.178 1.0000
## (radish-rye) - rye -74.121 55.0 38.1 -1.348 0.9352
## (radish-rye) - (rye-clover) -36.639 51.5 38.0 -0.711 0.9993
## (radish-rye) - (rye-vetch) -2.032 49.5 38.0 -0.041 1.0000
## (radish-vetch) - rye -64.953 55.0 38.1 -1.181 0.9709
## (radish-vetch) - (rye-clover) -27.471 51.5 38.0 -0.533 0.9999
## (radish-vetch) - (rye-vetch) 7.136 49.5 38.0 0.144 1.0000
## rye - (rye-clover) 37.482 55.0 38.1 0.682 0.9995
## rye - (rye-vetch) 72.089 53.5 38.2 1.346 0.9357
## (rye-clover) - (rye-vetch) 34.607 49.5 38.0 0.699 0.9994
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_cc <- mixed(
MBIO_C ~ cc_type_f + (1 | year),
data = cc_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
## Warning: Due to missing values, reduced number of observations to 50
# Nice ANOVA table
print(nice(anova_kr_mbc_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ cc_type_f + (1 | year)
## Data: cc_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 38.05 2.03 + .062
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_cc <- anova_kr_mbc_cc$Anova
car_table_mbc_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.cc <- emmeans(model_mbc_cc, "cc_type")
pairs(MBIO_C.emm.s.cc, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 94.391 49.5 38.0 1.907 0.6646
## oat - (oat-vetch) -2.472 58.7 38.2 -0.042 1.0000
## oat - radish 167.530 49.5 38.0 3.384 0.0468
## oat - (radish-oat) 108.866 47.0 38.0 2.314 0.4036
## oat - (radish-rye) 110.150 49.5 38.0 2.225 0.4581
## oat - (radish-vetch) 100.982 49.5 38.0 2.040 0.5779
## oat - rye 36.029 53.5 38.2 0.673 0.9995
## oat - (rye-clover) 73.511 49.5 38.0 1.485 0.8897
## oat - (rye-vetch) 108.117 47.0 38.0 2.298 0.4131
## (oat-clover) - (oat-vetch) -96.863 60.0 38.1 -1.615 0.8327
## (oat-clover) - radish 73.139 51.5 38.0 1.419 0.9134
## (oat-clover) - (radish-oat) 14.475 49.5 38.0 0.292 1.0000
## (oat-clover) - (radish-rye) 15.759 51.5 38.0 0.306 1.0000
## (oat-clover) - (radish-vetch) 6.591 51.5 38.0 0.128 1.0000
## (oat-clover) - rye -58.362 55.0 38.1 -1.061 0.9857
## (oat-clover) - (rye-clover) -20.880 51.5 38.0 -0.405 1.0000
## (oat-clover) - (rye-vetch) 13.726 49.5 38.0 0.277 1.0000
## (oat-vetch) - radish 170.002 60.0 38.1 2.835 0.1612
## (oat-vetch) - (radish-oat) 111.338 58.7 38.2 1.898 0.6701
## (oat-vetch) - (radish-rye) 112.622 60.0 38.1 1.878 0.6831
## (oat-vetch) - (radish-vetch) 103.454 60.0 38.1 1.725 0.7748
## (oat-vetch) - rye 38.501 62.4 38.0 0.617 0.9998
## (oat-vetch) - (rye-clover) 75.983 60.0 38.1 1.267 0.9551
## (oat-vetch) - (rye-vetch) 110.589 58.7 38.2 1.885 0.6782
## radish - (radish-oat) -58.664 49.5 38.0 -1.185 0.9703
## radish - (radish-rye) -57.380 51.5 38.0 -1.114 0.9802
## radish - (radish-vetch) -66.548 51.5 38.0 -1.291 0.9496
## radish - rye -131.501 55.0 38.1 -2.392 0.3587
## radish - (rye-clover) -94.019 51.5 38.0 -1.825 0.7162
## radish - (rye-vetch) -59.413 49.5 38.0 -1.200 0.9678
## (radish-oat) - (radish-rye) 1.284 49.5 38.0 0.026 1.0000
## (radish-oat) - (radish-vetch) -7.884 49.5 38.0 -0.159 1.0000
## (radish-oat) - rye -72.837 53.5 38.2 -1.360 0.9317
## (radish-oat) - (rye-clover) -35.355 49.5 38.0 -0.714 0.9992
## (radish-oat) - (rye-vetch) -0.749 47.0 38.0 -0.016 1.0000
## (radish-rye) - (radish-vetch) -9.168 51.5 38.0 -0.178 1.0000
## (radish-rye) - rye -74.121 55.0 38.1 -1.348 0.9352
## (radish-rye) - (rye-clover) -36.639 51.5 38.0 -0.711 0.9993
## (radish-rye) - (rye-vetch) -2.032 49.5 38.0 -0.041 1.0000
## (radish-vetch) - rye -64.953 55.0 38.1 -1.181 0.9709
## (radish-vetch) - (rye-clover) -27.471 51.5 38.0 -0.533 0.9999
## (radish-vetch) - (rye-vetch) 7.136 49.5 38.0 0.144 1.0000
## rye - (rye-clover) 37.482 55.0 38.1 0.682 0.9995
## rye - (rye-vetch) 72.089 53.5 38.2 1.346 0.9357
## (rye-clover) - (rye-vetch) 34.607 49.5 38.0 0.699 0.9994
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
cld(MBIO_C.emm.s.cc, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 63.6 56.9 4.92 -209.0 336 a
## radish-rye 121.0 56.9 4.92 -151.7 394 ab
## radish-oat 122.3 54.8 4.27 -167.3 412 ab
## rye-vetch 123.1 54.8 4.27 -166.6 413 ab
## radish-vetch 130.2 56.9 4.92 -142.5 403 ab
## oat-clover 136.8 56.9 4.92 -135.9 409 ab
## rye-clover 157.7 56.9 4.92 -115.0 430 ab
## rye 195.1 60.4 6.10 -62.4 453 ab
## oat 231.2 54.8 4.27 -58.4 521 b
## oat-vetch 233.6 65.0 7.96 -15.0 482 ab
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 10 estimates
## P value adjustment: tukey method for comparing a family of 10 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Within the plots using pecan agroforestry, cover crop type was found to be NOT significant (p = 0.16) using a linear mixed-effects model with MBC as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_mbc_pec_cc <- lmer(MBIO_C ~ cc_type + (1 | year), data = datPEC)
# Summarize the model results
summary(model_mbc_pec_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ cc_type + (1 | year)
## Data: datPEC
##
## REML criterion at convergence: 278.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.5268 -0.4860 -0.1144 0.5284 2.0127
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 8146 90.25
## Residual 5744 75.79
## Number of obs: 29, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 231.174 60.601 2.972 3.815 0.0322 *
## cc_typeoat-clover -96.975 46.125 20.966 -2.102 0.0478 *
## cc_typeoat-vetch -10.949 55.073 21.147 -0.199 0.8443
## cc_typerye -42.488 50.278 21.164 -0.845 0.4075
## cc_typerye-clover -76.094 46.125 20.966 -1.650 0.1139
## cc_typerye-vetch -108.117 43.755 20.919 -2.471 0.0222 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typ cc_typry-c
## cc_typt-clv -0.342
## cc_typt-vtc -0.287 0.398
## cc_typerye -0.314 0.436 0.394
## cc_typry-cl -0.342 0.460 0.398 0.436
## cc_typry-vt -0.361 0.474 0.397 0.435 0.474
# Extract fixed effects
fixef(model_mbc_pec_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typerye
## 231.17350 -96.97458 -10.94924 -42.48794
## cc_typerye-clover cc_typerye-vetch
## -76.09438 -108.11733
# Extract random effects (conditional modes)
ranef(model_mbc_pec_cc)
## $year
## (Intercept)
## 2021 26.22655
## 2022 -96.70238
## 2023 70.47583
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_pec_cc) # residuals vs fitted
qqnorm(resid(model_mbc_pec_cc)); qqline(resid(model_mbc_pec_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPEC$cc_type_f <- factor(datPEC$cc_type)
lmer_model_mbc_pec_cc_factor <- lmer(MBIO_C ~ cc_type_f + (1 | year), data = datPEC)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_mbc_pec_cc_result <- emmeans(lmer_model_mbc_pec_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_mbc_pec_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 231 60.6 3.09 41.38 421
## oat-clover 134 62.4 3.44 -50.74 319
## oat-vetch 220 69.5 5.04 42.13 398
## rye 189 65.7 4.11 8.17 369
## rye-clover 155 62.4 3.44 -29.86 340
## rye-vetch 123 60.6 3.09 -66.74 313
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 97.0 46.2 21.1 2.100 0.3247
## oat - (oat-vetch) 10.9 55.4 21.2 0.198 1.0000
## oat - rye 42.5 50.6 21.2 0.840 0.9564
## oat - (rye-clover) 76.1 46.2 21.1 1.648 0.5782
## oat - (rye-vetch) 108.1 43.8 21.0 2.471 0.1778
## (oat-clover) - (oat-vetch) -86.0 56.2 21.1 -1.532 0.6487
## (oat-clover) - rye -54.5 51.4 21.1 -1.060 0.8917
## (oat-clover) - (rye-clover) -20.9 47.9 21.0 -0.436 0.9977
## (oat-clover) - (rye-vetch) 11.1 46.2 21.1 0.241 0.9999
## (oat-vetch) - rye 31.5 58.1 21.0 0.542 0.9936
## (oat-vetch) - (rye-clover) 65.1 56.2 21.1 1.160 0.8503
## (oat-vetch) - (rye-vetch) 97.2 55.4 21.2 1.754 0.5136
## rye - (rye-clover) 33.6 51.4 21.1 0.654 0.9852
## rye - (rye-vetch) 65.6 50.6 21.2 1.297 0.7832
## (rye-clover) - (rye-vetch) 32.0 46.2 21.1 0.693 0.9807
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_pec_cc <- mixed(
MBIO_C ~ cc_type_f + (1 | year),
data = datPEC,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
## Warning: Due to missing values, reduced number of observations to 29
# Nice ANOVA table
print(nice(anova_kr_mbc_pec_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ cc_type_f + (1 | year)
## Data: datPEC
## Effect df F p.value
## 1 cc_type_f 5, 21.09 1.80 .156
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_pec_cc <- anova_kr_mbc_pec_cc$Anova
car_table_mbc_pec_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.cc_pec <- emmeans(model_mbc_pec_cc, "cc_type")
pairs(MBIO_C.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 97.0 46.2 21.1 2.100 0.3247
## oat - (oat-vetch) 10.9 55.4 21.2 0.198 1.0000
## oat - rye 42.5 50.6 21.2 0.840 0.9564
## oat - (rye-clover) 76.1 46.2 21.1 1.648 0.5782
## oat - (rye-vetch) 108.1 43.8 21.0 2.471 0.1778
## (oat-clover) - (oat-vetch) -86.0 56.2 21.1 -1.532 0.6487
## (oat-clover) - rye -54.5 51.4 21.1 -1.060 0.8917
## (oat-clover) - (rye-clover) -20.9 47.9 21.0 -0.436 0.9977
## (oat-clover) - (rye-vetch) 11.1 46.2 21.1 0.241 0.9999
## (oat-vetch) - rye 31.5 58.1 21.0 0.542 0.9936
## (oat-vetch) - (rye-clover) 65.1 56.2 21.1 1.160 0.8503
## (oat-vetch) - (rye-vetch) 97.2 55.4 21.2 1.754 0.5136
## rye - (rye-clover) 33.6 51.4 21.1 0.654 0.9852
## rye - (rye-vetch) 65.6 50.6 21.2 1.297 0.7832
## (rye-clover) - (rye-vetch) 32.0 46.2 21.1 0.693 0.9807
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
cld(MBIO_C.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## rye-vetch 123 60.6 3.09 -241 487 a
## oat-clover 134 62.4 3.44 -205 473 a
## rye-clover 155 62.4 3.44 -184 494 a
## rye 189 65.7 4.11 -122 500 a
## oat-vetch 220 69.5 5.04 -70 510 a
## oat 231 60.6 3.09 -133 595 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 6 estimates
## P value adjustment: tukey method for comparing a family of 6 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 7 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 7 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Within the plots using pine agroforestry, cover crop type was found to be NOT significant (p = 0.58) using a linear mixed-effects model with MBC as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_mbc_pin_cc <- lmer(MBIO_C ~ cc_type + (1 | year), data = datPIN)
# Summarize the model results
summary(model_mbc_pin_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ cc_type + (1 | year)
## Data: datPIN
##
## REML criterion at convergence: 207.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.27393 -0.49644 -0.08442 0.55311 2.28151
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 3812 61.74
## Residual 6673 81.69
## Number of obs: 21, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 69.08 51.28 4.86 1.347 0.237
## cc_typeradish-oat 53.23 49.71 15.00 1.071 0.301
## cc_typeradish-rye 57.38 51.67 14.90 1.111 0.284
## cc_typeradish-vetch 66.55 51.67 14.90 1.288 0.217
##
## Correlation of Fixed Effects:
## (Intr) cc_typrdsh-t cc_typrdsh-r
## cc_typrdsh-t -0.533
## cc_typrdsh-r -0.504 0.520
## cc_typrdsh-v -0.504 0.520 0.500
# Extract fixed effects
fixef(model_mbc_pin_cc)
## (Intercept) cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch
## 69.07515 53.23235 57.38040 66.54840
# Extract random effects (conditional modes)
ranef(model_mbc_pin_cc)
## $year
## (Intercept)
## 2021 53.023257
## 2022 -56.625253
## 2023 3.601996
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_pin_cc) # residuals vs fitted
qqnorm(resid(model_mbc_pin_cc)); qqline(resid(model_mbc_pin_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPIN$cc_type_f <- factor(datPIN$cc_type)
lmer_model_mbc_pin_cc_factor <- lmer(MBIO_C ~ cc_type_f + (1 | year), data = datPIN)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_mbc_pin_cc_result <- emmeans(lmer_model_mbc_pin_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_mbc_pin_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## radish 69.1 51.4 5.05 -62.73 201
## radish-oat 122.3 48.8 4.27 -9.86 254
## radish-rye 126.5 51.4 5.05 -5.35 258
## radish-vetch 135.6 51.4 5.05 3.82 267
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -53.23 49.9 15.1 -1.067 0.7137
## radish - (radish-rye) -57.38 51.7 15.0 -1.111 0.6888
## radish - (radish-vetch) -66.55 51.7 15.0 -1.288 0.5839
## (radish-oat) - (radish-rye) -4.15 49.9 15.1 -0.083 0.9998
## (radish-oat) - (radish-vetch) -13.32 49.9 15.1 -0.267 0.9931
## (radish-rye) - (radish-vetch) -9.17 51.7 15.0 -0.177 0.9979
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_pin_cc <- mixed(
MBIO_C ~ cc_type_f + (1 | year),
data = datPIN,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
## Warning: Due to missing values, reduced number of observations to 21
# Nice ANOVA table
print(nice(anova_kr_mbc_pin_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ cc_type_f + (1 | year)
## Data: datPIN
## Effect df F p.value
## 1 cc_type_f 3, 15.05 0.68 .578
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_pin_cc <- anova_kr_mbc_pin_cc$Anova
car_table_mbc_pin_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.cc_pin <- emmeans(model_mbc_pin_cc, "cc_type")
pairs(MBIO_C.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -53.23 49.9 15.1 -1.067 0.7137
## radish - (radish-rye) -57.38 51.7 15.0 -1.111 0.6888
## radish - (radish-vetch) -66.55 51.7 15.0 -1.288 0.5839
## (radish-oat) - (radish-rye) -4.15 49.9 15.1 -0.083 0.9998
## (radish-oat) - (radish-vetch) -13.32 49.9 15.1 -0.267 0.9931
## (radish-rye) - (radish-vetch) -9.17 51.7 15.0 -0.177 0.9979
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
cld(MBIO_C.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 69.1 51.4 5.05 -125.0 263 a
## radish-oat 122.3 48.8 4.27 -78.8 323 a
## radish-rye 126.5 51.4 5.05 -67.6 320 a
## radish-vetch 135.6 51.4 5.05 -58.4 330 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: tukey method for comparing a family of 4 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 3 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 3 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Tillage was found to be significant (p = 0.04) using a linear mixed-effects model with MBC as the response variable, tillage as the fixed effect, and (1 / year) as the random intercept.
model_mbc_till <- lmer(MBIO_C ~ tillage + (1 | year), data = till_nocntrl)
# Summarize the model results
summary(model_mbc_till)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ tillage + (1 | year)
## Data: till_nocntrl
##
## REML criterion at convergence: 575.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.8317 -0.6356 -0.1706 0.5960 2.3773
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 5576 74.67
## Residual 7434 86.22
## Number of obs: 50, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 123.401 46.347 2.186 2.663 0.1065
## tillageno_till 51.028 24.583 46.069 2.076 0.0435 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## tillagn_tll -0.247
# Extract fixed effects
fixef(model_mbc_till)
## (Intercept) tillageno_till
## 123.40063 51.02797
# Extract random effects (conditional modes)
ranef(model_mbc_till)
## $year
## (Intercept)
## 2021 37.40922
## 2022 -82.59662
## 2023 45.18740
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_till) # residuals vs fitted
qqnorm(resid(model_mbc_till)); qqline(resid(model_mbc_till)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with tillage as a factor for pairwise comparisons
till_nocntrl$tillage_f <- factor(till_nocntrl$tillage)
lmer_model_mbc_till_factor <- lmer(MBIO_C ~ tillage_f + (1 | year), data = till_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ tillage_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `tillage_f` factor.
emmeans_mbc_till_result <- emmeans(lmer_model_mbc_till_factor, pairwise ~ tillage_f, adjust = "tukey")
# View the results
emmeans_mbc_till_result
## $emmeans
## tillage_f emmean SE df lower.CL upper.CL
## min_till 123 46.4 2.26 -55.45 302
## no_till 174 46.9 2.35 -1.08 350
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## min_till - no_till -51 24.6 46.1 -2.073 0.0438
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_till <- mixed(
MBIO_C ~ tillage_f + (1 | year),
data = till_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: tillage_f
## Warning: Due to missing values, reduced number of observations to 50
# Nice ANOVA table
print(nice(anova_kr_mbc_till), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ tillage_f + (1 | year)
## Data: till_nocntrl
## Effect df F p.value
## 1 tillage_f 1, 46.13 4.30 * .044
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbc_till <- anova_kr_mbc_till$Anova
car_table_mbc_till # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_C.emm.s.till <- emmeans(model_mbc_till, "tillage")
pairs(MBIO_C.emm.s.till, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## min_till - no_till -51 24.6 46.1 -2.073 0.0438
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_C.emm.s.till, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## tillage emmean SE df lower.CL upper.CL .group
## min_till 123 46.4 2.26 -124.4 371 a
## no_till 174 46.9 2.35 -66.5 415 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 10 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
The interaction between agroforestry tree type and tillage was found to be NOT significant (p = 0.26) using a linear mixed-effects model with MBC as the response variable, agro_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbc_agtil <- lmer(MBIO_C ~ agro_type*tillage + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_mbc_agtil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ agro_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 549.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.78393 -0.74199 -0.06551 0.51595 2.29803
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 5495 74.13
## Residual 6422 80.14
## Number of obs: 50, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 161.601 47.576 2.556 3.397 0.05404 .
## agro_typepine -90.175 31.822 43.942 -2.834 0.00692 **
## tillageno_till 28.451 29.971 44.040 0.949 0.34766
## agro_typepine:tillageno_till 52.772 45.992 43.947 1.147 0.25742
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) agr_ty tllgn_
## agro_typepn -0.283
## tillagn_tll -0.297 0.449
## agr_typpn:_ 0.195 -0.692 -0.647
# Extract fixed effects
fixef(model_mbc_agtil)
## (Intercept) agro_typepine
## 161.60071 -90.17547
## tillageno_till agro_typepine:tillageno_till
## 28.45061 52.77228
# Extract random effects (conditional modes)
ranef(model_mbc_agtil)
## $year
## (Intercept)
## 2021 38.22441
## 2022 -82.44438
## 2023 44.21997
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_agtil) # residuals vs fitted
qqnorm(resid(model_mbc_agtil)); qqline(resid(model_mbc_agtil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_mbc_agtil_factor <- lmer(MBIO_C ~ agro_type_f*tillage_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_mbc_agtil_result <- emmeans(lmer_model_mbc_agtil_factor, pairwise ~ agro_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_mbc_agtil_result
## $emmeans
## agro_type_f tillage_f emmean SE df lower.CL upper.CL
## pecan min_till 161.6 47.6 2.64 -2.41 326
## pine min_till 71.4 49.2 3.00 -84.98 228
## pecan no_till 190.1 48.2 2.75 28.61 351
## pine no_till 152.6 49.9 3.17 -1.40 307
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan min_till - pine min_till 90.18 31.8 44.0 2.834 0.0337
## pecan min_till - pecan no_till -28.45 30.0 44.1 -0.948 0.7791
## pecan min_till - pine no_till 8.95 32.8 44.0 0.273 0.9928
## pine min_till - pecan no_till -118.63 32.5 44.1 -3.650 0.0037
## pine min_till - pine no_till -81.22 35.1 44.0 -2.316 0.1099
## pecan no_till - pine no_till 37.40 33.2 44.0 1.126 0.6757
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_agtil <- mixed(
MBIO_C ~ agro_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f, tillage
## Warning: Due to missing values, reduced number of observations to 50
# Nice ANOVA table
print(nice(anova_kr_mbc_agtil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ agro_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 44.01 7.69 ** .008
## 2 tillage 1, 44.10 5.61 * .022
## 3 agro_type_f:tillage 1, 44.01 1.32 .257
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
The interaction between cover crop type and tillage was found to be NOT significant (p = 0.35) using a linear mixed-effects model with MBC as the response variable, cc_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbc_cctil <- lmer(MBIO_C ~ cc_type*tillage + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_mbc_cctil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_C ~ cc_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 368.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.1937 -0.6144 -0.1186 0.5341 1.6200
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 6670 81.67
## Residual 5853 76.50
## Number of obs: 50, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) 247.713 64.608 5.827 3.834
## cc_typeoat-clover -116.678 62.466 27.935 -1.868
## cc_typeoat-vetch -122.221 89.628 28.030 -1.364
## cc_typeradish -191.930 62.466 27.935 -3.073
## cc_typeradish-oat -152.006 62.466 27.935 -2.433
## cc_typeradish-rye -143.681 62.466 27.935 -2.300
## cc_typeradish-vetch -242.619 70.424 28.009 -3.445
## cc_typerye -55.347 70.424 28.009 -0.786
## cc_typerye-clover -74.598 62.466 27.935 -1.194
## cc_typerye-vetch -166.382 62.466 27.935 -2.664
## tillageno_till -33.078 62.466 27.935 -0.530
## cc_typeoat-clover:tillageno_till 43.654 94.136 27.976 0.464
## cc_typeoat-vetch:tillageno_till 188.330 113.263 27.965 1.663
## cc_typeradish:tillageno_till 48.936 94.136 27.976 0.520
## cc_typeradish-oat:tillageno_till 86.280 88.340 27.935 0.977
## cc_typeradish-rye:tillageno_till 71.765 94.136 27.976 0.762
## cc_typeradish-vetch:tillageno_till 239.046 94.136 27.976 2.539
## cc_typerye:tillageno_till 31.050 98.767 27.935 0.314
## cc_typerye-clover:tillageno_till -9.344 94.136 27.976 -0.099
## cc_typerye-vetch:tillageno_till 116.529 88.340 27.935 1.319
## Pr(>|t|)
## (Intercept) 0.00911 **
## cc_typeoat-clover 0.07230 .
## cc_typeoat-vetch 0.18353
## cc_typeradish 0.00470 **
## cc_typeradish-oat 0.02161 *
## cc_typeradish-rye 0.02912 *
## cc_typeradish-vetch 0.00182 **
## cc_typerye 0.43852
## cc_typerye-clover 0.24243
## cc_typerye-vetch 0.01269 *
## tillageno_till 0.60061
## cc_typeoat-clover:tillageno_till 0.64643
## cc_typeoat-vetch:tillageno_till 0.10753
## cc_typeradish:tillageno_till 0.60726
## cc_typeradish-oat:tillageno_till 0.33711
## cc_typeradish-rye:tillageno_till 0.45222
## cc_typeradish-vetch:tillageno_till 0.01695 *
## cc_typerye:tillageno_till 0.75557
## cc_typerye-clover:tillageno_till 0.92164
## cc_typerye-vetch:tillageno_till 0.19785
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
# Extract fixed effects
fixef(model_mbc_cctil)
## (Intercept) cc_typeoat-clover
## 247.712667 -116.677667
## cc_typeoat-vetch cc_typeradish
## -122.221134 -191.929667
## cc_typeradish-oat cc_typeradish-rye
## -152.006000 -143.681000
## cc_typeradish-vetch cc_typerye
## -242.619038 -55.347038
## cc_typerye-clover cc_typerye-vetch
## -74.598333 -166.381667
## tillageno_till cc_typeoat-clover:tillageno_till
## -33.078333 43.653962
## cc_typeoat-vetch:tillageno_till cc_typeradish:tillageno_till
## 188.329930 48.935962
## cc_typeradish-oat:tillageno_till cc_typeradish-rye:tillageno_till
## 86.280000 71.765295
## cc_typeradish-vetch:tillageno_till cc_typerye:tillageno_till
## 239.046371 31.049833
## cc_typerye-clover:tillageno_till cc_typerye-vetch:tillageno_till
## -9.343871 116.528667
# Extract random effects (conditional modes)
ranef(model_mbc_cctil)
## $year
## (Intercept)
## 2021 41.86828
## 2022 -91.37074
## 2023 49.50247
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbc_cctil) # residuals vs fitted
qqnorm(resid(model_mbc_cctil)); qqline(resid(model_mbc_cctil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$cc_type_f <- factor(ag_nocntrl$cc_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_mbc_cctil_factor <- lmer(MBIO_C ~ cc_type_f*tillage_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_mbc_cctil_result <- emmeans(lmer_model_mbc_cctil_factor, pairwise ~ cc_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_mbc_cctil_result
## $emmeans
## cc_type_f tillage_f emmean SE df lower.CL upper.CL
## oat min_till 247.71 64.6 5.99 89.57 406
## oat-clover min_till 131.03 64.6 5.99 -27.10 289
## oat-vetch min_till 125.49 91.3 16.92 -67.19 318
## radish min_till 55.78 64.6 5.99 -102.36 214
## radish-oat min_till 95.71 64.6 5.99 -62.43 254
## radish-rye min_till 104.03 64.6 5.99 -54.11 262
## radish-vetch min_till 5.09 72.4 8.83 -159.21 169
## rye min_till 192.37 72.4 8.83 28.06 357
## rye-clover min_till 173.11 64.6 5.99 14.98 331
## rye-vetch min_till 81.33 64.6 5.99 -76.81 239
## oat no_till 214.63 64.6 5.99 56.50 373
## oat-clover no_till 141.61 72.4 8.83 -22.70 306
## oat-vetch no_till 280.74 72.4 8.83 116.44 445
## radish no_till 71.64 72.4 8.83 -92.67 236
## radish-oat no_till 148.91 64.6 5.99 -9.23 307
## radish-rye no_till 142.72 72.4 8.83 -21.59 307
## radish-vetch no_till 211.06 64.6 5.99 52.92 369
## rye no_till 190.34 72.4 8.83 26.03 355
## rye-clover no_till 130.69 72.4 8.83 -33.62 295
## rye-vetch no_till 164.78 64.6 5.99 6.64 323
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## oat min_till - (oat-clover min_till) 116.678 62.5 28.0 1.868
## oat min_till - (oat-vetch min_till) 122.221 89.8 28.1 1.361
## oat min_till - radish min_till 191.930 62.5 28.0 3.073
## oat min_till - (radish-oat min_till) 152.006 62.5 28.0 2.433
## oat min_till - (radish-rye min_till) 143.681 62.5 28.0 2.300
## oat min_till - (radish-vetch min_till) 242.619 70.5 28.1 3.440
## oat min_till - rye min_till 55.347 70.5 28.1 0.785
## oat min_till - (rye-clover min_till) 74.598 62.5 28.0 1.194
## oat min_till - (rye-vetch min_till) 166.382 62.5 28.0 2.664
## oat min_till - oat no_till 33.078 62.5 28.0 0.530
## oat min_till - (oat-clover no_till) 106.102 70.5 28.1 1.505
## oat min_till - (oat-vetch no_till) -33.030 70.5 28.1 -0.468
## oat min_till - radish no_till 176.072 70.5 28.1 2.497
## oat min_till - (radish-oat no_till) 98.804 62.5 28.0 1.582
## oat min_till - (radish-rye no_till) 104.994 70.5 28.1 1.489
## oat min_till - (radish-vetch no_till) 36.651 62.5 28.0 0.587
## oat min_till - rye no_till 57.376 70.5 28.1 0.814
## oat min_till - (rye-clover no_till) 117.021 70.5 28.1 1.659
## oat min_till - (rye-vetch no_till) 82.931 62.5 28.0 1.328
## (oat-clover min_till) - (oat-vetch min_till) 5.543 89.8 28.1 0.062
## (oat-clover min_till) - radish min_till 75.252 62.5 28.0 1.205
## (oat-clover min_till) - (radish-oat min_till) 35.328 62.5 28.0 0.566
## (oat-clover min_till) - (radish-rye min_till) 27.003 62.5 28.0 0.432
## (oat-clover min_till) - (radish-vetch min_till) 125.941 70.5 28.1 1.786
## (oat-clover min_till) - rye min_till -61.331 70.5 28.1 -0.870
## (oat-clover min_till) - (rye-clover min_till) -42.079 62.5 28.0 -0.674
## (oat-clover min_till) - (rye-vetch min_till) 49.704 62.5 28.0 0.796
## (oat-clover min_till) - oat no_till -83.599 62.5 28.0 -1.338
## (oat-clover min_till) - (oat-clover no_till) -10.576 70.5 28.1 -0.150
## (oat-clover min_till) - (oat-vetch no_till) -149.708 70.5 28.1 -2.123
## (oat-clover min_till) - radish no_till 59.394 70.5 28.1 0.842
## (oat-clover min_till) - (radish-oat no_till) -17.873 62.5 28.0 -0.286
## (oat-clover min_till) - (radish-rye no_till) -11.684 70.5 28.1 -0.166
## (oat-clover min_till) - (radish-vetch no_till) -80.027 62.5 28.0 -1.281
## (oat-clover min_till) - rye no_till -59.302 70.5 28.1 -0.841
## (oat-clover min_till) - (rye-clover no_till) 0.343 70.5 28.1 0.005
## (oat-clover min_till) - (rye-vetch no_till) -33.746 62.5 28.0 -0.540
## (oat-vetch min_till) - radish min_till 69.709 89.8 28.1 0.776
## (oat-vetch min_till) - (radish-oat min_till) 29.785 89.8 28.1 0.332
## (oat-vetch min_till) - (radish-rye min_till) 21.460 89.8 28.1 0.239
## (oat-vetch min_till) - (radish-vetch min_till) 120.398 94.6 28.0 1.273
## (oat-vetch min_till) - rye min_till -66.874 94.6 28.0 -0.707
## (oat-vetch min_till) - (rye-clover min_till) -47.623 89.8 28.1 -0.530
## (oat-vetch min_till) - (rye-vetch min_till) 44.161 89.8 28.1 0.492
## (oat-vetch min_till) - oat no_till -89.143 89.8 28.1 -0.993
## (oat-vetch min_till) - (oat-clover no_till) -16.119 94.6 28.0 -0.170
## (oat-vetch min_till) - (oat-vetch no_till) -155.252 94.6 28.0 -1.642
## (oat-vetch min_till) - radish no_till 53.851 94.6 28.0 0.569
## (oat-vetch min_till) - (radish-oat no_till) -23.417 89.8 28.1 -0.261
## (oat-vetch min_till) - (radish-rye no_till) -17.227 94.6 28.0 -0.182
## (oat-vetch min_till) - (radish-vetch no_till) -85.570 89.8 28.1 -0.953
## (oat-vetch min_till) - rye no_till -64.846 94.6 28.0 -0.686
## (oat-vetch min_till) - (rye-clover no_till) -5.201 94.6 28.0 -0.055
## (oat-vetch min_till) - (rye-vetch no_till) -39.290 89.8 28.1 -0.438
## radish min_till - (radish-oat min_till) -39.924 62.5 28.0 -0.639
## radish min_till - (radish-rye min_till) -48.249 62.5 28.0 -0.772
## radish min_till - (radish-vetch min_till) 50.689 70.5 28.1 0.719
## radish min_till - rye min_till -136.583 70.5 28.1 -1.937
## radish min_till - (rye-clover min_till) -117.331 62.5 28.0 -1.878
## radish min_till - (rye-vetch min_till) -25.548 62.5 28.0 -0.409
## radish min_till - oat no_till -158.851 62.5 28.0 -2.543
## radish min_till - (oat-clover no_till) -85.828 70.5 28.1 -1.217
## radish min_till - (oat-vetch no_till) -224.960 70.5 28.1 -3.190
## radish min_till - radish no_till -15.858 70.5 28.1 -0.225
## radish min_till - (radish-oat no_till) -93.125 62.5 28.0 -1.491
## radish min_till - (radish-rye no_till) -86.936 70.5 28.1 -1.233
## radish min_till - (radish-vetch no_till) -155.279 62.5 28.0 -2.486
## radish min_till - rye no_till -134.554 70.5 28.1 -1.908
## radish min_till - (rye-clover no_till) -74.909 70.5 28.1 -1.062
## radish min_till - (rye-vetch no_till) -108.998 62.5 28.0 -1.745
## (radish-oat min_till) - (radish-rye min_till) -8.325 62.5 28.0 -0.133
## (radish-oat min_till) - (radish-vetch min_till) 90.613 70.5 28.1 1.285
## (radish-oat min_till) - rye min_till -96.659 70.5 28.1 -1.371
## (radish-oat min_till) - (rye-clover min_till) -77.408 62.5 28.0 -1.239
## (radish-oat min_till) - (rye-vetch min_till) 14.376 62.5 28.0 0.230
## (radish-oat min_till) - oat no_till -118.928 62.5 28.0 -1.904
## (radish-oat min_till) - (oat-clover no_till) -45.904 70.5 28.1 -0.651
## (radish-oat min_till) - (oat-vetch no_till) -185.036 70.5 28.1 -2.624
## (radish-oat min_till) - radish no_till 24.066 70.5 28.1 0.341
## (radish-oat min_till) - (radish-oat no_till) -53.202 62.5 28.0 -0.852
## (radish-oat min_till) - (radish-rye no_till) -47.012 70.5 28.1 -0.667
## (radish-oat min_till) - (radish-vetch no_till) -115.355 62.5 28.0 -1.847
## (radish-oat min_till) - rye no_till -94.630 70.5 28.1 -1.342
## (radish-oat min_till) - (rye-clover no_till) -34.985 70.5 28.1 -0.496
## (radish-oat min_till) - (rye-vetch no_till) -69.075 62.5 28.0 -1.106
## (radish-rye min_till) - (radish-vetch min_till) 98.938 70.5 28.1 1.403
## (radish-rye min_till) - rye min_till -88.334 70.5 28.1 -1.253
## (radish-rye min_till) - (rye-clover min_till) -69.083 62.5 28.0 -1.106
## (radish-rye min_till) - (rye-vetch min_till) 22.701 62.5 28.0 0.363
## (radish-rye min_till) - oat no_till -110.603 62.5 28.0 -1.771
## (radish-rye min_till) - (oat-clover no_till) -37.579 70.5 28.1 -0.533
## (radish-rye min_till) - (oat-vetch no_till) -176.711 70.5 28.1 -2.506
## (radish-rye min_till) - radish no_till 32.391 70.5 28.1 0.459
## (radish-rye min_till) - (radish-oat no_till) -44.877 62.5 28.0 -0.718
## (radish-rye min_till) - (radish-rye no_till) -38.687 70.5 28.1 -0.549
## (radish-rye min_till) - (radish-vetch no_till) -107.030 62.5 28.0 -1.713
## (radish-rye min_till) - rye no_till -86.305 70.5 28.1 -1.224
## (radish-rye min_till) - (rye-clover no_till) -26.660 70.5 28.1 -0.378
## (radish-rye min_till) - (rye-vetch no_till) -60.750 62.5 28.0 -0.973
## (radish-vetch min_till) - rye min_till -187.272 76.5 28.0 -2.448
## (radish-vetch min_till) - (rye-clover min_till) -168.021 70.5 28.1 -2.383
## (radish-vetch min_till) - (rye-vetch min_till) -76.237 70.5 28.1 -1.081
## (radish-vetch min_till) - oat no_till -209.541 70.5 28.1 -2.971
## (radish-vetch min_till) - (oat-clover no_till) -136.517 76.5 28.0 -1.784
## (radish-vetch min_till) - (oat-vetch no_till) -275.649 76.5 28.0 -3.603
## (radish-vetch min_till) - radish no_till -66.547 76.5 28.0 -0.870
## (radish-vetch min_till) - (radish-oat no_till) -143.815 70.5 28.1 -2.039
## (radish-vetch min_till) - (radish-rye no_till) -137.625 76.5 28.0 -1.799
## (radish-vetch min_till) - (radish-vetch no_till) -205.968 70.5 28.1 -2.921
## (radish-vetch min_till) - rye no_till -185.244 76.5 28.0 -2.421
## (radish-vetch min_till) - (rye-clover no_till) -125.599 76.5 28.0 -1.642
## (radish-vetch min_till) - (rye-vetch no_till) -159.688 70.5 28.1 -2.264
## rye min_till - (rye-clover min_till) 19.251 70.5 28.1 0.273
## rye min_till - (rye-vetch min_till) 111.035 70.5 28.1 1.574
## rye min_till - oat no_till -22.269 70.5 28.1 -0.316
## rye min_till - (oat-clover no_till) 50.755 76.5 28.0 0.663
## rye min_till - (oat-vetch no_till) -88.377 76.5 28.0 -1.155
## rye min_till - radish no_till 120.725 76.5 28.0 1.578
## rye min_till - (radish-oat no_till) 43.457 70.5 28.1 0.616
## rye min_till - (radish-rye no_till) 49.647 76.5 28.0 0.649
## rye min_till - (radish-vetch no_till) -18.696 70.5 28.1 -0.265
## rye min_till - rye no_till 2.029 76.5 28.0 0.027
## rye min_till - (rye-clover no_till) 61.673 76.5 28.0 0.806
## rye min_till - (rye-vetch no_till) 27.584 70.5 28.1 0.391
## (rye-clover min_till) - (rye-vetch min_till) 91.783 62.5 28.0 1.469
## (rye-clover min_till) - oat no_till -41.520 62.5 28.0 -0.665
## (rye-clover min_till) - (oat-clover no_till) 31.504 70.5 28.1 0.447
## (rye-clover min_till) - (oat-vetch no_till) -107.629 70.5 28.1 -1.526
## (rye-clover min_till) - radish no_till 101.474 70.5 28.1 1.439
## (rye-clover min_till) - (radish-oat no_till) 24.206 62.5 28.0 0.388
## (rye-clover min_till) - (radish-rye no_till) 30.396 70.5 28.1 0.431
## (rye-clover min_till) - (radish-vetch no_till) -37.947 62.5 28.0 -0.607
## (rye-clover min_till) - rye no_till -17.223 70.5 28.1 -0.244
## (rye-clover min_till) - (rye-clover no_till) 42.422 70.5 28.1 0.602
## (rye-clover min_till) - (rye-vetch no_till) 8.333 62.5 28.0 0.133
## (rye-vetch min_till) - oat no_till -133.303 62.5 28.0 -2.134
## (rye-vetch min_till) - (oat-clover no_till) -60.280 70.5 28.1 -0.855
## (rye-vetch min_till) - (oat-vetch no_till) -199.412 70.5 28.1 -2.828
## (rye-vetch min_till) - radish no_till 9.690 70.5 28.1 0.137
## (rye-vetch min_till) - (radish-oat no_till) -67.577 62.5 28.0 -1.082
## (rye-vetch min_till) - (radish-rye no_till) -61.388 70.5 28.1 -0.870
## (rye-vetch min_till) - (radish-vetch no_till) -129.731 62.5 28.0 -2.077
## (rye-vetch min_till) - rye no_till -109.006 70.5 28.1 -1.546
## (rye-vetch min_till) - (rye-clover no_till) -49.361 70.5 28.1 -0.700
## (rye-vetch min_till) - (rye-vetch no_till) -83.450 62.5 28.0 -1.336
## oat no_till - (oat-clover no_till) 73.024 70.5 28.1 1.035
## oat no_till - (oat-vetch no_till) -66.109 70.5 28.1 -0.937
## oat no_till - radish no_till 142.994 70.5 28.1 2.028
## oat no_till - (radish-oat no_till) 65.726 62.5 28.0 1.052
## oat no_till - (radish-rye no_till) 71.916 70.5 28.1 1.020
## oat no_till - (radish-vetch no_till) 3.573 62.5 28.0 0.057
## oat no_till - rye no_till 24.297 70.5 28.1 0.345
## oat no_till - (rye-clover no_till) 83.942 70.5 28.1 1.190
## oat no_till - (rye-vetch no_till) 49.853 62.5 28.0 0.798
## (oat-clover no_till) - (oat-vetch no_till) -139.132 76.5 28.0 -1.819
## (oat-clover no_till) - radish no_till 69.970 76.5 28.0 0.915
## (oat-clover no_till) - (radish-oat no_till) -7.298 70.5 28.1 -0.103
## (oat-clover no_till) - (radish-rye no_till) -1.108 76.5 28.0 -0.014
## (oat-clover no_till) - (radish-vetch no_till) -69.451 70.5 28.1 -0.985
## (oat-clover no_till) - rye no_till -48.727 76.5 28.0 -0.637
## (oat-clover no_till) - (rye-clover no_till) 10.918 76.5 28.0 0.143
## (oat-clover no_till) - (rye-vetch no_till) -23.171 70.5 28.1 -0.329
## (oat-vetch no_till) - radish no_till 209.102 76.5 28.0 2.733
## (oat-vetch no_till) - (radish-oat no_till) 131.835 70.5 28.1 1.869
## (oat-vetch no_till) - (radish-rye no_till) 138.024 76.5 28.0 1.804
## (oat-vetch no_till) - (radish-vetch no_till) 69.681 70.5 28.1 0.988
## (oat-vetch no_till) - rye no_till 90.406 76.5 28.0 1.182
## (oat-vetch no_till) - (rye-clover no_till) 150.051 76.5 28.0 1.961
## (oat-vetch no_till) - (rye-vetch no_till) 115.962 70.5 28.1 1.644
## radish no_till - (radish-oat no_till) -77.268 70.5 28.1 -1.096
## radish no_till - (radish-rye no_till) -71.078 76.5 28.0 -0.929
## radish no_till - (radish-vetch no_till) -139.421 70.5 28.1 -1.977
## radish no_till - rye no_till -118.697 76.5 28.0 -1.552
## radish no_till - (rye-clover no_till) -59.051 76.5 28.0 -0.772
## radish no_till - (rye-vetch no_till) -93.141 70.5 28.1 -1.321
## (radish-oat no_till) - (radish-rye no_till) 6.190 70.5 28.1 0.088
## (radish-oat no_till) - (radish-vetch no_till) -62.153 62.5 28.0 -0.995
## (radish-oat no_till) - rye no_till -41.429 70.5 28.1 -0.587
## (radish-oat no_till) - (rye-clover no_till) 18.216 70.5 28.1 0.258
## (radish-oat no_till) - (rye-vetch no_till) -15.873 62.5 28.0 -0.254
## (radish-rye no_till) - (radish-vetch no_till) -68.343 70.5 28.1 -0.969
## (radish-rye no_till) - rye no_till -47.618 76.5 28.0 -0.622
## (radish-rye no_till) - (rye-clover no_till) 12.027 76.5 28.0 0.157
## (radish-rye no_till) - (rye-vetch no_till) -22.063 70.5 28.1 -0.313
## (radish-vetch no_till) - rye no_till 20.725 70.5 28.1 0.294
## (radish-vetch no_till) - (rye-clover no_till) 80.370 70.5 28.1 1.140
## (radish-vetch no_till) - (rye-vetch no_till) 46.280 62.5 28.0 0.741
## rye no_till - (rye-clover no_till) 59.645 76.5 28.0 0.780
## rye no_till - (rye-vetch no_till) 25.556 70.5 28.1 0.362
## (rye-clover no_till) - (rye-vetch no_till) -34.089 70.5 28.1 -0.483
## p.value
## 0.9247
## 0.9964
## 0.2626
## 0.6359
## 0.7199
## 0.1321
## 1.0000
## 0.9993
## 0.4874
## 1.0000
## 0.9892
## 1.0000
## 0.5949
## 0.9822
## 0.9903
## 1.0000
## 1.0000
## 0.9721
## 0.9973
## 1.0000
## 0.9992
## 1.0000
## 1.0000
## 0.9473
## 1.0000
## 1.0000
## 1.0000
## 0.9970
## 1.0000
## 0.8198
## 1.0000
## 1.0000
## 1.0000
## 0.9982
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9983
## 1.0000
## 1.0000
## 1.0000
## 0.9999
## 1.0000
## 0.9747
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9016
## 0.9214
## 1.0000
## 0.5648
## 0.9990
## 0.2133
## 1.0000
## 0.9902
## 0.9989
## 0.6020
## 0.9117
## 0.9998
## 0.9565
## 1.0000
## 0.9981
## 0.9961
## 0.9988
## 1.0000
## 0.9131
## 1.0000
## 0.5126
## 1.0000
## 1.0000
## 1.0000
## 0.9311
## 0.9969
## 1.0000
## 0.9997
## 0.9949
## 0.9986
## 0.9997
## 1.0000
## 0.9509
## 1.0000
## 0.5890
## 1.0000
## 1.0000
## 1.0000
## 0.9628
## 0.9990
## 1.0000
## 1.0000
## 0.6266
## 0.6685
## 0.9998
## 0.3108
## 0.9476
## 0.0947
## 1.0000
## 0.8599
## 0.9440
## 0.3369
## 0.6437
## 0.9747
## 0.7414
## 1.0000
## 0.9830
## 1.0000
## 1.0000
## 0.9995
## 0.9826
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9916
## 1.0000
## 1.0000
## 0.9875
## 0.9933
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.8140
## 1.0000
## 0.3882
## 1.0000
## 0.9998
## 1.0000
## 0.8425
## 0.9858
## 1.0000
## 0.9971
## 0.9999
## 1.0000
## 0.8650
## 0.9999
## 0.9999
## 1.0000
## 1.0000
## 0.9993
## 1.0000
## 0.9389
## 1.0000
## 1.0000
## 1.0000
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 0.4442
## 0.9243
## 0.9427
## 0.9999
## 0.9993
## 0.8923
## 0.9743
## 0.9998
## 1.0000
## 0.8862
## 0.9853
## 1.0000
## 0.9974
## 1.0000
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9996
## 1.0000
## 1.0000
## 1.0000
## 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 20 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbc_cctil <- mixed(
MBIO_C ~ cc_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f, tillage
## Warning: Due to missing values, reduced number of observations to 50
# Nice ANOVA table
print(nice(anova_kr_mbc_cctil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_C ~ cc_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 28.04 2.07 + .069
## 2 tillage 1, 28.07 4.55 * .042
## 3 cc_type_f:tillage 9, 28.04 1.18 .345
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
Agroforestry treatment was found to be NOT significant (p = 0.56) using a linear mixed-effects model with MBN as the response variable, agro_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbn_ag_treats2 <- lmer(MBIO_N ~ agro_treatment + (1 | year), data = ag_treats2)
# Summarize the model results
summary(model_mbn_ag_treats2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ agro_treatment + (1 | year)
## Data: ag_treats2
##
## REML criterion at convergence: 437.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.1180 -0.6642 -0.3527 0.2533 4.0586
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 65.06 8.066
## Residual 846.25 29.090
## Number of obs: 47, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 25.991 6.437 2.187 4.038 0.0483 *
## agro_treatmentno_agroforestry -12.641 21.204 44.270 -0.596 0.5541
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agr_trtmnt_ -0.151
# Extract fixed effects
fixef(model_mbn_ag_treats2)
## (Intercept) agro_treatmentno_agroforestry
## 25.99103 -12.64119
# Extract random effects (conditional modes)
ranef(model_mbn_ag_treats2)
## $year
## (Intercept)
## 2021 6.612669
## 2022 -2.100812
## 2023 -4.511857
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_ag_treats2) # residuals vs fitted
qqnorm(resid(model_mbn_ag_treats2)); qqline(resid(model_mbn_ag_treats2)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_treatment as a factor for pairwise comparisons
ag_treats2$agro_treatment_f <- factor(ag_treats2$agro_treatment)
lmer_model_mbn_ag_treats2_factor <- lmer(MBIO_N ~ agro_treatment_f + (1 | year), data = ag_treats2)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_mbn_ag_treats2_result <- emmeans(lmer_model_mbn_ag_treats2_factor, pairwise ~ agro_treatment_f, adjust = "tukey")
# View the results
emmeans_mbn_ag_treats2_result
## $emmeans
## agro_treatment_f emmean SE df lower.CL upper.CL
## agroforestry 26.0 6.57 1.96 -2.87 54.9
## no_agroforestry 13.3 21.40 41.86 -29.88 56.6
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 12.6 21.5 44.2 0.587 0.5602
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_ag_treats2 <- mixed(
MBIO_N ~ agro_treatment_f + (1 | year),
data = ag_treats2,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_treatment_f
## Warning: Due to missing values, reduced number of observations to 47
# Nice ANOVA table
print(nice(anova_kr_mbn_ag_treats2), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ agro_treatment_f + (1 | year)
## Data: ag_treats2
## Effect df F p.value
## 1 agro_treatment_f 1, 44.18 0.34 .560
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_ag_treats2 <- anova_kr_mbn_ag_treats2$Anova
car_table_mbn_ag_treats2 # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.ag_treats2 <- emmeans(model_mbn_ag_treats2, "agro_treatment")
pairs(MBIO_N.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## agroforestry - no_agroforestry 12.6 21.5 44.2 0.587 0.5602
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_N.emm.s.ag_treats2, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_treatment emmean SE df lower.CL upper.CL .group
## no_agroforestry 13.3 21.40 41.86 -36.3 63.0 a
## agroforestry 26.0 6.57 1.96 -15.6 67.6 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Agroforestry tree type was found to be NOT significant (p = 0.82) using a linear mixed-effects model with MBN as the response variable, agro_type as the fixed effect, and (1 / year) as the random intercept.
model_mbn_ag <- lmer(MBIO_N ~ agro_type + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_mbn_ag)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ agro_type + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 421.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.1245 -0.6254 -0.4040 0.2599 4.0085
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 66.36 8.146
## Residual 884.56 29.742
## Number of obs: 45, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 27.004 7.785 4.208 3.469 0.0236 *
## agro_typepine -2.074 8.908 41.633 -0.233 0.8170
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## agro_typepn -0.542
# Extract fixed effects
fixef(model_mbn_ag)
## (Intercept) agro_typepine
## 27.004134 -2.073992
# Extract random effects (conditional modes)
ranef(model_mbn_ag)
## $year
## (Intercept)
## 2021 6.521618
## 2022 -1.879002
## 2023 -4.642616
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_ag) # residuals vs fitted
qqnorm(resid(model_mbn_ag)); qqline(resid(model_mbn_ag)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$agro_type_f <- factor(ag_nocntrl$agro_type)
lmer_model_mbn_ag_factor <- lmer(MBIO_N ~ agro_type_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_type_f` factor.
emmeans_mbn_ag_result <- emmeans(lmer_model_mbn_ag_factor, pairwise ~ agro_type_f, adjust = "tukey")
# View the results
emmeans_mbn_ag_result
## $emmeans
## agro_type_f emmean SE df lower.CL upper.CL
## pecan 27.0 7.99 3.64 3.93 50.1
## pine 24.9 8.11 4.35 3.13 46.7
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan - pine 2.07 8.95 41.4 0.232 0.8179
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_ag <- mixed(
MBIO_N ~ agro_type_f + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f
## Warning: Due to missing values, reduced number of observations to 45
# Nice ANOVA table
print(nice(anova_kr_mbn_ag), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ agro_type_f + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 41.40 0.05 .818
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_ag <- anova_kr_mbn_ag$Anova
car_table_mbn_ag # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.ag <- emmeans(model_mbn_ag, "agro_type")
pairs(MBIO_N.emm.s.ag, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## pecan - pine 2.07 8.95 41.4 0.232 0.8179
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_N.emm.s.ag, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## agro_type emmean SE df lower.CL upper.CL .group
## pine 24.9 8.11 4.35 -2.16 52.0 a
## pecan 27.0 7.99 3.64 -2.28 56.3 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Cover crop treatment was found to be NOT significant (p = 0.65) using a linear mixed-effects model with MBN as the response variable, cc_treatment as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbn_cc_treats <- lmer(MBIO_N ~ cc_treatment + (1 | year), data = dat)
# Summarize the model results
summary(model_mbn_cc_treats)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ cc_treatment + (1 | year)
## Data: dat
##
## REML criterion at convergence: 455.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.1385 -0.6624 -0.2808 0.2933 4.1311
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 63.95 7.997
## Residual 816.63 28.577
## Number of obs: 49, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 25.902 6.352 2.153 4.078 0.0487 *
## cc_treatmentno_cc -7.132 15.157 46.815 -0.471 0.6402
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## cc_trtmntn_ -0.207
# Extract fixed effects
fixef(model_mbn_cc_treats)
## (Intercept) cc_treatmentno_cc
## 25.901964 -7.131669
# Extract random effects (conditional modes)
ranef(model_mbn_cc_treats)
## $year
## (Intercept)
## 2021 6.716091
## 2022 -2.522278
## 2023 -4.193813
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_cc_treats) # residuals vs fitted
qqnorm(resid(model_mbn_cc_treats)); qqline(resid(model_mbn_cc_treats)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_treatment as a factor for pairwise comparisons
dat$cc_treatment_f <- factor(dat$cc_treatment)
lmer_model_mbn_cc_treats_factor <- lmer(MBIO_N ~ cc_treatment_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ agro_treatment_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `agro_treatment_f` factor.
emmeans_mbn_cc_treats_result <- emmeans(lmer_model_mbn_cc_treats_factor, pairwise ~ cc_treatment_f, adjust = "tukey")
# View the results
emmeans_mbn_cc_treats_result
## $emmeans
## cc_treatment_f emmean SE df lower.CL upper.CL
## covercrop 25.9 6.47 2.02 -1.62 53.4
## no_cc 18.8 15.40 30.88 -12.74 50.3
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc 7.13 15.6 46.8 0.458 0.6493
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_cc_treats <- mixed(
MBIO_N ~ cc_treatment_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_treatment_f
## Warning: Due to missing values, reduced number of observations to 49
# Nice ANOVA table
print(nice(anova_kr_mbn_cc_treats), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ cc_treatment_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_treatment_f 1, 46.80 0.21 .649
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_cc_treats <- anova_kr_mbn_cc_treats$Anova
car_table_mbn_cc_treats # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.cc_treats <- emmeans(model_mbn_cc_treats, "cc_treatment")
pairs(MBIO_N.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## covercrop - no_cc 7.13 15.6 46.8 0.458 0.6493
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_N.emm.s.cc_treats, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_treatment emmean SE df lower.CL upper.CL .group
## no_cc 18.8 15.40 30.88 -17.5 55.1 a
## covercrop 25.9 6.47 2.02 -13.4 65.2 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Cover crop class (mix, mono, control) was found to be NOT significant (p = 0.67) using a linear mixed-effects model with MBN as the response variable, cc_class as the fixed effect, and (1 / year) as the random intercept.
model_mbn_cc_c <- lmer(MBIO_N ~ cc_class + (1 | year), data = dat)
# Summarize the model results
summary(model_mbn_cc_c)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ cc_class + (1 | year)
## Data: dat
##
## REML criterion at convergence: 448.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.2192 -0.5764 -0.2919 0.2357 4.0264
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 61.93 7.869
## Residual 824.12 28.707
## Number of obs: 49, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 28.638 7.204 3.537 3.975 0.0209 *
## cc_classmono -6.986 8.893 45.181 -0.786 0.4362
## cc_classnone -10.003 15.634 45.941 -0.640 0.5254
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_clssm
## cc_classmon -0.482
## cc_classnon -0.288 0.228
# Extract fixed effects
fixef(model_mbn_cc_c)
## (Intercept) cc_classmono cc_classnone
## 28.638150 -6.986003 -10.003247
# Extract random effects (conditional modes)
ranef(model_mbn_cc_c)
## $year
## (Intercept)
## 2021 6.445307
## 2022 -2.031489
## 2023 -4.413818
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_cc_c) # residuals vs fitted
qqnorm(resid(model_mbn_cc_c)); qqline(resid(model_mbn_cc_c)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_class as a factor for pairwise comparisons
dat$cc_class_f <- factor(dat$cc_class)
lmer_model_mbn_cc_c_factor <- lmer(MBIO_N ~ cc_class_f + (1 | year), data = dat)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_class_f` factor.
emmeans_mbn_cc_c_result <- emmeans(lmer_model_mbn_cc_c_factor, pairwise ~ cc_class_f, adjust = "tukey")
# View the results
emmeans_mbn_cc_c_result
## $emmeans
## cc_class_f emmean SE df lower.CL upper.CL
## mixed 28.6 7.43 3.22 5.89 51.4
## mono 21.7 8.33 6.10 1.36 41.9
## none 18.6 15.50 30.75 -12.99 50.3
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## mixed - mono 6.99 9.01 45.1 0.775 0.7201
## mixed - none 10.00 16.20 45.9 0.619 0.8104
## mono - none 3.02 16.40 45.4 0.184 0.9816
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_cc_c <- mixed(
MBIO_N ~ cc_class_f + (1 | year),
data = dat,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_class_f
## Warning: Due to missing values, reduced number of observations to 49
# Nice ANOVA table
print(nice(anova_kr_mbn_cc_c), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ cc_class_f + (1 | year)
## Data: dat
## Effect df F p.value
## 1 cc_class_f 2, 45.36 0.40 .674
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_cc_c <- anova_kr_mbn_cc_c$Anova
car_table_mbn_cc_c # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.cc_c <- emmeans(model_mbn_cc_c, "cc_class")
pairs(MBIO_N.emm.s.cc_c, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## mixed - mono 6.99 9.01 45.1 0.775 0.7201
## mixed - none 10.00 16.20 45.9 0.619 0.8104
## mono - none 3.02 16.40 45.4 0.184 0.9816
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
cld(MBIO_N.emm.s.cc_c, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_class emmean SE df lower.CL upper.CL .group
## none 18.6 15.50 30.75 -20.50 57.8 a
## mono 21.7 8.33 6.10 -5.45 48.8 a
## mixed 28.6 7.43 3.22 -5.21 62.5 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 3 estimates
## P value adjustment: tukey method for comparing a family of 3 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Cover crop type was found to be NOT significant (p = 0.49) using a linear mixed-effects model with MBN as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_mbn_cc <- lmer(MBIO_N ~ cc_type + (1 | year), data = cc_nocntrl)
# Summarize the model results
summary(model_mbn_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ cc_type + (1 | year)
## Data: cc_nocntrl
##
## REML criterion at convergence: 352.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.0865 -0.6314 -0.1727 0.3788 3.5379
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 85.82 9.264
## Residual 867.40 29.452
## Number of obs: 45, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 36.817 13.160 18.748 2.798 0.0116 *
## cc_typeoat-clover -20.362 19.203 34.198 -1.060 0.2964
## cc_typeoat-vetch 18.918 21.042 34.178 0.899 0.3749
## cc_typeradish -30.331 17.867 33.504 -1.698 0.0989 .
## cc_typeradish-oat -5.874 17.004 33.321 -0.345 0.7319
## cc_typeradish-rye -14.773 17.867 33.504 -0.827 0.4142
## cc_typeradish-vetch 1.785 17.867 33.504 0.100 0.9210
## cc_typerye -17.789 17.004 33.321 -1.046 0.3030
## cc_typerye-clover -23.039 24.199 33.907 -0.952 0.3478
## cc_typerye-vetch -20.157 21.042 34.178 -0.958 0.3448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typrd cc_typrdsh-t cc_typrdsh-r
## cc_typt-clv -0.572
## cc_typt-vtc -0.522 0.376
## cc_typerdsh -0.615 0.430 0.392
## cc_typrdsh-t -0.646 0.443 0.404 0.476
## cc_typrdsh-r -0.615 0.430 0.392 0.457 0.476
## cc_typrdsh-v -0.615 0.430 0.392 0.457 0.476 0.457
## cc_typerye -0.646 0.443 0.404 0.476 0.500 0.476
## cc_typry-cl -0.454 0.327 0.298 0.341 0.351 0.341
## cc_typry-vt -0.522 0.376 0.347 0.392 0.404 0.392
## cc_typrdsh-v cc_typry cc_typry-c
## cc_typt-clv
## cc_typt-vtc
## cc_typerdsh
## cc_typrdsh-t
## cc_typrdsh-r
## cc_typrdsh-v
## cc_typerye 0.476
## cc_typry-cl 0.341 0.351
## cc_typry-vt 0.392 0.404 0.298
# Extract fixed effects
fixef(model_mbn_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typeradish
## 36.817000 -20.361897 18.918407 -30.330759
## cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch cc_typerye
## -5.874000 -14.772559 1.784641 -17.789000
## cc_typerye-clover cc_typerye-vetch
## -23.039397 -20.156593
# Extract random effects (conditional modes)
ranef(model_mbn_cc)
## $year
## (Intercept)
## 2021 7.870811
## 2022 -2.616795
## 2023 -5.254016
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_cc) # residuals vs fitted
qqnorm(resid(model_mbn_cc)); qqline(resid(model_mbn_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
cc_nocntrl$cc_type_f <- factor(cc_nocntrl$cc_type)
lmer_model_mbn_cc_factor <- lmer(MBIO_N ~ cc_type_f + (1 | year), data = cc_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_mbn_cc_result <- emmeans(lmer_model_mbn_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_mbn_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 36.82 13.2 17.3 9.09 64.5
## oat-clover 16.46 16.3 22.9 -17.23 50.1
## oat-vetch 55.74 18.5 27.5 17.84 93.6
## radish 6.49 14.3 20.4 -23.36 36.3
## radish-oat 30.94 13.2 17.3 3.21 58.7
## radish-rye 22.04 14.3 20.4 -7.80 51.9
## radish-vetch 38.60 14.3 20.4 8.75 68.4
## rye 19.03 13.2 17.3 -8.70 46.8
## rye-clover 13.78 21.9 32.5 -30.91 58.5
## rye-vetch 16.66 18.5 27.5 -21.23 54.6
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 20.362 19.5 34.1 1.043 0.9870
## oat - (oat-vetch) -18.918 21.4 34.0 -0.884 0.9960
## oat - radish 30.331 17.9 33.2 1.692 0.7917
## oat - (radish-oat) 5.874 17.0 33.0 0.345 1.0000
## oat - (radish-rye) 14.773 17.9 33.2 0.824 0.9976
## oat - (radish-vetch) -1.785 17.9 33.2 -0.100 1.0000
## oat - rye 17.789 17.0 33.0 1.046 0.9867
## oat - (rye-clover) 23.039 24.4 33.7 0.942 0.9936
## oat - (rye-vetch) 20.157 21.4 34.0 0.942 0.9936
## (oat-clover) - (oat-vetch) -39.280 22.6 33.2 -1.739 0.7662
## (oat-clover) - radish 9.969 19.9 33.4 0.500 1.0000
## (oat-clover) - (radish-oat) -14.488 19.5 34.1 -0.742 0.9989
## (oat-clover) - (radish-rye) -5.589 19.9 33.4 -0.280 1.0000
## (oat-clover) - (radish-vetch) -22.147 19.9 33.4 -1.111 0.9801
## (oat-clover) - rye -2.573 19.5 34.1 -0.132 1.0000
## (oat-clover) - (rye-clover) 2.678 25.5 33.0 0.105 1.0000
## (oat-clover) - (rye-vetch) -0.205 22.6 33.2 -0.009 1.0000
## (oat-vetch) - radish 49.249 21.8 33.5 2.262 0.4378
## (oat-vetch) - (radish-oat) 24.792 21.4 34.0 1.159 0.9738
## (oat-vetch) - (radish-rye) 33.691 21.8 33.5 1.547 0.8629
## (oat-vetch) - (radish-vetch) 17.134 21.8 33.5 0.787 0.9983
## (oat-vetch) - rye 36.707 21.4 34.0 1.716 0.7790
## (oat-vetch) - (rye-clover) 41.958 27.0 33.1 1.556 0.8591
## (oat-vetch) - (rye-vetch) 39.075 24.0 33.0 1.625 0.8266
## radish - (radish-oat) -24.457 17.9 33.2 -1.365 0.9295
## radish - (radish-rye) -15.558 18.6 33.0 -0.835 0.9974
## radish - (radish-vetch) -32.115 18.6 33.0 -1.724 0.7743
## radish - rye -12.542 17.9 33.2 -0.700 0.9993
## radish - (rye-clover) -7.291 24.8 33.3 -0.294 1.0000
## radish - (rye-vetch) -10.174 21.8 33.5 -0.467 1.0000
## (radish-oat) - (radish-rye) 8.899 17.9 33.2 0.497 1.0000
## (radish-oat) - (radish-vetch) -7.659 17.9 33.2 -0.427 1.0000
## (radish-oat) - rye 11.915 17.0 33.0 0.701 0.9993
## (radish-oat) - (rye-clover) 17.165 24.4 33.7 0.702 0.9993
## (radish-oat) - (rye-vetch) 14.283 21.4 34.0 0.668 0.9995
## (radish-rye) - (radish-vetch) -16.557 18.6 33.0 -0.889 0.9958
## (radish-rye) - rye 3.016 17.9 33.2 0.168 1.0000
## (radish-rye) - (rye-clover) 8.267 24.8 33.3 0.334 1.0000
## (radish-rye) - (rye-vetch) 5.384 21.8 33.5 0.247 1.0000
## (radish-vetch) - rye 19.574 17.9 33.2 1.092 0.9822
## (radish-vetch) - (rye-clover) 24.824 24.8 33.3 1.002 0.9901
## (radish-vetch) - (rye-vetch) 21.941 21.8 33.5 1.008 0.9897
## rye - (rye-clover) 5.250 24.4 33.7 0.215 1.0000
## rye - (rye-vetch) 2.368 21.4 34.0 0.111 1.0000
## (rye-clover) - (rye-vetch) -2.883 27.0 33.1 -0.107 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_cc <- mixed(
MBIO_N ~ cc_type_f + (1 | year),
data = cc_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
## Warning: Due to missing values, reduced number of observations to 45
# Nice ANOVA table
print(nice(anova_kr_mbn_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ cc_type_f + (1 | year)
## Data: cc_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 33.35 0.96 .492
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_cc <- anova_kr_mbn_cc$Anova
car_table_mbn_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.cc <- emmeans(model_mbn_cc, "cc_type")
pairs(MBIO_N.emm.s.cc, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 20.362 19.5 34.1 1.043 0.9870
## oat - (oat-vetch) -18.918 21.4 34.0 -0.884 0.9960
## oat - radish 30.331 17.9 33.2 1.692 0.7917
## oat - (radish-oat) 5.874 17.0 33.0 0.345 1.0000
## oat - (radish-rye) 14.773 17.9 33.2 0.824 0.9976
## oat - (radish-vetch) -1.785 17.9 33.2 -0.100 1.0000
## oat - rye 17.789 17.0 33.0 1.046 0.9867
## oat - (rye-clover) 23.039 24.4 33.7 0.942 0.9936
## oat - (rye-vetch) 20.157 21.4 34.0 0.942 0.9936
## (oat-clover) - (oat-vetch) -39.280 22.6 33.2 -1.739 0.7662
## (oat-clover) - radish 9.969 19.9 33.4 0.500 1.0000
## (oat-clover) - (radish-oat) -14.488 19.5 34.1 -0.742 0.9989
## (oat-clover) - (radish-rye) -5.589 19.9 33.4 -0.280 1.0000
## (oat-clover) - (radish-vetch) -22.147 19.9 33.4 -1.111 0.9801
## (oat-clover) - rye -2.573 19.5 34.1 -0.132 1.0000
## (oat-clover) - (rye-clover) 2.678 25.5 33.0 0.105 1.0000
## (oat-clover) - (rye-vetch) -0.205 22.6 33.2 -0.009 1.0000
## (oat-vetch) - radish 49.249 21.8 33.5 2.262 0.4378
## (oat-vetch) - (radish-oat) 24.792 21.4 34.0 1.159 0.9738
## (oat-vetch) - (radish-rye) 33.691 21.8 33.5 1.547 0.8629
## (oat-vetch) - (radish-vetch) 17.134 21.8 33.5 0.787 0.9983
## (oat-vetch) - rye 36.707 21.4 34.0 1.716 0.7790
## (oat-vetch) - (rye-clover) 41.958 27.0 33.1 1.556 0.8591
## (oat-vetch) - (rye-vetch) 39.075 24.0 33.0 1.625 0.8266
## radish - (radish-oat) -24.457 17.9 33.2 -1.365 0.9295
## radish - (radish-rye) -15.558 18.6 33.0 -0.835 0.9974
## radish - (radish-vetch) -32.115 18.6 33.0 -1.724 0.7743
## radish - rye -12.542 17.9 33.2 -0.700 0.9993
## radish - (rye-clover) -7.291 24.8 33.3 -0.294 1.0000
## radish - (rye-vetch) -10.174 21.8 33.5 -0.467 1.0000
## (radish-oat) - (radish-rye) 8.899 17.9 33.2 0.497 1.0000
## (radish-oat) - (radish-vetch) -7.659 17.9 33.2 -0.427 1.0000
## (radish-oat) - rye 11.915 17.0 33.0 0.701 0.9993
## (radish-oat) - (rye-clover) 17.165 24.4 33.7 0.702 0.9993
## (radish-oat) - (rye-vetch) 14.283 21.4 34.0 0.668 0.9995
## (radish-rye) - (radish-vetch) -16.557 18.6 33.0 -0.889 0.9958
## (radish-rye) - rye 3.016 17.9 33.2 0.168 1.0000
## (radish-rye) - (rye-clover) 8.267 24.8 33.3 0.334 1.0000
## (radish-rye) - (rye-vetch) 5.384 21.8 33.5 0.247 1.0000
## (radish-vetch) - rye 19.574 17.9 33.2 1.092 0.9822
## (radish-vetch) - (rye-clover) 24.824 24.8 33.3 1.002 0.9901
## (radish-vetch) - (rye-vetch) 21.941 21.8 33.5 1.008 0.9897
## rye - (rye-clover) 5.250 24.4 33.7 0.215 1.0000
## rye - (rye-vetch) 2.368 21.4 34.0 0.111 1.0000
## (rye-clover) - (rye-vetch) -2.883 27.0 33.1 -0.107 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 10 estimates
cld(MBIO_N.emm.s.cc, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 6.49 14.3 20.4 -38.446 51.4 a
## rye-clover 13.78 21.9 32.5 -52.132 79.7 a
## oat-clover 16.46 16.3 22.9 -33.942 66.9 a
## rye-vetch 16.66 18.5 27.5 -39.572 72.9 a
## rye 19.03 13.2 17.3 -23.133 61.2 a
## radish-rye 22.04 14.3 20.4 -22.888 67.0 a
## radish-oat 30.94 13.2 17.3 -11.218 73.1 a
## oat 36.82 13.2 17.3 -5.344 79.0 a
## radish-vetch 38.60 14.3 20.4 -6.331 83.5 a
## oat-vetch 55.74 18.5 27.5 -0.497 112.0 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 10 estimates
## P value adjustment: tukey method for comparing a family of 10 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Within the plots using pecan agroforestry, cover crop type was found to be NOT significant (p = 0.19) using a linear mixed-effects model with MBN as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_mbn_pec_cc <- lmer(MBIO_N ~ cc_type + (1 | year), data = datPEC)
## boundary (singular) fit: see help('isSingular')
# Summarize the model results
summary(model_mbn_pec_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ cc_type + (1 | year)
## Data: datPEC
##
## REML criterion at convergence: 170.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.3559 -0.5647 -0.2304 0.4929 1.8667
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 0 0.00
## Residual 502 22.41
## Number of obs: 24, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 36.817 9.147 18.000 4.025 0.000794 ***
## cc_typeoat-clover -19.054 14.463 18.000 -1.317 0.204228
## cc_typeoat-vetch 18.039 15.843 18.000 1.139 0.269796
## cc_typerye -17.789 12.936 18.000 -1.375 0.185961
## cc_typerye-clover -21.731 18.294 18.000 -1.188 0.250329
## cc_typerye-vetch -21.036 15.843 18.000 -1.328 0.200861
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cc_typt-c cc_typt-v cc_typ cc_typry-c
## cc_typt-clv -0.632
## cc_typt-vtc -0.577 0.365
## cc_typerye -0.707 0.447 0.408
## cc_typry-cl -0.500 0.316 0.289 0.354
## cc_typry-vt -0.577 0.365 0.333 0.408 0.289
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# Extract fixed effects
fixef(model_mbn_pec_cc)
## (Intercept) cc_typeoat-clover cc_typeoat-vetch cc_typerye
## 36.81700 -19.05350 18.03933 -17.78900
## cc_typerye-clover cc_typerye-vetch
## -21.73100 -21.03567
# Extract random effects (conditional modes)
ranef(model_mbn_pec_cc)
## $year
## (Intercept)
## 2021 0
## 2022 0
## 2023 0
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_pec_cc) # residuals vs fitted
qqnorm(resid(model_mbn_pec_cc)); qqline(resid(model_mbn_pec_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPEC$cc_type_f <- factor(datPEC$cc_type)
lmer_model_mbn_pec_cc_factor <- lmer(MBIO_N ~ cc_type_f + (1 | year), data = datPEC)
## boundary (singular) fit: see help('isSingular')
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_mbn_pec_cc_result <- emmeans(lmer_model_mbn_pec_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_mbn_pec_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## oat 36.8 9.15 14.1 17.207 56.4
## oat-clover 17.8 11.80 14.1 -7.514 43.0
## oat-vetch 54.9 13.80 15.7 25.450 84.3
## rye 19.0 9.15 14.1 -0.582 38.6
## rye-clover 15.1 16.30 17.8 -19.110 49.3
## rye-vetch 15.8 13.80 15.7 -13.625 45.2
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 19.053 14.9 17.6 1.277 0.7933
## oat - (oat-vetch) -18.039 16.6 17.7 -1.087 0.8802
## oat - rye 17.789 12.9 16.3 1.375 0.7405
## oat - (rye-clover) 21.731 18.7 17.2 1.165 0.8472
## oat - (rye-vetch) 21.036 16.6 17.7 1.268 0.7980
## (oat-clover) - (oat-vetch) -37.093 17.4 16.7 -2.128 0.3201
## (oat-clover) - rye -1.264 14.9 17.6 -0.085 1.0000
## (oat-clover) - (rye-clover) 2.678 19.4 16.3 0.138 1.0000
## (oat-clover) - (rye-vetch) 1.982 17.4 16.7 0.114 1.0000
## (oat-vetch) - rye 35.828 16.6 17.7 2.159 0.3038
## (oat-vetch) - (rye-clover) 39.770 20.7 16.6 1.920 0.4250
## (oat-vetch) - (rye-vetch) 39.075 18.3 16.3 2.136 0.3176
## rye - (rye-clover) 3.942 18.7 17.2 0.211 0.9999
## rye - (rye-vetch) 3.247 16.6 17.7 0.196 1.0000
## (rye-clover) - (rye-vetch) -0.695 20.7 16.6 -0.034 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_pec_cc <- mixed(
MBIO_N ~ cc_type_f + (1 | year),
data = datPEC,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
## Warning: Due to missing values, reduced number of observations to 24
## boundary (singular) fit: see help('isSingular')
# Nice ANOVA table
print(nice(anova_kr_mbn_pec_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ cc_type_f + (1 | year)
## Data: datPEC
## Effect df F p.value
## 1 cc_type_f 5, 16.90 1.68 .192
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_pec_cc <- anova_kr_mbn_pec_cc$Anova
car_table_mbn_pec_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.cc_pec <- emmeans(model_mbn_pec_cc, "cc_type")
pairs(MBIO_N.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## oat - (oat-clover) 19.053 14.9 17.6 1.277 0.7933
## oat - (oat-vetch) -18.039 16.6 17.7 -1.087 0.8802
## oat - rye 17.789 12.9 16.3 1.375 0.7405
## oat - (rye-clover) 21.731 18.7 17.2 1.165 0.8472
## oat - (rye-vetch) 21.036 16.6 17.7 1.268 0.7980
## (oat-clover) - (oat-vetch) -37.093 17.4 16.7 -2.128 0.3201
## (oat-clover) - rye -1.264 14.9 17.6 -0.085 1.0000
## (oat-clover) - (rye-clover) 2.678 19.4 16.3 0.138 1.0000
## (oat-clover) - (rye-vetch) 1.982 17.4 16.7 0.114 1.0000
## (oat-vetch) - rye 35.828 16.6 17.7 2.159 0.3038
## (oat-vetch) - (rye-clover) 39.770 20.7 16.6 1.920 0.4250
## (oat-vetch) - (rye-vetch) 39.075 18.3 16.3 2.136 0.3176
## rye - (rye-clover) 3.942 18.7 17.2 0.211 0.9999
## rye - (rye-vetch) 3.247 16.6 17.7 0.196 1.0000
## (rye-clover) - (rye-vetch) -0.695 20.7 16.6 -0.034 1.0000
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 6 estimates
cld(MBIO_N.emm.s.cc_pec, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## rye-clover 15.1 16.30 17.8 -33.00 63.2 a
## rye-vetch 15.8 13.80 15.7 -25.86 57.4 a
## oat-clover 17.8 11.80 14.1 -18.27 53.8 a
## rye 19.0 9.15 14.1 -8.92 47.0 a
## oat 36.8 9.15 14.1 8.87 64.8 a
## oat-vetch 54.9 13.80 15.7 13.22 96.5 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 6 estimates
## P value adjustment: tukey method for comparing a family of 6 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 12 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 12 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 12 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Within the plots using pine agroforestry, cover crop type was found to be NOT significant (p = 0.35) using a linear mixed-effects model with MBN as the response variable, cc_type as the fixed effect, and (1 / year) as the random intercept.
model_mbn_pin_cc <- lmer(MBIO_N ~ cc_type + (1 | year), data = datPIN)
# Summarize the model results
summary(model_mbn_pin_cc)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ cc_type + (1 | year)
## Data: datPIN
##
## REML criterion at convergence: 173.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.4883 -0.5032 -0.1349 0.3812 2.9771
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 629.2 25.08
## Residual 878.7 29.64
## Number of obs: 21, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.054 19.718 4.575 0.206 0.846
## cc_typeradish-oat 26.889 18.043 15.116 1.490 0.157
## cc_typeradish-rye 15.558 18.748 15.043 0.830 0.420
## cc_typeradish-vetch 32.115 18.748 15.043 1.713 0.107
##
## Correlation of Fixed Effects:
## (Intr) cc_typrdsh-t cc_typrdsh-r
## cc_typrdsh-t -0.503
## cc_typrdsh-r -0.475 0.520
## cc_typrdsh-v -0.475 0.520 0.500
# Extract fixed effects
fixef(model_mbn_pin_cc)
## (Intercept) cc_typeradish-oat cc_typeradish-rye cc_typeradish-vetch
## 4.053872 26.889128 15.558200 32.115400
# Extract random effects (conditional modes)
ranef(model_mbn_pin_cc)
## $year
## (Intercept)
## 2021 26.25189
## 2022 -14.77864
## 2023 -11.47325
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_pin_cc) # residuals vs fitted
qqnorm(resid(model_mbn_pin_cc)); qqline(resid(model_mbn_pin_cc)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with cc_type as a factor for pairwise comparisons
datPIN$cc_type_f <- factor(datPIN$cc_type)
lmer_model_mbn_pin_cc_factor <- lmer(MBIO_N ~ cc_type_f + (1 | year), data = datPIN)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ cc_type_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `cc_type_f` factor.
emmeans_mbn_pin_cc_result <- emmeans(lmer_model_mbn_pin_cc_factor, pairwise ~ cc_type_f, adjust = "tukey")
# View the results
emmeans_mbn_pin_cc_result
## $emmeans
## cc_type_f emmean SE df lower.CL upper.CL
## radish 4.05 19.8 4.50 -48.5 56.6
## radish-oat 30.94 18.9 3.85 -22.2 84.1
## radish-rye 19.61 19.8 4.50 -33.0 72.2
## radish-vetch 36.17 19.8 4.50 -16.4 88.7
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -26.89 18.1 15.1 -1.486 0.4692
## radish - (radish-rye) -15.56 18.7 15.0 -0.830 0.8395
## radish - (radish-vetch) -32.12 18.7 15.0 -1.713 0.3514
## (radish-oat) - (radish-rye) 11.33 18.1 15.1 0.626 0.9220
## (radish-oat) - (radish-vetch) -5.23 18.1 15.1 -0.289 0.9913
## (radish-rye) - (radish-vetch) -16.56 18.7 15.0 -0.883 0.8135
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_pin_cc <- mixed(
MBIO_N ~ cc_type_f + (1 | year),
data = datPIN,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f
## Warning: Due to missing values, reduced number of observations to 21
# Nice ANOVA table
print(nice(anova_kr_mbn_pin_cc), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ cc_type_f + (1 | year)
## Data: datPIN
## Effect df F p.value
## 1 cc_type_f 3, 15.04 1.17 .354
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_pin_cc <- anova_kr_mbn_pin_cc$Anova
car_table_mbn_pin_cc # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.cc_pin <- emmeans(model_mbn_pin_cc, "cc_type")
pairs(MBIO_N.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## radish - (radish-oat) -26.89 18.1 15.1 -1.486 0.4692
## radish - (radish-rye) -15.56 18.7 15.0 -0.830 0.8395
## radish - (radish-vetch) -32.12 18.7 15.0 -1.713 0.3514
## (radish-oat) - (radish-rye) 11.33 18.1 15.1 0.626 0.9220
## (radish-oat) - (radish-vetch) -5.23 18.1 15.1 -0.289 0.9913
## (radish-rye) - (radish-vetch) -16.56 18.7 15.0 -0.883 0.8135
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
cld(MBIO_N.emm.s.cc_pin, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## cc_type emmean SE df lower.CL upper.CL .group
## radish 4.05 19.8 4.50 -75.1 83.2 a
## radish-rye 19.61 19.8 4.50 -59.5 98.7 a
## radish-oat 30.94 18.9 3.85 -52.0 113.9 a
## radish-vetch 36.17 19.8 4.50 -43.0 115.3 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 4 estimates
## P value adjustment: tukey method for comparing a family of 4 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 3 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 3 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
Tillage was found to be NOT significant (p = 0.44) using a linear mixed-effects model with MBN as the response variable, tillage as the fixed effect, and (1 / year) as the random intercept.
model_mbn_till <- lmer(MBIO_N ~ tillage + (1 | year), data = till_nocntrl)
# Summarize the model results
summary(model_mbn_till)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ tillage + (1 | year)
## Data: till_nocntrl
##
## REML criterion at convergence: 420.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.0640 -0.6022 -0.3433 0.3190 3.8706
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 64.34 8.021
## Residual 873.82 29.561
## Number of obs: 45, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 23.012 7.543 4.124 3.051 0.0365 *
## tillageno_till 6.903 8.893 41.729 0.776 0.4420
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## tillagn_tll -0.514
# Extract fixed effects
fixef(model_mbn_till)
## (Intercept) tillageno_till
## 23.012272 6.903479
# Extract random effects (conditional modes)
ranef(model_mbn_till)
## $year
## (Intercept)
## 2021 6.338373
## 2022 -1.643391
## 2023 -4.694983
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_till) # residuals vs fitted
qqnorm(resid(model_mbn_till)); qqline(resid(model_mbn_till)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with tillage as a factor for pairwise comparisons
till_nocntrl$tillage_f <- factor(till_nocntrl$tillage)
lmer_model_mbn_till_factor <- lmer(MBIO_N ~ tillage_f + (1 | year), data = till_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
# The `pairwise ~ tillage_f` argument tells emmeans to perform pairwise comparisons
# for the levels of the `tillage_f` factor.
emmeans_mbn_till_result <- emmeans(lmer_model_mbn_till_factor, pairwise ~ tillage_f, adjust = "tukey")
# View the results
emmeans_mbn_till_result
## $emmeans
## tillage_f emmean SE df lower.CL upper.CL
## min_till 23.0 7.61 3.53 0.739 45.3
## no_till 29.9 8.41 4.54 7.626 52.2
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## min_till - no_till -6.9 8.94 41.5 -0.772 0.4445
##
## Degrees-of-freedom method: kenward-roger
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_till <- mixed(
MBIO_N ~ tillage_f + (1 | year),
data = till_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: tillage_f
## Warning: Due to missing values, reduced number of observations to 45
# Nice ANOVA table
print(nice(anova_kr_mbn_till), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ tillage_f + (1 | year)
## Data: till_nocntrl
## Effect df F p.value
## 1 tillage_f 1, 41.50 0.60 .444
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
# If you specifically want a car::Anova-style table object for the fitted model,
# afex stores it at anova_kr$Anova (already using KR via pbkrtest):
car_table_mbn_till <- anova_kr_mbn_till$Anova
car_table_mbn_till # prints a car::Anova-like table with F-tests and KR dfs
## NULL
MBIO_N.emm.s.till <- emmeans(model_mbn_till, "tillage")
pairs(MBIO_N.emm.s.till, adjust = "tukey", Letters = letters)
## contrast estimate SE df t.ratio p.value
## min_till - no_till -6.9 8.94 41.5 -0.772 0.4445
##
## Degrees-of-freedom method: kenward-roger
cld(MBIO_N.emm.s.till, adjust = "tukey", Letters = letters)
## Note: adjust = "tukey" was changed to "sidak"
## because "tukey" is only appropriate for one set of pairwise comparisons
## tillage emmean SE df lower.CL upper.CL .group
## min_till 23.0 7.61 3.53 -5.36 51.4 a
## no_till 29.9 8.41 4.54 2.34 57.5 a
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## Conf-level adjustment: sidak method for 2 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
###USE THESE LETTERS TO INDICATE TREATMENT DIFFERENCE in ALL FIGURES.
## Warning: Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 15 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
Significance Summary:
The interaction between agroforestry tree type and tillage was found to be NOT significant (p = 0.12) using a linear mixed-effects model with MBN as the response variable, agro_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbn_agtil <- lmer(MBIO_N ~ agro_type*tillage + (1 | year), data = ag_nocntrl)
# Summarize the model results
summary(model_mbn_agtil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ agro_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 404.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.2210 -0.4755 -0.2881 0.1608 3.6460
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 60.77 7.795
## Residual 862.13 29.362
## Number of obs: 45, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 30.142 9.399 9.412 3.207 0.0101 *
## agro_typepine -14.601 11.829 40.204 -1.234 0.2242
## tillageno_till -6.260 12.031 39.419 -0.520 0.6057
## agro_typepine:tillageno_till 28.545 17.766 40.092 1.607 0.1160
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) agr_ty tllgn_
## agro_typepn -0.612
## tillagn_tll -0.589 0.468
## agr_typpn:_ 0.411 -0.669 -0.679
# Extract fixed effects
fixef(model_mbn_agtil)
## (Intercept) agro_typepine
## 30.142324 -14.601324
## tillageno_till agro_typepine:tillageno_till
## -6.259907 28.545113
# Extract random effects (conditional modes)
ranef(model_mbn_agtil)
## $year
## (Intercept)
## 2021 5.7897322
## 2022 -0.7473798
## 2023 -5.0423523
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_agtil) # residuals vs fitted
qqnorm(resid(model_mbn_agtil)); qqline(resid(model_mbn_agtil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
lmer_model_mbn_agtil_factor <- lmer(MBIO_N ~ agro_type_f*tillage_f + (1 | year), data = ag_nocntrl)
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_mbn_agtil_result <- emmeans(lmer_model_mbn_agtil_factor, pairwise ~ agro_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_mbn_agtil_result
## $emmeans
## agro_type_f tillage_f emmean SE df lower.CL upper.CL
## pecan min_till 30.1 9.59 7.97 8.00 52.3
## pine min_till 15.5 9.60 9.35 -6.05 37.1
## pecan no_till 23.9 10.10 10.11 1.34 46.4
## pine no_till 37.8 11.10 12.65 13.69 62.0
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## pecan min_till - pine min_till 14.60 12.0 40.0 1.218 0.6191
## pecan min_till - pecan no_till 6.26 12.0 39.1 0.520 0.9537
## pecan min_till - pine no_till -7.68 12.8 39.1 -0.602 0.9307
## pine min_till - pecan no_till -8.34 12.4 39.7 -0.672 0.9072
## pine min_till - pine no_till -22.29 13.3 40.2 -1.681 0.3467
## pecan no_till - pine no_till -13.94 13.2 39.2 -1.053 0.7196
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 4 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_agtil <- mixed(
MBIO_N ~ agro_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: agro_type_f, tillage
## Warning: Due to missing values, reduced number of observations to 45
# Nice ANOVA table
print(nice(anova_kr_mbn_agtil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ agro_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 agro_type_f 1, 39.29 0.00 .971
## 2 tillage 1, 39.58 0.81 .375
## 3 agro_type_f:tillage 1, 39.88 2.53 .120
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
The interaction between cover crop type and tillage was found to be NOT significant (p = 0.70) using a linear mixed-effects model with MBN as the response variable, cc_type*tillage as the fixed effect, and (1 / year) as the random intercept.
# Fit a linear mixed-effects model
model_mbn_cctil <- lmer(MBIO_N ~ cc_type*tillage + (1 | year), data = ag_nocntrl)
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
# Summarize the model results
summary(model_mbn_cctil)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: MBIO_N ~ cc_type * tillage + (1 | year)
## Data: ag_nocntrl
##
## REML criterion at convergence: 268.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.14692 -0.38914 -0.02814 0.38914 2.14692
##
## Random effects:
## Groups Name Variance Std.Dev.
## year (Intercept) 68.07 8.251
## Residual 951.76 30.851
## Number of obs: 45, groups: year, 3
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 39.742 18.438 24.880 2.155 0.0410
## cc_typeoat-clover -15.743 28.285 24.856 -0.557 0.5828
## cc_typeoat-vetch 20.467 28.285 24.856 0.724 0.4761
## cc_typeradish -33.728 25.189 24.460 -1.339 0.1929
## cc_typeradish-oat -10.662 25.189 24.460 -0.423 0.6758
## cc_typeradish-rye -25.337 25.189 24.460 -1.006 0.3243
## cc_typeradish-vetch -27.075 25.189 24.460 -1.075 0.2929
## cc_typerye -20.198 25.189 24.460 -0.802 0.4304
## cc_typerye-clover -25.003 28.285 24.856 -0.884 0.3852
## cc_typerye-vetch -23.244 35.934 25.084 -0.647 0.5236
## tillageno_till -5.849 25.189 24.460 -0.232 0.8183
## cc_typeoat-clover:tillageno_till -7.316 39.828 24.460 -0.184 0.8558
## cc_typeoat-vetch:tillageno_till -5.624 45.580 24.718 -0.123 0.9028
## cc_typeradish:tillageno_till 7.993 37.875 24.687 0.211 0.8346
## cc_typeradish-oat:tillageno_till 9.577 35.623 24.460 0.269 0.7903
## cc_typeradish-rye:tillageno_till 25.911 37.875 24.687 0.684 0.5003
## cc_typeradish-vetch:tillageno_till 71.647 37.875 24.687 1.892 0.0703
## cc_typerye:tillageno_till 4.819 35.623 24.460 0.135 0.8935
## cc_typerye-vetch:tillageno_till 7.068 45.580 24.718 0.155 0.8780
##
## (Intercept) *
## cc_typeoat-clover
## cc_typeoat-vetch
## cc_typeradish
## cc_typeradish-oat
## cc_typeradish-rye
## cc_typeradish-vetch
## cc_typerye
## cc_typerye-clover
## cc_typerye-vetch
## tillageno_till
## cc_typeoat-clover:tillageno_till
## cc_typeoat-vetch:tillageno_till
## cc_typeradish:tillageno_till
## cc_typeradish-oat:tillageno_till
## cc_typeradish-rye:tillageno_till
## cc_typeradish-vetch:tillageno_till .
## cc_typerye:tillageno_till
## cc_typerye-vetch:tillageno_till
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 19 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
## fit warnings:
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
# Extract fixed effects
fixef(model_mbn_cctil)
## (Intercept) cc_typeoat-clover
## 39.741667 -15.742695
## cc_typeoat-vetch cc_typeradish
## 20.467305 -33.728333
## cc_typeradish-oat cc_typeradish-rye
## -10.662333 -25.337333
## cc_typeradish-vetch cc_typerye
## -27.074667 -20.198333
## cc_typerye-clover cc_typerye-vetch
## -25.002695 -23.244475
## tillageno_till cc_typeoat-clover:tillageno_till
## -5.849333 -7.315667
## cc_typeoat-vetch:tillageno_till cc_typeradish:tillageno_till
## -5.624447 7.992972
## cc_typeradish-oat:tillageno_till cc_typeradish-rye:tillageno_till
## 9.576667 25.910972
## cc_typeradish-vetch:tillageno_till cc_typerye:tillageno_till
## 71.647305 4.818667
## cc_typerye-vetch:tillageno_till
## 7.067613
# Extract random effects (conditional modes)
ranef(model_mbn_cctil)
## $year
## (Intercept)
## 2021 5.9722480
## 2022 -0.6940561
## 2023 -5.2781919
##
## with conditional variances for "year"
## ---- Model diagnostics (recommended) ----
par(mfrow = c(1, 2))
plot(model_mbn_cctil) # residuals vs fitted
qqnorm(resid(model_mbn_cctil)); qqline(resid(model_mbn_cctil)) # normal Q-Q
par(mfrow = c(1, 1))
# Refit the model with agro_type as a factor for pairwise comparisons
ag_nocntrl$cc_type_f <- factor(ag_nocntrl$cc_type)
ag_nocntrl$tillage_f <- factor(ag_nocntrl$tillage)
lmer_model_mbn_cctil_factor <- lmer(MBIO_N ~ cc_type_f*tillage_f + (1 | year), data = ag_nocntrl)
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
# Use emmeans for pairwise comparisons, adjusting p-values with Tukey's method
emmeans_mbn_cctil_result <- emmeans(lmer_model_mbn_cctil_factor, pairwise ~ cc_type_f*tillage_f, adjust = "tukey")
# View the results
emmeans_mbn_cctil_result
## $emmeans
## cc_type_f tillage_f emmean SE df lower.CL upper.CL
## oat min_till 39.74 18.4 24.6 1.74 77.7
## oat-clover min_till 24.00 22.8 25.5 -22.97 71.0
## oat-vetch min_till 60.21 22.8 25.5 13.24 107.2
## radish min_till 6.01 18.4 24.6 -31.99 44.0
## radish-oat min_till 29.08 18.4 24.6 -8.93 67.1
## radish-rye min_till 14.40 18.4 24.6 -23.60 52.4
## radish-vetch min_till 12.67 18.4 24.6 -25.34 50.7
## rye min_till 19.54 18.4 24.6 -18.46 57.5
## rye-clover min_till 14.74 22.8 25.5 -32.23 61.7
## rye-vetch min_till 16.50 32.4 26.0 -50.06 83.1
## oat no_till 33.89 18.4 24.6 -4.11 71.9
## oat-clover no_till 10.83 22.8 25.5 -36.13 57.8
## oat-vetch no_till 48.74 32.4 26.0 -17.83 115.3
## radish no_till 8.16 22.8 25.5 -38.81 55.1
## radish-oat no_till 32.81 18.4 24.6 -5.20 70.8
## radish-rye no_till 34.47 22.8 25.5 -12.50 81.4
## radish-vetch no_till 78.46 22.8 25.5 31.50 125.4
## rye no_till 18.51 18.4 24.6 -19.49 56.5
## rye-clover no_till nonEst NA NA NA NA
## rye-vetch no_till 17.72 22.8 25.5 -29.25 64.7
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio
## oat min_till - (oat-clover min_till) 15.743 28.6 24.6 0.551
## oat min_till - (oat-vetch min_till) -20.467 28.6 24.6 -0.717
## oat min_till - radish min_till 33.728 25.2 24.1 1.339
## oat min_till - (radish-oat min_till) 10.662 25.2 24.1 0.423
## oat min_till - (radish-rye min_till) 25.337 25.2 24.1 1.006
## oat min_till - (radish-vetch min_till) 27.075 25.2 24.1 1.075
## oat min_till - rye min_till 20.198 25.2 24.1 0.802
## oat min_till - (rye-clover min_till) 25.003 28.6 24.6 0.875
## oat min_till - (rye-vetch min_till) 23.244 36.6 24.8 0.634
## oat min_till - oat no_till 5.849 25.2 24.1 0.232
## oat min_till - (oat-clover no_till) 28.908 28.6 24.6 1.012
## oat min_till - (oat-vetch no_till) -8.994 36.6 24.8 -0.245
## oat min_till - radish no_till 31.585 28.6 24.6 1.106
## oat min_till - (radish-oat no_till) 6.935 25.2 24.1 0.275
## oat min_till - (radish-rye no_till) 5.276 28.6 24.6 0.185
## oat min_till - (radish-vetch no_till) -38.723 28.6 24.6 -1.356
## oat min_till - rye no_till 21.229 25.2 24.1 0.843
## oat min_till - (rye-clover no_till) nonEst NA NA NA
## oat min_till - (rye-vetch no_till) 22.026 28.6 24.6 0.771
## (oat-clover min_till) - (oat-vetch min_till) -36.210 30.9 24.1 -1.174
## (oat-clover min_till) - radish min_till 17.986 28.6 24.6 0.630
## (oat-clover min_till) - (radish-oat min_till) -5.080 28.6 24.6 -0.178
## (oat-clover min_till) - (radish-rye min_till) 9.595 28.6 24.6 0.336
## (oat-clover min_till) - (radish-vetch min_till) 11.332 28.6 24.6 0.397
## (oat-clover min_till) - rye min_till 4.456 28.6 24.6 0.156
## (oat-clover min_till) - (rye-clover min_till) 9.260 30.9 24.1 0.300
## (oat-clover min_till) - (rye-vetch min_till) 7.502 38.5 24.5 0.195
## (oat-clover min_till) - oat no_till -9.893 28.6 24.6 -0.346
## (oat-clover min_till) - (oat-clover no_till) 13.165 30.9 24.1 0.427
## (oat-clover min_till) - (oat-vetch no_till) -24.736 38.5 24.5 -0.643
## (oat-clover min_till) - radish no_till 15.842 30.9 24.1 0.514
## (oat-clover min_till) - (radish-oat no_till) -8.808 28.6 24.6 -0.308
## (oat-clover min_till) - (radish-rye no_till) -10.467 30.9 24.1 -0.339
## (oat-clover min_till) - (radish-vetch no_till) -54.466 30.9 24.1 -1.765
## (oat-clover min_till) - rye no_till 5.486 28.6 24.6 0.192
## (oat-clover min_till) - (rye-clover no_till) nonEst NA NA NA
## (oat-clover min_till) - (rye-vetch no_till) 6.284 30.9 24.1 0.204
## (oat-vetch min_till) - radish min_till 54.196 28.6 24.6 1.898
## (oat-vetch min_till) - (radish-oat min_till) 31.130 28.6 24.6 1.090
## (oat-vetch min_till) - (radish-rye min_till) 45.805 28.6 24.6 1.604
## (oat-vetch min_till) - (radish-vetch min_till) 47.542 28.6 24.6 1.665
## (oat-vetch min_till) - rye min_till 40.666 28.6 24.6 1.424
## (oat-vetch min_till) - (rye-clover min_till) 45.470 30.9 24.1 1.474
## (oat-vetch min_till) - (rye-vetch min_till) 43.712 38.5 24.5 1.137
## (oat-vetch min_till) - oat no_till 26.317 28.6 24.6 0.921
## (oat-vetch min_till) - (oat-clover no_till) 49.375 30.9 24.1 1.600
## (oat-vetch min_till) - (oat-vetch no_till) 11.474 38.5 24.5 0.298
## (oat-vetch min_till) - radish no_till 52.052 30.9 24.1 1.687
## (oat-vetch min_till) - (radish-oat no_till) 27.402 28.6 24.6 0.959
## (oat-vetch min_till) - (radish-rye no_till) 25.743 30.9 24.1 0.834
## (oat-vetch min_till) - (radish-vetch no_till) -18.256 30.9 24.1 -0.592
## (oat-vetch min_till) - rye no_till 41.696 28.6 24.6 1.460
## (oat-vetch min_till) - (rye-clover no_till) nonEst NA NA NA
## (oat-vetch min_till) - (rye-vetch no_till) 42.493 30.9 24.1 1.377
## radish min_till - (radish-oat min_till) -23.066 25.2 24.1 -0.916
## radish min_till - (radish-rye min_till) -8.391 25.2 24.1 -0.333
## radish min_till - (radish-vetch min_till) -6.654 25.2 24.1 -0.264
## radish min_till - rye min_till -13.530 25.2 24.1 -0.537
## radish min_till - (rye-clover min_till) -8.726 28.6 24.6 -0.306
## radish min_till - (rye-vetch min_till) -10.484 36.6 24.8 -0.286
## radish min_till - oat no_till -27.879 25.2 24.1 -1.107
## radish min_till - (oat-clover no_till) -4.821 28.6 24.6 -0.169
## radish min_till - (oat-vetch no_till) -42.722 36.6 24.8 -1.166
## radish min_till - radish no_till -2.144 28.6 24.6 -0.075
## radish min_till - (radish-oat no_till) -26.793 25.2 24.1 -1.064
## radish min_till - (radish-rye no_till) -28.453 28.6 24.6 -0.996
## radish min_till - (radish-vetch no_till) -72.452 28.6 24.6 -2.537
## radish min_till - rye no_till -12.499 25.2 24.1 -0.496
## radish min_till - (rye-clover no_till) nonEst NA NA NA
## radish min_till - (rye-vetch no_till) -11.702 28.6 24.6 -0.410
## (radish-oat min_till) - (radish-rye min_till) 14.675 25.2 24.1 0.583
## (radish-oat min_till) - (radish-vetch min_till) 16.412 25.2 24.1 0.652
## (radish-oat min_till) - rye min_till 9.536 25.2 24.1 0.379
## (radish-oat min_till) - (rye-clover min_till) 14.340 28.6 24.6 0.502
## (radish-oat min_till) - (rye-vetch min_till) 12.582 36.6 24.8 0.343
## (radish-oat min_till) - oat no_till -4.813 25.2 24.1 -0.191
## (radish-oat min_till) - (oat-clover no_till) 18.245 28.6 24.6 0.639
## (radish-oat min_till) - (oat-vetch no_till) -19.656 36.6 24.8 -0.536
## (radish-oat min_till) - radish no_till 20.922 28.6 24.6 0.733
## (radish-oat min_till) - (radish-oat no_till) -3.727 25.2 24.1 -0.148
## (radish-oat min_till) - (radish-rye no_till) -5.387 28.6 24.6 -0.189
## (radish-oat min_till) - (radish-vetch no_till) -49.386 28.6 24.6 -1.729
## (radish-oat min_till) - rye no_till 10.567 25.2 24.1 0.419
## (radish-oat min_till) - (rye-clover no_till) nonEst NA NA NA
## (radish-oat min_till) - (rye-vetch no_till) 11.364 28.6 24.6 0.398
## (radish-rye min_till) - (radish-vetch min_till) 1.737 25.2 24.1 0.069
## (radish-rye min_till) - rye min_till -5.139 25.2 24.1 -0.204
## (radish-rye min_till) - (rye-clover min_till) -0.335 28.6 24.6 -0.012
## (radish-rye min_till) - (rye-vetch min_till) -2.093 36.6 24.8 -0.057
## (radish-rye min_till) - oat no_till -19.488 25.2 24.1 -0.774
## (radish-rye min_till) - (oat-clover no_till) 3.570 28.6 24.6 0.125
## (radish-rye min_till) - (oat-vetch no_till) -34.331 36.6 24.8 -0.937
## (radish-rye min_till) - radish no_till 6.247 28.6 24.6 0.219
## (radish-rye min_till) - (radish-oat no_till) -18.402 25.2 24.1 -0.731
## (radish-rye min_till) - (radish-rye no_till) -20.062 28.6 24.6 -0.702
## (radish-rye min_till) - (radish-vetch no_till) -64.061 28.6 24.6 -2.243
## (radish-rye min_till) - rye no_till -4.108 25.2 24.1 -0.163
## (radish-rye min_till) - (rye-clover no_till) nonEst NA NA NA
## (radish-rye min_till) - (rye-vetch no_till) -3.311 28.6 24.6 -0.116
## (radish-vetch min_till) - rye min_till -6.876 25.2 24.1 -0.273
## (radish-vetch min_till) - (rye-clover min_till) -2.072 28.6 24.6 -0.073
## (radish-vetch min_till) - (rye-vetch min_till) -3.830 36.6 24.8 -0.105
## (radish-vetch min_till) - oat no_till -21.225 25.2 24.1 -0.843
## (radish-vetch min_till) - (oat-clover no_till) 1.833 28.6 24.6 0.064
## (radish-vetch min_till) - (oat-vetch no_till) -36.068 36.6 24.8 -0.984
## (radish-vetch min_till) - radish no_till 4.510 28.6 24.6 0.158
## (radish-vetch min_till) - (radish-oat no_till) -20.140 25.2 24.1 -0.800
## (radish-vetch min_till) - (radish-rye no_till) -21.799 28.6 24.6 -0.763
## (radish-vetch min_till) - (radish-vetch no_till) -65.798 28.6 24.6 -2.304
## (radish-vetch min_till) - rye no_till -5.846 25.2 24.1 -0.232
## (radish-vetch min_till) - (rye-clover no_till) nonEst NA NA NA
## (radish-vetch min_till) - (rye-vetch no_till) -5.048 28.6 24.6 -0.177
## rye min_till - (rye-clover min_till) 4.804 28.6 24.6 0.168
## rye min_till - (rye-vetch min_till) 3.046 36.6 24.8 0.083
## rye min_till - oat no_till -14.349 25.2 24.1 -0.570
## rye min_till - (oat-clover no_till) 8.709 28.6 24.6 0.305
## rye min_till - (oat-vetch no_till) -29.192 36.6 24.8 -0.797
## rye min_till - radish no_till 11.386 28.6 24.6 0.399
## rye min_till - (radish-oat no_till) -13.263 25.2 24.1 -0.527
## rye min_till - (radish-rye no_till) -14.923 28.6 24.6 -0.522
## rye min_till - (radish-vetch no_till) -58.922 28.6 24.6 -2.063
## rye min_till - rye no_till 1.031 25.2 24.1 0.041
## rye min_till - (rye-clover no_till) nonEst NA NA NA
## rye min_till - (rye-vetch no_till) 1.828 28.6 24.6 0.064
## (rye-clover min_till) - (rye-vetch min_till) -1.758 38.5 24.5 -0.046
## (rye-clover min_till) - oat no_till -19.153 28.6 24.6 -0.671
## (rye-clover min_till) - (oat-clover no_till) 3.905 30.9 24.1 0.127
## (rye-clover min_till) - (oat-vetch no_till) -33.996 38.5 24.5 -0.884
## (rye-clover min_till) - radish no_till 6.582 30.9 24.1 0.213
## (rye-clover min_till) - (radish-oat no_till) -18.068 28.6 24.6 -0.633
## (rye-clover min_till) - (radish-rye no_till) -19.727 30.9 24.1 -0.639
## (rye-clover min_till) - (radish-vetch no_till) -63.726 30.9 24.1 -2.066
## (rye-clover min_till) - rye no_till -3.774 28.6 24.6 -0.132
## (rye-clover min_till) - (rye-clover no_till) nonEst NA NA NA
## (rye-clover min_till) - (rye-vetch no_till) -2.977 30.9 24.1 -0.096
## (rye-vetch min_till) - oat no_till -17.395 36.6 24.8 -0.475
## (rye-vetch min_till) - (oat-clover no_till) 5.663 38.5 24.5 0.147
## (rye-vetch min_till) - (oat-vetch no_till) -32.238 43.6 24.1 -0.739
## (rye-vetch min_till) - radish no_till 8.340 38.5 24.5 0.217
## (rye-vetch min_till) - (radish-oat no_till) -16.309 36.6 24.8 -0.445
## (rye-vetch min_till) - (radish-rye no_till) -17.969 38.5 24.5 -0.467
## (rye-vetch min_till) - (radish-vetch no_till) -61.968 38.5 24.5 -1.611
## (rye-vetch min_till) - rye no_till -2.015 36.6 24.8 -0.055
## (rye-vetch min_till) - (rye-clover no_till) nonEst NA NA NA
## (rye-vetch min_till) - (rye-vetch no_till) -1.218 38.5 24.5 -0.032
## oat no_till - (oat-clover no_till) 23.058 28.6 24.6 0.807
## oat no_till - (oat-vetch no_till) -14.843 36.6 24.8 -0.405
## oat no_till - radish no_till 25.735 28.6 24.6 0.901
## oat no_till - (radish-oat no_till) 1.086 25.2 24.1 0.043
## oat no_till - (radish-rye no_till) -0.574 28.6 24.6 -0.020
## oat no_till - (radish-vetch no_till) -44.573 28.6 24.6 -1.561
## oat no_till - rye no_till 15.380 25.2 24.1 0.611
## oat no_till - (rye-clover no_till) nonEst NA NA NA
## oat no_till - (rye-vetch no_till) 16.177 28.6 24.6 0.566
## (oat-clover no_till) - (oat-vetch no_till) -37.901 38.5 24.5 -0.985
## (oat-clover no_till) - radish no_till 2.677 30.9 24.1 0.087
## (oat-clover no_till) - (radish-oat no_till) -21.973 28.6 24.6 -0.769
## (oat-clover no_till) - (radish-rye no_till) -23.632 30.9 24.1 -0.766
## (oat-clover no_till) - (radish-vetch no_till) -67.631 30.9 24.1 -2.192
## (oat-clover no_till) - rye no_till -7.679 28.6 24.6 -0.269
## (oat-clover no_till) - (rye-clover no_till) nonEst NA NA NA
## (oat-clover no_till) - (rye-vetch no_till) -6.881 30.9 24.1 -0.223
## (oat-vetch no_till) - radish no_till 40.578 38.5 24.5 1.055
## (oat-vetch no_till) - (radish-oat no_till) 15.929 36.6 24.8 0.435
## (oat-vetch no_till) - (radish-rye no_till) 14.269 38.5 24.5 0.371
## (oat-vetch no_till) - (radish-vetch no_till) -29.730 38.5 24.5 -0.773
## (oat-vetch no_till) - rye no_till 30.223 36.6 24.8 0.825
## (oat-vetch no_till) - (rye-clover no_till) nonEst NA NA NA
## (oat-vetch no_till) - (rye-vetch no_till) 31.020 38.5 24.5 0.807
## radish no_till - (radish-oat no_till) -24.650 28.6 24.6 -0.863
## radish no_till - (radish-rye no_till) -26.309 30.9 24.1 -0.853
## radish no_till - (radish-vetch no_till) -70.308 30.9 24.1 -2.279
## radish no_till - rye no_till -10.356 28.6 24.6 -0.363
## radish no_till - (rye-clover no_till) nonEst NA NA NA
## radish no_till - (rye-vetch no_till) -9.559 30.9 24.1 -0.310
## (radish-oat no_till) - (radish-rye no_till) -1.659 28.6 24.6 -0.058
## (radish-oat no_till) - (radish-vetch no_till) -45.658 28.6 24.6 -1.599
## (radish-oat no_till) - rye no_till 14.294 25.2 24.1 0.567
## (radish-oat no_till) - (rye-clover no_till) nonEst NA NA NA
## (radish-oat no_till) - (rye-vetch no_till) 15.091 28.6 24.6 0.528
## (radish-rye no_till) - (radish-vetch no_till) -43.999 30.9 24.1 -1.426
## (radish-rye no_till) - rye no_till 15.953 28.6 24.6 0.559
## (radish-rye no_till) - (rye-clover no_till) nonEst NA NA NA
## (radish-rye no_till) - (rye-vetch no_till) 16.750 30.9 24.1 0.543
## (radish-vetch no_till) - rye no_till 59.952 28.6 24.6 2.099
## (radish-vetch no_till) - (rye-clover no_till) nonEst NA NA NA
## (radish-vetch no_till) - (rye-vetch no_till) 60.749 30.9 24.1 1.969
## rye no_till - (rye-clover no_till) nonEst NA NA NA
## rye no_till - (rye-vetch no_till) 0.797 28.6 24.6 0.028
## (rye-clover no_till) - (rye-vetch no_till) nonEst NA NA NA
## p.value
## 1.0000
## 1.0000
## 0.9955
## 1.0000
## 0.9999
## 0.9997
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9999
## 1.0000
## 0.9995
## 1.0000
## 1.0000
## 0.9950
## 1.0000
## NA
## 1.0000
## 0.9990
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9411
## 1.0000
## NA
## 1.0000
## 0.9011
## 0.9996
## 0.9740
## 0.9640
## 0.9917
## 0.9879
## 0.9994
## 1.0000
## 0.9740
## 1.0000
## 0.9591
## 0.9999
## 1.0000
## 1.0000
## 0.9893
## NA
## 0.9939
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9995
## 1.0000
## 0.9991
## 1.0000
## 0.9997
## 0.9999
## 0.5489
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9507
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 0.7327
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 0.6961
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.8305
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.8284
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9729
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## 0.9797
## 1.0000
## NA
## 1.0000
## 0.9999
## 1.0000
## 1.0000
## 1.0000
## 0.7615
## 1.0000
## NA
## 1.0000
## 0.9997
## 1.0000
## 1.0000
## 1.0000
## 1.0000
## NA
## 1.0000
## 1.0000
## 1.0000
## 0.7108
## 1.0000
## NA
## 1.0000
## 1.0000
## 0.9747
## 1.0000
## NA
## 1.0000
## 0.9913
## 1.0000
## NA
## 1.0000
## 0.8124
## NA
## 0.8722
## NA
## 1.0000
## NA
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 19 estimates
## ---- Kenward–Roger ANOVA (F-tests) ----
# Use afex::mixed to compute KR-approximated F-tests for fixed effects.
# This calls lme4 under the hood and produces ANOVA with KR dfs.
anova_kr_mbn_cctil <- mixed(
MBIO_N ~ cc_type_f*tillage + (1 | year),
data = ag_nocntrl,
method = "KR" # Kenward–Roger (Halekoh & Højsgaard, 2014)
)
## Contrasts set to contr.sum for the following variables: cc_type_f, tillage
## Warning: Due to missing values, reduced number of observations to 45
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
## Missing cells for: cc_type_frye-clover:tillageno_till.
## Interpret type III hypotheses with care.
# Nice ANOVA table
print(nice(anova_kr_mbn_cctil), row.names = FALSE)
## Mixed Model Anova Table (Type 3 tests, KR-method)
##
## Model: MBIO_N ~ cc_type_f * tillage + (1 | year)
## Data: ag_nocntrl
## Effect df F p.value
## 1 cc_type_f 9, 24.37 0.87 .565
## 2 tillage 1, 24.49 0.46 .506
## 3 cc_type_f:tillage 8, 24.28 0.69 .697
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
###USE THESE P-values & UPDATE TABLE 1 in YOUR PAPER.
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.329) in bacterial necromass between agroforestry treatments (agroforestry vs. no agroforestry).
# perform anova for total necromass
anova_nect_AGtreat <- aov(MicrobialResidualC_mg_g ~ agro_treatment_f,
data = ag_treats2)
summary(anova_nect_AGtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## agro_treatment_f 1 0.01316 0.01316 1.005 0.329
## Residuals 19 0.24874 0.01309
## 41 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.212) in total necromass between cover crop treatments (cover crop vs. no cover crop).
# perform anova for total necromass
anova_nect_CCtreat <- aov(MicrobialResidualC_mg_g ~ cc_treatment_f, data = dat)
summary(anova_nect_CCtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_treatment_f 1 0.0309 0.03094 1.665 0.212
## Residuals 20 0.3717 0.01859
## 42 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was a statistically significant difference (p = 0.035) in total necromass between cover crop class (mix, mono, control).
# perform anova for total necromass
anova_nect_CCclass <- aov(MicrobialResidualC_mg_g ~ cc_class, data = dat)
summary(anova_nect_CCclass)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_class 2 0.1196 0.05981 4.015 0.0351 *
## Residuals 19 0.2831 0.01490
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 42 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.317) in bacterial necromass between agroforestry treatments (agroforestry vs. no agroforestry).
# perform anova for fungal necromass
anova_necf_AGtreat <- aov(FungalC_mg_g ~ agro_treatment_f,
data = ag_treats2)
summary(anova_necf_AGtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## agro_treatment_f 1 0.0071 0.007101 1.055 0.317
## Residuals 19 0.1279 0.006733
## 41 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.165) in fungal necromass between cover crop treatments (cover crop vs. no cover crop).
# perform anova for fungal necromass
anova_necf_CCtreat <- aov(FungalC_mg_g ~ cc_treatment_f, data = dat)
summary(anova_necf_CCtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_treatment_f 1 0.02107 0.02107 2.074 0.165
## Residuals 20 0.20320 0.01016
## 42 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was a statistically significant difference (p = 0.036) in fungal necromass between cover crop class (mix, mono, control).
# perform anova for fungal necromass
anova_necf_CCclass <- aov(FungalC_mg_g ~ cc_class, data = dat)
summary(anova_necf_CCclass)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_class 2 0.06635 0.03318 3.991 0.0357 *
## Residuals 19 0.15792 0.00831
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 42 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.422) in bacterial necromass between agroforestry treatments (agroforestry vs. no agroforestry).
# perform anova for bacterial necromass
anova_necb_AGtreat <- aov(BacterialC_mg_g ~ agro_treatment_f,
data = ag_treats2)
summary(anova_necb_AGtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## agro_treatment_f 1 0.000927 0.0009271 0.672 0.422
## Residuals 19 0.026209 0.0013794
## 41 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.451) in bacterial necromass between cover crop treatments (cover crop vs. no cover crop).
# perform anova for bacterial necromass
anova_necb_CCtreat <- aov(BacterialC_mg_g ~ cc_treatment_f, data = dat)
summary(anova_necb_CCtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_treatment_f 1 0.00095 0.0009452 0.59 0.451
## Residuals 20 0.03204 0.0016021
## 42 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.067) in bacterial necromass between cover crop class (mix, mono, control).
# perform anova for bacterial necromass
anova_necb_CCclass <- aov(BacterialC_mg_g ~ cc_class, data = dat)
summary(anova_necb_CCclass)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_class 2 0.00817 0.004085 3.128 0.067 .
## Residuals 19 0.02482 0.001306
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 42 observations deleted due to missingness
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.559) in BG activity between agroforestry treatments (agroforestry vs. no agroforestry).
# perform anova for BG
anova_BG_AGtreat <- aov(BG ~ agro_treatment_f,
data = activity_ag)
summary(anova_BG_AGtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## agro_treatment_f 1 38134 38134 0.346 0.559
## Residuals 64 7059013 110297
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.23) in BG activity between cover crop treatments (cover crop vs. no cover crop).
# perform anova for BG
anova_BG_CCtreat <- aov(BG ~ cc_treatment_f, data = activity_ag)
summary(anova_BG_CCtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_treatment_f 1 159434 159434 1.471 0.23
## Residuals 64 6937712 108402
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.483) in BG activity between cover crop class (mix, mono, control).
# perform anova for BG activity
anova_BG_CCclass <- aov(BG ~ cc_class, data = activity_ag)
summary(anova_BG_CCclass)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_class 2 162258 81129 0.737 0.483
## Residuals 63 6934889 110078
Significance Summary:
The ANOVA revealed that there was NOT a statistically significant difference (p = 0.346) in NAG activity between agroforestry treatments (agroforestry vs. no agroforestry).
# perform anova for NAG
anova_NAG_AGtreat <- aov(NAG ~ agro_treatment_f,
data = activity_ag)
summary(anova_NAG_AGtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## agro_treatment_f 1 24467 24467 0.901 0.346
## Residuals 64 1737520 27149
Significance Summary:
The ANOVA revealed that there was a statistically significant difference (p = 0.014) in NAG activity between cover crop treatments (cover crop vs. no cover crop).
# perform anova for NAG
anova_NAG_CCtreat <- aov(NAG ~ cc_treatment_f, data = activity_ag)
summary(anova_NAG_CCtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_treatment_f 1 161210 161210 6.445 0.0136 *
## Residuals 64 1600777 25012
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Significance Summary:
The ANOVA revealed that there was a statistically significant difference (p = 0.044) in NAG activity between cover crop class (mix, mono, control).
# perform anova for BG activity
anova_NAG_CCclass <- aov(NAG ~ cc_class, data = activity_ag)
summary(anova_NAG_CCclass)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_class 2 166840 83420 3.295 0.0436 *
## Residuals 63 1595146 25320
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Significance Summary:
The ANOVA revealed that there was a statistically significant difference (p = 0.011) in PHOS activity between agroforestry treatments (agroforestry vs. no agroforestry).
# perform anova for PHOS
anova_PHOS_AGtreat <- aov(PHOS ~ agro_treatment_f,
data = activity_ag)
summary(anova_PHOS_AGtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## agro_treatment_f 1 3012505 3012505 6.91 0.0107 *
## Residuals 64 27902032 435969
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Significance Summary:
The ANOVA revealed that there was a statistically significant difference (p < 0.001) in PHOS activity between cover crop treatments (cover crop vs. no cover crop).
# perform anova for PHOS
anova_PHOS_CCtreat <- aov(PHOS ~ cc_treatment_f, data = activity_ag)
summary(anova_PHOS_CCtreat)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_treatment_f 1 14649717 14649717 57.65 1.69e-10 ***
## Residuals 64 16264820 254138
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Significance Summary:
The ANOVA revealed that there was XXX a statistically significant difference (p = XXX) in PHOS activity between cover crop class (mix, mono, control).
# perform anova for PHOS activity
anova_PHOS_CCclass <- aov(PHOS ~ cc_class, data = activity_ag)
summary(anova_PHOS_CCclass)
## Df Sum Sq Mean Sq F value Pr(>F)
## cc_class 2 15304823 7652411 30.89 4.49e-10 ***
## Residuals 63 15609714 247773
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1