Show the code
DT::datatable(dfms$dfm_6b, options=list(pageLength=5))WT NeRh50 maximum amplitudes and decay rate constants after a 200 mM ammonium pulse in proteoliposomes containing NeRh50 at LPR10, at four pH conditionsManuscript figure 6b shows WT maximum amplitude and decay rate constant variation after a 200 mM ammonium pulse in proteoliposomes containing NeRh50 at LPR10, at four pH conditions (figure 6b)
The data used for the figure are shown in Table 1
We use linear models for amplitude and decay rate as dependent variables, with group as the independent factor, checking fit in Figure 1.
amplitude ~ group and decayrate ~ group. The heteroscadicity spline is odd, but the datapoints are not particularly concerning. There is some evidence of non-normality of residuals in the decay rate constant data, but nothing especially concerning.
As the model fit is acceptable, we estimate contrasts in Table 2.
EMM <- emmeans::emmeans(model6b_amp_lm, ~ group)
confint(emmeans::contrast(EMM, "pairwise", adjust="sidak")) |>
kableExtra::kbl(digits=3) |>
kableExtra::kable_styling(
bootstrap_options = c("hover", "responsive")
)
EMM <- emmeans::emmeans(model6b_k_lm, ~ group)
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 |
|---|---|---|---|---|---|
| pH7 (baseline) - pH7 after pH5 | 0.053 | 0.169 | 13 | -0.471 | 0.578 |
| pH7 (baseline) - pH7 after pH6 | -0.006 | 0.196 | 13 | -0.612 | 0.600 |
| pH7 (baseline) - pH7 after pH8 | 0.097 | 0.180 | 13 | -0.460 | 0.653 |
| pH7 after pH5 - pH7 after pH6 | -0.060 | 0.196 | 13 | -0.666 | 0.546 |
| pH7 after pH5 - pH7 after pH8 | 0.043 | 0.180 | 13 | -0.513 | 0.600 |
| pH7 after pH6 - pH7 after pH8 | 0.103 | 0.205 | 13 | -0.531 | 0.737 |
| contrast | estimate | SE | df | lower.CL | upper.CL |
|---|---|---|---|---|---|
| pH7 (baseline) - pH7 after pH5 | -0.25 | 2.847 | 13 | -9.065 | 8.565 |
| pH7 (baseline) - pH7 after pH6 | -2.17 | 3.288 | 13 | -12.348 | 8.008 |
| pH7 (baseline) - pH7 after pH8 | 7.78 | 3.020 | 13 | -1.569 | 17.129 |
| pH7 after pH5 - pH7 after pH6 | -1.92 | 3.288 | 13 | -12.098 | 8.258 |
| pH7 after pH5 - pH7 after pH8 | 8.03 | 3.020 | 13 | -1.319 | 17.379 |
| pH7 after pH6 - pH7 after pH8 | 9.95 | 3.438 | 13 | -0.695 | 20.595 |
All contrasts include zero in the 95% confidence interval, so we conclude that there are no differences in amplitude and decay rate constant for each pairwise comparison between groups (pH conditions).
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(model6b_amp_lm, ~ group),
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(model6b_k_lm, ~ group),
adjust="sidak")) |>
tidyr::separate(contrast, into=c("group1", "group2"), sep=" - ") |>
dplyr::mutate(y.position=70) |>
rstatix::add_significance()
p6b_amp <- ggplot2::ggplot(dfms$dfm_6b,
ggplot2::aes(x=group, y=amplitude, color=group)) +
ggplot2::geom_boxplot(outlier.shape = NA) +
ggplot2::geom_jitter() +
ggplot2::labs(y="Maximum amplitude (nA)") +
ggplot2::ylim(0, 3.5) +
ggplot2::theme_minimal() +
ggpubr::stat_pvalue_manual(EMM_amp,
label="p = {scales::pvalue(p.value)}",
size=3, step.increase=0.1)
p6b_k <- ggplot2::ggplot(dfms$dfm_6b,
ggplot2::aes(x=group, y=decayrate, color=group)) +
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.1)
p6b_amp
p6b_k
# Write figures to file (commented out for webpage)
#ggplot2::ggsave("assets/images/fig6b_WT_maximum_amplitude.pdf", p6b_amp)
#ggplot2::ggsave("assets/images/fig6b_WT_maximum_amplitude.png", p6b_amp)
#ggplot2::ggsave("assets/images/fig6b_WT_decay_rate_constant.png", p6b_k)
#ggplot2::ggsave("assets/images/fig6b_WT_decay_rate_constant.pdf", p6b_k)