DeclareDesign: A Tidyverse-First Research Design Declaration and Diagnosis Tool
Source:R/aaa_classes.R
DeclareDesign-package.RdDeclares, simulates, diagnoses and redesigns research designs. A design is declared as a model, an inquiry, a data strategy and an answer strategy, then simulated with purrr and diagnosed with dplyr. Version 2.0 is a ground-up rewrite of the package on tidyverse conventions.
Details
A design is a sequence of steps combined with +. Each step is one of the
four elements of a research design:
declare_model()describes the world the design runs in.declare_inquiry()records the question. Its value on a draw is the estimand.declare_sampling(),declare_assignment(), anddeclare_measurement()make up the data strategy: who is observed, what they are assigned, and what is measured.declare_estimator()anddeclare_test()are the answer strategy.
diagnose_design() simulates a design many times and reports how its
estimates compare to its estimands: bias, power, coverage, and the rest.
redesign() changes a parameter and returns a new design, so two versions
can be compared before any data are collected.
design <-
declare_model(N = 100, U = rnorm(N), Y_Z_0 = U, Y_Z_1 = U + 0.5) +
declare_inquiry(ATE = mean(Y_Z_1 - Y_Z_0)) +
declare_assignment(Z = sample(rep(0:1, length.out = N))) +
declare_measurement(Y = Y_Z_0 * (1 - Z) + Y_Z_1 * Z) +
declare_estimator(Y ~ Z, .method = lm, term = "Z", inquiry = "ATE")
diagnose_design(design)Author
Maintainer: Alexander Coppock acoppock@gmail.com (ORCID)
Authors:
Alexander Coppock acoppock@gmail.com (ORCID)
Graeme Blair graeme.blair@gmail.com (ORCID)
Jasper Cooper jaspercooper@gmail.com (ORCID)
Macartan Humphreys macartan@gmail.com (ORCID)
Neal Fultz nfultz@gmail.com