Learn R Programming

infer (version 0.3.1)

generate: Generate resamples, permutations, or simulations based on `specify` and (if needed) `hypothesize` inputs

Description

Generate resamples, permutations, or simulations based on `specify` and (if needed) `hypothesize` inputs

Usage

generate(x, reps = 1, type = attr(x, "type"), ...)

Arguments

x

a data frame that can be coerced into a tbl_df

reps

the number of resamples to generate

type

currently either bootstrap, permute, or simulate

...

currently ignored

Value

A tibble containing rep generated datasets, indicated by the replicate column.

Examples

Run this code
# NOT RUN {
# Permutation test for two binary variables
  mtcars %>%
    dplyr::mutate(am = factor(am), vs = factor(vs)) %>%
    specify(am ~ vs, success = "1") %>%
    hypothesize(null = "independence") %>%
    generate(reps = 100, type = "permute")
# }

Run the code above in your browser using DataLab