Permutation test using SD

permu_test_SD_cpp(x, x_sd, y, y_sd, alt_code, standard_convention)

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.

alt_code

a number, 0 = two.sided, 1 = greater, 2 = less.

standard_convention

a logical value. FALSE to replicate test implemented in R.

Value

A list with the statistic, p.value and total.

Author

Freddy Hernandez, fhernanb@unal.edu.co

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

Examples

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)
# Using the test in cpp
permu_test_SD_cpp(x, x_sd, y, y_sd,
                  alt_code=2, standard_convention=FALSE)
#> $statistic
#> [1] 5.549242
#> 
#> $p.value
#> [1] 0.1874809
#> 
#> $total
#> [1] 104976
#> 
# Using the test in R
permu_test_SD(x, x_sd, y, y_sd, alternative="less")
#> 
#> 	Paired permutation test with SD
#> 
#> data:  
#> Percentage_difference = 5.5492, p-value = 0.1875
#> alternative hypothesis: less
#>