Description Usage Arguments Details Value Author(s) Examples
Performs a non parametric test for any statistics by bootstraping. Combines all values and samples vectors of length a_data, b_data. Then calculates differences in statistics to get distribution of differences in statatistics. Then compares observed difference with that distribution.
1 2 3 4 5 6 7 8 9 10 | np_stat_test(
a_data,
b_data,
stat_fun = mean,
n_sim = 1000,
alternative = "two.sided",
alpha = 0.05,
plot = TRUE,
...
)
|
a_data |
Numeric vector of values from group a. |
b_data |
Numeric vector of values from group b. |
stat_fun |
Function that calculates desired statistic. |
n_sim |
Number of times to sample groups and calculate difference. |
alternative |
Setting up alternative hypothesis: "two.sided" meaning stat(A) != stat(B), "less" meaning stat(A) < stat(B), "greater" meaning stat(A) > stat(B) |
alpha |
statistical significance |
plot |
(logical) Plot the distribution of differences in mean if TRUE. |
... |
Any additional parameters that stat_fun needs. |
H0: No difference in statistics
returns a named list containing:
diff |
all the statistics differences |
observed |
observed statistics difference |
n_sim |
number of simulations ran |
p_value |
two sided p-value for the test |
Elio Bartoš
1 2 3 4 5 6 7 8 | x = rnorm(300, mean = 5, sd = 1)
y = rnorm(200, mean = 4, sd = 1.5)
y2 = c(y, 110)
np_stat_test(x, y, mean)
np_stat_test(x, y2, mean)
np_stat_test(x, y, mean, trim = 0.1)
np_stat_test(x, y, median)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.