recruit | R Documentation |
This function works with the output of 'stratify()'. The user provides the number of units they wish to sample from their population dataset. The function tells the user how many observations to sample from each stratum and generates recruitment lists, one per stratum, which can either be saved to .csv files in any given directory or accessed later on.
recruit(
stratify_output,
guided = TRUE,
sample_size = NULL,
save_as_csv = FALSE
)
stratify_output |
output from 'stratify()', of S3 class 'generalizeR_stratify' |
guided |
logical; defaults to TRUE. Whether the function should be guided (ask questions and behave interactively throughout) or not. If set to FALSE, must provide values for other arguments below |
sample_size |
defaults to NULL. If guided is set to FALSE, must provide a number of units to sample |
save_as_csv |
defaults to NULL. If guided is set to FALSE, specify whether or not to save recruitment lists to working directory; TRUE or FALSE |
This function, and the others in this package, are designed to mimic the website https://www.thegeneralizer.org/ based on the papers referenced below.
A three-element list containing the recruitment lists and the recruitment table/kable
Tipton, E. (2014). Stratified sampling using cluster analysis: A sample selection strategy for improved generalizations from experiments. Evaluation Review, 37(2), 109-139.
Tipton, E. (2014). How generalizable is your experiment? An index for comparing experimental samples and populations. Journal of Educational and Behavioral Statistics, 39(6), 478-501.
library(tidyverse)
selection_covariates <- c("total", "pct_black_or_african_american", "pct_white",
"pct_female", "pct_free_and_reduced_lunch")
strat_output <- stratify(generalizeR:::inference_pop, guided = FALSE, n_strata = 4,
variables = selection_covariates, idvar = "ncessch")
recruit(strat_output, guided = FALSE, sample_size = 72, save_as_csv = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.