Learn R Programming

infer (version 0.2.0)

specify: Specify the response and explanatory variables with specify also converting character variables chosen to be factors

Description

Specify the response and explanatory variables with specify also converting character variables chosen to be factors

Usage

specify(x, formula, response = NULL, explanatory = NULL, success = NULL)

Arguments

x

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

response

the variable name in x that will serve as the response. This is alternative to using the formula argument

explanatory

the variable name in x that will serve as the explanatory variable

success

the level of response that will be considered a success, as a string. Needed for inference on one proportion, a difference in proportions, and corresponding z stats

Value

A tibble containing the response (and explanatory, if specified) variable data

Examples

Run this code
# NOT RUN {
# Permutation test similar to ANOVA
  mtcars %>%
    dplyr::mutate(cyl = factor(cyl)) %>%
    specify(mpg ~ cyl) %>%
    hypothesize(null = "independence") %>%
    generate(reps = 100, type = "permute") %>%
    calculate(stat = "F")
# }

Run the code above in your browser using DataLab