Learn R Programming

infer (version 0.3.1)

p_value: Compute the p-value for (currently only) simulation-based methods get_pvalue() is an alias of p_value

Description

Compute the p-value for (currently only) simulation-based methods get_pvalue() is an alias of p_value

Usage

p_value(x, obs_stat, direction)

get_pvalue(x, obs_stat, direction)

Arguments

x

data frame of calculated statistics or containing attributes of theoretical distribution values

obs_stat

a numeric value or a 1x1 data frame (as extreme or more extreme than this)

direction

a character string. Options are "less", "greater", or "two_sided". Can also specify "left", "right", or "both".

Value

a 1x1 data frame with value between 0 and 1

Examples

Run this code
# NOT RUN {
mtcars_df <- mtcars %>%
    dplyr::mutate(am = factor(am))
d_hat <- mtcars_df %>%
    specify(mpg ~ am) %>%
    calculate(stat = "diff in means", order = c("1", "0"))
null_distn <- mtcars_df %>%
    specify(mpg ~ am) %>% 
    hypothesize(null = "independence") %>%
    generate(reps = 100) %>%
    calculate(stat = "diff in means", order = c("1", "0"))
null_distn %>% 
    p_value(obs_stat = d_hat, direction = "right")
# }

Run the code above in your browser using DataLab