
Model, identify, estimate, refute
Source:R/abundance_text_voting_native.R
morie_identify_estimate_refute.RdThe value is not the number at step three. It is that identification says WHICH quantity the data can speak to, estimation produces it, and refutation asks whether it survives perturbations that ought not to change it: a placebo treatment (should collapse to zero), a random common cause (should not move it) and random subsets (spread should match the standard error).
Usage
morie_identify_estimate_refute(
dag,
data,
treatment,
outcome,
adjustment = NULL,
n_refute = 100L,
seed = 0L,
alpha = 0.05
)Value
A list with estimate, se, identified, adjustment_set,
placebo_effect, random_cause_effect, subset_sd,
refutations_passed, warnings.
Details
Adjusting for everything measured is not conservative. Conditioning on a mediator removes part of the effect being measured, and conditioning on a collider CREATES an association where none existed. Both are flagged and the estimate still returned, so the damage is visible rather than merely warned about.
Examples
# \donttest{
set.seed(13)
n <- 500
Z <- rnorm(n); T <- rbinom(n, 1, plogis(Z)); Y <- 1 + 2 * T + Z + rnorm(n)
dag <- matrix(FALSE, 3, 3, dimnames = list(c("Z", "T", "Y"), c("Z", "T", "Y")))
dag["Z", "T"] <- dag["Z", "Y"] <- dag["T", "Y"] <- TRUE
r <- morie_identify_estimate_refute(dag, data.frame(Z, T, Y), treatment = 2, outcome = 3, n_refute = 20L)
r[c("estimate", "adjustment_set", "refutations_passed")]
#> $estimate
#> [1] 1.877551
#>
#> $adjustment_set
#> [1] 1
#>
#> $refutations_passed
#> [1] 3
#>
# }