pseudo_outcome_sequential: Doubly-robust variables at many timepoints for binary...

View source: R/doubly_robust.R

pseudo_outcome_sequentialR Documentation

Doubly-robust variables at many timepoints for binary treatment given nuisance function estimators.

Description

Doubly-robust variables at many timepoints for binary treatment given nuisance function estimators.

Usage

pseudo_outcome_sequential(
  y,
  X,
  treatment,
  regression_fn_1,
  regression_fn_0 = NULL,
  propensity_score_fn,
  train_idx = NULL,
  times = NULL,
  n_cores = 1,
  cross_fit = FALSE,
  verbose = FALSE
)

Arguments

y

The measured outcome (a real vector).

X

Measured covariates (an nxd real matrix where 'n = length(y)')

treatment

Whether the subject received treatment (a boolean vector or 0/1-valued integer vector).

regression_fn_1

A function which predicts outcomes for those who took treatment. This function takes three arguments: 'y', 'X', and 'newX', the training outcome, training covariates, and evaluation covariates, respectively. The function outputs the predicted response given the evaluation covariates, 'newX'.

regression_fn_0

The same as 'regression_fn_1' but for those who did not receive treatment. If left NULL, this will be set to the same function as 'regression_fn_1'.

propensity_score_fn

A function which predicts the propensity score for each subject. Similar to 'regression_fn_1', this function takes three arguments: 'y', 'X', and 'newX', the training treatment indicator (1 if treatment, 0 if control), the training covariates, and the evaluation covariates. The function outputs the predicted propensity score given the evaluation covariates, 'newX'.

train_idx

The indices indicating the training split for the sample splitting algorithm. If left NULL, the training index will be assigned randomly with probability 1/2.

times

The times for which the doubly-robust variables should be calculated. Can be a vector of times (an integer vector) or a single time (integer). If left NULL, the variables will only be computed at time n.

n_cores

The number of cores to use for parallelization.

cross_fit

Should cross-fitting be used? (boolean)

Value

A list of doubly-robust variable vectors, one vector for each time requested in 'times'.


WannabeSmith/drconfseq documentation built on Sept. 13, 2023, 3:05 a.m.