Permutation test using SD

permu_test_SD(x, x_sd, y, y_sd, alternative = "two.sided")

Arguments

x

numeric vector of data values.

x_sd

numeric vector with standard deviations.

y

numeric vector of data values.

y_sd

numeric vector with standard deviations.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.

Value

A list with class "htest" containing the following components:

statistic

the value of the statistic.

p.value

the p-value for the test.

alternative

a character string describing the alternative hypothesis.

method

a character string indicating the type of test performed.

Details

This function is based in the Python function proposed by Ermolinskiy (2024).

References

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/

Author

Freddy Hernandez, fhernanb@unal.edu.co

This function performs test for dependent data in samples with a small number of subjects.

Examples

# 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
#>