
Perform t-tests (or Wilcoxon tests) for EPSC summary plots
Source:R/Process-data.R
perform_t_tests_for_summary_plot.Rd
This function enables you to perform a series of paired t-tests (or Wilcoxon tests) comparing the
mean current amplitude within each interval relative to the mean current
amplitude during the baseline. This uses the pairwise_t_test
or pairwise_wilcox_test
functions from
rstatix
, with paired = TRUE
and Holm's adjustment for multiple
comparisons (p_adjust_method = "holm"
) by default. The resulting output table can also
be used to apply significance stars to the plot in
plot_summary_current_data()
.
Usage
perform_t_tests_for_summary_plot(
data,
test_category,
include_all_treatments = "yes",
list_of_treatments = NULL,
current_type = "eEPSC",
parameter = "amplitude",
baseline_interval = "t0to5",
interval_length = 5,
treatment_colour_theme,
test_type = "pairwise.t.test",
p_adjust_method = "holm",
save_output_as_RDS = "no"
)
Arguments
- data
A dataframe containing the summary data generated from
make_summary_EPSC_data()
. Ifcurrent_type
is "eEPSC", this must be the$summary_data
element of the list produced bymake_summary_EPSC_data()
.- test_category
A numeric value describing the experimental category. In the sample dataset for this package, 2 represents experiments where insulin was applied continuously after a 5-minute baseline period.
- include_all_treatments
A character (
"yes"
or"no"
) specifying if the plot will include data from all treatments. If"no"
, you must specify a list of treatments inlist_of_treatments
.- list_of_treatments
A list of character values describing the treatments that will be in the plot. Defaults to
NULL
, since include_all_treatments is"yes"
by default.- current_type
A character describing the current type. Allowed values are
"eEPSC"
or"sEPSC"
.- parameter
A character value specifying the parameter to be plotted on the y-axis. For evoked currents (
current_type = "eEPSC"
), the available parameter is "amplitude", which contains amplitudes normalized relative to the baseline. For spontaneous currents (current_type = "sEPSC"
), the available parameters are "amplitude" (normalized currents), "raw_amplitude", "frequency" (normalized frequency) or "raw_frequency".- baseline_interval
A character value indicating the name of the interval used as the baseline. Defaults to
"t0to5"
, but can be changed. Make sure that this matches the baseline interval that you set inmake_normalized_EPSC_data()
.- interval_length
Length of each interval (numeric; in minutes). Used to divide the dataset into broad ranges for statistical analysis. Important!
max_recording_length
must be evenly divisible byinterval_length
. Defaults to5
.- treatment_colour_theme
A dataframe containing treatment names and their associated colours as hex values. See sample_treatment_names_and_colours for an example of what this dataframe should look like.
- test_type
A character (must be
"pairwise.wilcox.test"
or"pairwise.t.test"
) describing the statistical model used in this function.- p_adjust_method
This argument is directly related to
p.adjust.method
inrstatix::t_test
. This is the method used to adjust the p-value in multiple pairwise comparisons. Allowed values include"holm"
,"hochberg"
,"hommel"
,"bonferroni"
,"BH"
,"BY"
,"fdr"
,"none"
(although"none"
is not recommended).- save_output_as_RDS
A character (
"yes"
or"no"
) describing if the resulting object should be saved as an RDS file in the raw data folder.
References
Nutter B (2018). lazyWeave: LaTeX Wrappers for R #' Users. R package version 3.0.2, https://CRAN.R-project.org/package=lazyWeave.
See also
make_normalized_EPSC_data()
for an example of how the normalized
current amplitudes were created.
Examples
perform_t_tests_for_summary_plot(
data = sample_summary_eEPSC_df$summary_data,
test_category = 2,
include_all_treatments = "yes",
list_of_treatments = NULL,
current_type = "eEPSC",
parameter = "amplitude",
baseline_interval = "t0to5",
test_type = "pairwise.t.test",
interval_length = 5,
treatment_colour_theme = sample_treatment_names_and_colours,
save_output_as_RDS = "no"
)
#> group2 asterisk_time treatment .y. group1 n1 n2
#> 1 t10to15 12.5 Control mean_P1_transformed t0to5 4 4
#> 2 t15to20 17.5 Control mean_P1_transformed t0to5 4 4
#> 3 t20to25 22.5 Control mean_P1_transformed t0to5 4 4
#> 4 t5to10 7.5 Control mean_P1_transformed t0to5 4 4
#> 5 t10to15 12.5 HNMPA mean_P1_transformed t0to5 5 5
#> 6 t15to20 17.5 HNMPA mean_P1_transformed t0to5 5 5
#> 7 t20to25 22.5 HNMPA mean_P1_transformed t0to5 5 5
#> 8 t5to10 7.5 HNMPA mean_P1_transformed t0to5 5 5
#> 9 t10to15 12.5 PPP mean_P1_transformed t0to5 5 5
#> 10 t15to20 17.5 PPP mean_P1_transformed t0to5 5 5
#> 11 t20to25 22.5 PPP mean_P1_transformed t0to5 5 5
#> 12 t5to10 7.5 PPP mean_P1_transformed t0to5 5 5
#> 13 t10to15 12.5 PPP_and_HNMPA mean_P1_transformed t0to5 5 5
#> 14 t15to20 17.5 PPP_and_HNMPA mean_P1_transformed t0to5 5 5
#> 15 t20to25 22.5 PPP_and_HNMPA mean_P1_transformed t0to5 5 5
#> 16 t5to10 7.5 PPP_and_HNMPA mean_P1_transformed t0to5 5 5
#> statistic df p p.adj p.adj.signif p_string significance_stars
#> 1 4.89 3 0.016 0.033 * 0.033 *
#> 2 6.96 3 0.006 0.018 * 0.018 *
#> 3 8.01 3 0.004 0.016 * 0.016 *
#> 4 2.28 3 0.107 0.107 ns 0.11
#> 5 3.15 4 0.035 0.133 ns 0.13
#> 6 2.99 4 0.040 0.133 ns 0.13
#> 7 3.19 4 0.033 0.133 ns 0.13
#> 8 3.10 4 0.036 0.133 ns 0.13
#> 9 0.89 4 0.422 0.844 ns 0.84
#> 10 1.50 4 0.209 0.627 ns 0.63
#> 11 1.96 4 0.121 0.484 ns 0.48
#> 12 0.78 4 0.481 0.844 ns 0.84
#> 13 0.94 4 0.402 1.000 ns > 0.99
#> 14 0.84 4 0.447 1.000 ns > 0.99
#> 15 1.39 4 0.238 0.952 ns 0.95
#> 16 -0.59 4 0.586 1.000 ns > 0.99