estimate_using_ERM: Estimates the log relative risk function using a...

View source: R/minimizers_and_risk_functions.R

estimate_using_ERMR Documentation

Estimates the log relative risk function using a user-supplied binomial sl3 Learner object using either the IPW or plugin empirical risk function.

Description

Estimates the log relative risk function using a user-supplied binomial sl3 Learner object using either the IPW or plugin empirical risk function.

Usage

estimate_using_ERM(
  V,
  A,
  Y,
  EY1W,
  EY0W,
  pA1W,
  weights,
  family_risk_function,
  sl3_Learner,
  outcome_function_plugin,
  weight_function_plugin,
  outcome_function_IPW,
  weight_function_IPW,
  learning_method = c("plugin", "IPW"),
  Vpred = V,
  transform_function = function(x) {
     x
 }
)

Arguments

V

A matrix of observations of a subset of the covariates 'W' for which to estimate the (possibly semi-marginalized) log relative risk (LRR).

A

A binary vector specifying the treatment assignment. The values should be in 0,1.

Y

A numeric vector of binary or nonnegative observations of the outcome variable.

EY1W

A numeric vector containing initial cross-fitted estimates of E[Y|A=1,W] for all observations.

EY0W

A numeric vector containing initial cross-fitted estimates of E[Y|A=0,W] for all observations.

pA1W

A numeric vector containing initial cross-fitted estimates of P(A=1|W) for all observations.

weights

A numeric vector of observation weights. If no special weighting desired, supply a vector of 1's.

learning_method

A string being either "plugin" or "IPW". Whether the LRR should be estimated by minimizing the plugin or IPW empirical risk function.

Vpred

A matrix of covariates observations at which to predict the LRR. By default, Vpred equals W.

sl3_LRR_Learner_binomial

A sl3_Learner object that minimizes the binomial/logistic risk function. This function will automatically add a 'family = binomial()' parameter to the internal params of the inputted sl3_Learner. If the learner predicts the predictions at the probability scale (i.e. expit transform of link predictor) then set the argument 'logit_transform = TRUE' (default). (Almost all Learners do this by default) If the learner predicts the link predictor then set the argument 'logit_transform = TRUE'. Note to users familiar with sl3: if 'learning_method = "plugin"', the outcome_type of the sl3_Task is 'quasibinomial'. Therefore, a family object should be passed to the learner to ensure the outcome type is correct.

logit_transform

An internal argument specifying whether the predictions of sl3_LRR_Learner_binomial should be logit-transformed. This argument is needed since the LRR predictions correspond with the logit-scale predictor and not probability-scale predictions of the binomial learner. For most sl3_Learners, the default 'logit_transform = TRUE' is necessary for this method to work correctly.


Larsvanderlaan/npcausalML documentation built on July 30, 2023, 4:32 p.m.