Generate resamples, permutations, or simulations
Generation creates a null distribution from specify()
and (if needed)
hypothesize()
inputs.
Learn more in vignette("infer")
.
generate(x, reps = 1, type = NULL, ...)
x |
A data frame that can be coerced into a tibble. |
reps |
The number of resamples to generate. |
type |
Currently either |
... |
Currently ignored. |
A tibble containing reps
generated datasets, indicated by the
replicate
column.
The type
argument determines the method used to create the null
distribution.
bootstrap
: A bootstrap sample will be drawn for each replicate,
where a sample of size equal to the input sample size is drawn (with
replacement) from the input sample data.
permute
: For each replicate, each input value will be randomly
reassigned (without replacement) to a new output value in the sample.
simulate
: A value will be sampled from a theoretical distribution
with parameters specified in hypothesize()
for each replicate. (This
option is currently only applicable for testing point estimates.)
# Generate a null distribution by taking 200 bootstrap samples gss %>% specify(response = hours) %>% hypothesize(null = "point", mu = 40) %>% generate(reps = 200, type = "bootstrap") # Generate a null distribution for the independence of # two variables by permuting their values 1000 times gss %>% specify(partyid ~ age) %>% hypothesize(null = "independence") %>% generate(reps = 200, type = "permute") # More in-depth explanation of how to use the infer package ## Not run: vignette("infer") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.