paired_test | R Documentation |
This function will run a simulation-based hypothesis test for a paired mean difference or paired median difference between two quantitative variables for matched pairs data.
paired_test(
data,
summary_measure = "mean",
which_first = 1,
shift = 0,
as_extreme_as,
direction = c("greater", "less", "two-sided"),
number_repetitions = 1,
add_normal = FALSE
)
data |
Vector of differences or a two- or three-column data frame with values for each group in last two columns. |
summary_measure |
Name of summary measure to return from simulations.
Allowed values are
|
which_first |
Which column is first in order of subtraction?
|
shift |
Amount to shift differences for bootstrapping of null distribution. |
as_extreme_as |
Value of observed paired mean difference. |
direction |
Direction of alternative hypothesis.
Allowed values are |
number_repetitions |
Number of simulated samples. |
add_normal |
Logical value indicating whether to superimpose a normal curve on the histogram. Defaults to FALSE. |
Returns plot of distribution of simulated statistics, with values as or more extreme than specified value highlighted, and reports proportion of simulations as or more extreme than specified as subtitle on plot.
set.seed(117)
x <- rnorm(25)
y <- x + 1 + rnorm(25, 0, 1.8)
data <- data.frame(x, y)
obs_diff <- mean(x - y)
paired_test(data,
which_first = 1,
shift = -obs_diff,
as_extreme_as = obs_diff,
direction = "two-sided",
number_repetitions = 1000
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.