Show the code
DT::datatable(dfms$dfm_6d, options=list(pageLength=5))WT NeRh50 maximum amplitudes and decay rate constants for representative SSME transient currents recorded at pH5-pH8Manuscript figure 6d shows WT maximum amplitude and decay rate constant variation for representative SSME transient currents recorded at pH5-pH8 (figure 6d).
The data used for the figure are shown in ?@tbl-data-6d
We use linear models for amplitude and decay rate as dependent variables, with pH as the independent factor, checking fit in Figure 1.
amplitude ~ group and decayrate ~ group. The heteroscadicity spline is odd, but the datapoints are not concerning. There is no strong evidence of non-normality of residuals.
As the model fit is acceptable, we estimate contrasts in Table 2.
EMM <- emmeans::emmeans(model6d_amp_lm, ~ pH)
confint(emmeans::contrast(EMM, "pairwise", adjust="sidak")) |>
kableExtra::kbl(digits=3) |>
kableExtra::kable_styling(
bootstrap_options = c("hover", "responsive")
)
EMM <- emmeans::emmeans(model6d_k_lm, ~ pH)
confint(emmeans::contrast(EMM, "pairwise", adjust="sidak")) |>
kableExtra::kbl(digits=3) |>
kableExtra::kable_styling(
bootstrap_options = c("hover", "responsive")
)| contrast | estimate | SE | df | lower.CL | upper.CL |
|---|---|---|---|---|---|
| pH5 - pH6 | -0.036 | 0.138 | 26 | -0.428 | 0.355 |
| pH5 - pH7 | -0.192 | 0.118 | 26 | -0.529 | 0.146 |
| pH5 - pH8 | -1.219 | 0.118 | 26 | -1.556 | -0.882 |
| pH6 - pH7 | -0.155 | 0.131 | 26 | -0.529 | 0.218 |
| pH6 - pH8 | -1.182 | 0.131 | 26 | -1.556 | -0.809 |
| pH7 - pH8 | -1.027 | 0.111 | 26 | -1.343 | -0.712 |
| contrast | estimate | SE | df | lower.CL | upper.CL |
|---|---|---|---|---|---|
| pH5 - pH6 | 5.368 | 5.451 | 20 | -10.536 | 21.271 |
| pH5 - pH7 | -3.140 | 4.832 | 20 | -17.236 | 10.957 |
| pH5 - pH8 | -4.824 | 4.632 | 20 | -18.339 | 8.691 |
| pH6 - pH7 | -8.507 | 4.832 | 20 | -22.604 | 5.590 |
| pH6 - pH8 | -10.191 | 4.632 | 20 | -23.706 | 3.324 |
| pH7 - pH8 | -1.684 | 3.885 | 20 | -13.018 | 9.650 |
For decay rate constant, all contrasts include zero in the 95% confidence interval, so we conclude that there are no differences in decay rate constant for each pH condition. There are contrasts that do not include zero for the maximum amplitude data, but only for those contrasts involving pH8.
We plot the data, indicating P-values for the contrasts in Figure 2.
# Get p-values, accounting for heteroscedasticity and multiple testing
# Also generate group1 and group2 columns
EMM_amp <- as.data.frame(pairs(emmeans::emmeans(model6d_amp_lm, ~ pH),
adjust="sidak")) |>
tidyr::separate(contrast, into=c("group1", "group2"), sep=" - ") |>
dplyr::mutate(y.position=2.5) |>
rstatix::add_significance()
EMM_k <- as.data.frame(pairs(emmeans::emmeans(model6d_k_lm, ~ pH),
adjust="sidak")) |>
tidyr::separate(contrast, into=c("group1", "group2"), sep=" - ") |>
dplyr::mutate(y.position=70) |>
rstatix::add_significance()
p6d_amp <- ggplot2::ggplot(dfms$dfm_6d,
ggplot2::aes(x=pH, y=amplitude, color=pH)) +
ggplot2::geom_boxplot(outlier.shape = NA) +
ggplot2::geom_jitter() +
ggplot2::labs(y="Maximum amplitude (nA)") +
ggplot2::ylim(0, 4.5) +
ggplot2::theme_minimal() +
ggpubr::stat_pvalue_manual(EMM_amp,
label="p = {scales::pvalue(p.value)}",
size=3, step.increase=0.1)
p6d_k <- ggplot2::ggplot(dfms$dfm_6d,
ggplot2::aes(x=pH, y=decayrate, color=pH)) +
ggplot2::geom_boxplot(outlier.shape = NA) +
ggplot2::geom_jitter() +
ggplot2::labs(y="Decay rate constant k (/s)") +
ggplot2::ylim(0, 105) +
ggplot2::theme_minimal() +
ggpubr::stat_pvalue_manual(EMM_k,
label="p = {scales::pvalue(p.value)}",
size=3, step.increase=0.15)
p6d_amp
p6d_k
# Write figures to file (commented out for webpage)
#ggplot2::ggsave("assets/images/fig6d_WT_maximum_amplitude.pdf", p6d_amp)
#ggplot2::ggsave("assets/images/fig6d_WT_maximum_amplitude.png", p6d_amp)
#ggplot2::ggsave("assets/images/fig6d_WT_decay_rate_constant.png", p6d_k)
#ggplot2::ggsave("assets/images/fig6d_WT_decay_rate_constant.pdf", p6d_k)