mcee_general | R Documentation |
Like mcee
, but each nuisance function is configured explicitly
via config_*
objects (formula/method/family or known).
mcee_general(
data,
id,
dp,
outcome,
treatment,
mediator,
availability = NULL,
time_varying_effect_form,
config_p,
config_q,
config_eta,
config_mu,
config_nu,
weight_per_row = NULL,
verbose = TRUE
)
data |
A data.frame in long format (one row per id-by-decision point). |
id |
Character. Column name for subject identifier. |
dp |
Character. Column name for decision point index (must increase strictly within subject). |
outcome |
Character. Column name for distal outcome (constant within subject). |
treatment |
Character. Column name for treatment (coded 0/1). |
mediator |
Character. Column name for mediator. |
availability |
Optional character. Column name for availability (0/1). If |
time_varying_effect_form |
RHS-only formula for the basis |
config_p , config_q , config_eta , config_mu , config_nu |
Lists created by
|
weight_per_row |
Optional numeric vector of row weights (nonnegative, length |
verbose |
Logical; print progress messages. |
Use this wrapper for observational studies (estimate p
) or when you want
different learners per nuisance. The same data requirements as mcee
apply.
An "mcee_fit"
object; see mcee
.
mcee
, mcee_userfit_nuisance
, mcee_config_maker
set.seed(1)
n <- 10
T <- 4
id <- rep(1:n, each = T)
dp <- rep(1:T, times = n)
A <- rbinom(n * T, 1, 0.5)
M <- rbinom(n * T, 1, plogis(-0.2 + 0.3 * A + 0.1 * dp))
Y <- ave(0.5 * A + 0.6 * M + 0.1 * dp + rnorm(n * T), id)
dat <- data.frame(id, dp, A, M, Y)
cfg <- list(
p = mcee_config_known("p", 0.5),
q = mcee_config_glm("q", ~ dp + M),
eta = mcee_config_glm("eta", ~dp),
mu = mcee_config_glm("mu", ~ dp + M),
nu = mcee_config_glm("nu", ~dp)
)
fit_gen <- mcee_general(dat, "id","dp","Y","A","M",
time_varying_effect_form = ~ dp,
config_p=cfg$p, config_q=cfg$q, config_eta=cfg$eta, config_mu=cfg$mu, config_nu=cfg$nu)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.