View source: R/h_test_infer_sim.R
htest_infer_sim | R Documentation |
htest_infer_sim
works through the Infer package to generate samples and a p-value from a 'null hypothesis distribution'. Written (mainly) by Oska Fentem, originally called "test_hypothesis"
htest_infer_sim( df, formula, response = NULL, hypothesis, gen, stat = NULL, p_val_dir = NULL, seed = 123 )
formula |
I'm not completely sure how to use a formula here, does it transform a variable? |
response |
the outcome of interest |
hypothesis |
|
gen |
something about how many samples are generated and how |
stat |
the statistic(s) (multiple?) to calculate? |
p_val_dir |
Direction for p-value calculation, if supplied |
We used it for testing whether the median of a difference (input as a single column) is likely to be distinct from 0. Having this function enabled us to purrr map a bunch of stuff Given a formula pr null hypothesis and arguments for generating samples: Generate samples under this null If p_val_dir is supplied, then the function computes a p-value for observed data given the null
mtcarsX <- mtcars %>% mutate(gear_d_carb = gear - carb) htest_infer_sim(df = mtcarsX, stat = "median", hypothesis = list(null = "point", med = 0), gen = list(reps = 1000, type = "bootstrap"), response = "gear_d_carb", p_val_dir = "two_sided")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.