infer | R Documentation |
Statistical Inference with Permutation
infer(
data,
formula,
stat,
paired = NULL,
reps = 2000L,
level = 0.95,
direction = "two-sided",
null = NULL,
type = NULL,
null_reps = reps,
ci_reps = reps,
...,
variables = NULL,
response = NULL,
explanatory = NULL,
success = NULL,
p = NULL,
mu = NULL,
med = NULL,
sigma = NULL
)
data |
A data frame that can be coerced into a tibble. |
formula |
A formula with the response variable on the left and the
explanatory on the right. Alternatively, a |
stat |
A string giving the type of the statistic to calculate. Current
options include |
paired |
A column in the data to specify the observation (sample id), if
not |
reps |
Fast way to set both |
level |
A numerical value between 0 and 1 giving the confidence level. Default value is 0.95. |
direction |
A character string. Options are |
null |
The null hypothesis. Options include
|
type |
A string giving which method should be used for creating the
confidence interval. The default is |
null_reps |
Number of times to calculate null distribution. |
ci_reps |
Number of bootstrap times to calculate confidence interval. |
... |
Other arguments passed to infer::calculate.
|
variables |
A set of unquoted column names in the data to permute (independently of each other). Defaults to only the response variable. Note that any derived effects that depend on these columns (e.g., interaction effects) will also be affected. |
response |
The variable name in |
explanatory |
The variable name in |
success |
The level of |
p |
The true proportion of successes (a number between 0 and 1). To be used with point null hypotheses when the specified response variable is categorical. |
mu |
The true mean (any numerical value). To be used with point null hypotheses when the specified response variable is continuous. |
med |
The true median (any numerical value). To be used with point null hypotheses when the specified response variable is continuous. |
sigma |
The true standard deviation (any numerical value). To be used with point null hypotheses. |
A data.frame
https://infer.tidymodels.org/articles/observed_stat_examples.html
data(gss, package = "infer")
infer(gss, response = hours, stat = "mean", mu = 40)
infer(gss, response = hours, stat = "t", mu = 40)
infer(gss, response = hours, stat = "median", med = 40)
infer(gss, response = sex, success = "female", stat = "prop", p = .5)
infer(gss, response = sex, success = "female", stat = "z", p = .5)
infer(gss, college ~ sex,
success = "no degree",
stat = "diff in props",
order = c("female", "male")
)
infer(gss, hours ~ age + college, variables = c(age, college))
gss$hours_previous <- gss$hours + 5 - rpois(nrow(gss), 4.8)
gss$.id <- seq_len(nrow(gss))
gss_paired <- tidyr::pivot_longer(gss, cols = c(hours, hours_previous))
infer(gss_paired, value ~ name,
stat = "mean", paired = .id
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.