View source: R/mcee_helper_estimation.R
| mcee_helper_stage1_fit_nuisance | R Documentation |
Fits all five nuisance components required for MCEE estimation and returns both per-row predictions and fitted model objects. This is Stage 1 of the two-stage MCEE procedure.
mcee_helper_stage1_fit_nuisance(
data,
id_var,
dp_var,
outcome_var,
treatment_var,
mediator_var,
avail_var,
config_p,
config_q,
config_eta,
config_mu,
config_nu
)
data |
Data frame in long format. |
id_var, dp_var, outcome_var, treatment_var, mediator_var, avail_var |
Character column names (same as in |
config_p, config_q, config_eta, config_mu, config_nu |
Configuration lists
for each nuisance parameter (see |
**Nuisance Parameters Fitted:**
p: Propensity score P(A_t=1\mid H_t) - fitted on available rows. (Technically,
this is P(A_t=I_t\mid H_t), but the user is allowed to input P(A_t=1\mid H_t)
and the function will automatically correct it by setting p1 = 1 when I_t = 0.)
q: Conditional propensity P(A_t=1\mid H_t, M_t) - fitted on available rows. (Technically,
this is P(A_t=I_t\mid H_t, M_t), but the user is allowed to input P(A_t=1\mid H_t, M_t)
and the function will automatically correct it by setting q1 = 1 when I_t = 0.)
eta1, eta0: Outcome regression E(Y\mid A_t=a, H_t) without mediator
mu1, mu0: Outcome regression E(Y\mid A_t=a, H_t, M_t) with mediator
nu1, nu0: Cross-world regressions for counterfactual outcomes
**Data Subsets Used for Fitting:**
- p, q: Only rows where availability==1
- eta1, mu1: Rows where A==1 OR availability==0
- eta0, mu0: Rows where A==0
- nu1: Fitted on A==0 rows using mu1 predictions as outcome
- nu0: Fitted on A==1 or unavailable rows using mu0 predictions as outcome
**Availability Handling:**
When availability==0, predictions are forced to p1=p0=q1=q0=1 to
prevent division by zero in Stage 2.
List with two components:
nuisance_fittedList of numeric vectors (length nrow(data)) containing
per-row predictions: p1, p0, q1, q0, eta1,
eta0, mu1, mu0, nu1, nu0.
nuisance_modelsList of fitted model objects or "known" descriptors:
p, q, eta1, eta0, mu1, mu0, nu1, nu0.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.