Making decisions about research design and analysis strategies is often difficult before data is collected, because it is hard to imagine the exact form data will take. Instead, researchers typically modify analysis strategies to fit the data. fabricatr helps researchers imagine what data will look like before they collect it. Researchers can evaluate alternative analysis strategies, find the best one given how the data will look, and precommit before looking at the realized data.
To install the latest development release of fabricatr, please ensure that you are running version 3.3 or later of R and run the following code:
install.packages("fabricatr", dependencies = TRUE, repos = c("http://R.declaredesign.org", "https://cloud.r-project.org"))
Once the package is installed, it is easy to generate new data, or modify your own. The below example simulates the United States House of Representatives, where 435 members belong to two parties, and both parties and representatives have characteristics modeled in the data:
library(fabricatr) house_candidates = fabricate( parties = add_level( N = 2, party_ideology = c(0.5, -0.5), in_power = c(1, 0), party_incumbents = c(241, 194)), representatives = add_level( N = party_incumbents, member_ideology = rnorm(N, party_ideology), terms_served = draw_count(N = N, means = 3), female = draw_binary(N = N, probs = 0.2)) ) head(house_candidates)