Permutation test using SD
permu_test_SD(x, x_sd, y, y_sd, alternative = "two.sided")
numeric vector of data values.
numeric vector with standard deviations.
numeric vector of data values.
numeric vector with standard deviations.
a character string specifying the alternative
hypothesis, must be one of "two.sided"
(default),
"greater"
or "less"
. You can specify just the initial letter.
A list with class "htest"
containing the following
components:
the value of the statistic.
the p-value for the test.
a character string describing the alternative hypothesis.
a character string indicating the type of test performed.
This function is based in the Python function proposed by Ermolinskiy (2024).
Ermolinskiy, P. (2024). An Extension of the Permutation Test for Dependent Data in Samples with a Small Number of Subjects. https://hal.science/hal-04558513/
# Example 0
x <- c(5, 6)
x_sd <- c(1, 2)
y <- c(7, 9)
y_sd <- c(1, 2)
res <- permu_test_SD(x, x_sd, y, y_sd, alternative="less")
res
#>
#> Paired permutation with SD
#>
#> data:
#> Percentage_difference = 45, p-value = 0.1759
#> alternative hypothesis: less
#>
# Example 1 of the paper
x <- c(20, 33, 20, 24)
x_sd <- c(2, 2, 2, 2)
y <- c(21, 34, 22, 25)
y_sd <- c(2, 2, 2, 2)
res <- permu_test_SD(x, x_sd, y, y_sd, alternative="less")
res
#>
#> Paired permutation with SD
#>
#> data:
#> Percentage_difference = 5.5492, p-value = 0.1875
#> alternative hypothesis: less
#>