Show the code
DT::datatable(dfms$dfm_5a, options=list(pageLength=5))WT NeRh50 maximum amplitudes and decay rate constants in response to changes in ligandManuscript figure 5a shows WT maximum amplitude and decay rate constant variation over LPR5, LPR10, and LPR50 for the WT NeRh50 with NH4+ (figure 4c).
The data used for the figure are shown in Table 1
A t-test would likely be fine here but, because a t-test is just a special case of a linear model, for consistency we again use linear models for amplitude and decay rate as dependent variables, with ligand as the independent factor, checking fit in Figure 1.
amplitude ~ ligand and decayrate ~ ligand. The splines for linearity/heteroscadicity are odd, but the datapoints are not concerning. There is some evidence of non-normality of residuals in the maximum amplitude data, but nothing especially concerning.
As the model fit is acceptable, we estimate contrasts in Table 2.
EMM <- emmeans::emmeans(model5a_amp_lm, ~ ligand)
confint(emmeans::contrast(EMM, "pairwise", adjust="sidak")) |>
kableExtra::kbl(digits=3) |>
kableExtra::kable_styling(
bootstrap_options = c("hover", "responsive")
)
EMM <- emmeans::emmeans(model5a_k_lm, ~ ligand)
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 |
|---|---|---|---|---|---|
| NH4 - MeA | 1.223 | 0.074 | 15 | 1.066 | 1.38 |
| contrast | estimate | SE | df | lower.CL | upper.CL |
|---|---|---|---|---|---|
| NH4 - MeA | 20.281 | 1.728 | 15 | 16.598 | 23.964 |
As no contrast includes zero in the 95% confidence interval, we conclude that there are differences in amplitude and decay rate constant for each pairwise comparison between ligands.
We plot the differences, 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(model5a_amp_lm, ~ ligand),
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(model5a_k_lm, ~ ligand),
adjust="sidak")) |>
tidyr::separate(contrast, into=c("group1", "group2"), sep=" - ") |>
dplyr::mutate(y.position=85) |>
rstatix::add_significance()
p5a_amp <- ggplot2::ggplot(dfms$dfm_5a,
ggplot2::aes(x=ligand, y=amplitude, color=ligand)) +
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)
p5a_k <- ggplot2::ggplot(dfms$dfm_5a,
ggplot2::aes(x=ligand, y=decayrate, color=ligand)) +
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)
p5a_amp
p5a_k
# Write figures to file (commented out for webpage)
#ggplot2::ggsave("assets/images/fig5a_WT_maximum_amplitude.pdf", p5a_amp)
#ggplot2::ggsave("assets/images/fig5a_WT_maximum_amplitude.png", p5a_amp)
#ggplot2::ggsave("assets/images/fig5a_WT_decay_rate_constant.png", p5a_k)
#ggplot2::ggsave("assets/images/fig5a_WT_decay_rate_constant.pdf", p5a_k)