est_ps_xgb: propensity score estimation in high dimension using gradient...

View source: R/est_ps_xgb.R

est_ps_xgbR Documentation

propensity score estimation in high dimension using gradient tree boosting

Description

Estimate a propensity score to a given drug exposure (treatment) with extreme gradient boosting. Depends on xgboost package. Internal function, not supposed to be used directly.

Usage

est_ps_xgb(
  idx_expo,
  x,
  parameters = list(eta = 0.1, max_depth = 6, objective = "binary:logistic", nthread =
    1),
  nrounds = 200,
  ...
)

Arguments

idx_expo

Index of the column in x that corresponds to the drug covariate for which we aim at estimating the PS.

x

Input matrix, of dimension nobs x nvars. Each row is an observation vector. Can be in sparse matrix format (inherit from class "sparseMatrix" as in package Matrix).

parameters

correspond to params in xgb.train function. The complete list of parameters is available at http://xgboost.readthedocs.io/en/latest/parameter.html. Default is a list with eta=0.1 (learning rate), max_depth = 6 (maximum length of a tree), objective = "binary:logistic" and nthread = 1 (number of threads for parallelization).

nrounds

Maximum number of boosting iterations. Default is 200.

...

Other arguments that can be passed to xgb.train function.

Value

An object with S3 class "ps", "xgb".

expo_name

Character, name of the drug exposure for which the PS was estimated. Correspond to colnames(x)[idx_expo]

.

indicator_expo

One-column Matrix object. Indicator of the drug exposure for which the PS was estimated. Defined by x[, idx_expo].

.

score_variables

Character vector, names of covariates(s) used in a at list one tree in the gradient tree boosting algorithm. Obtained with xgb.importance function from xgboost package.

score

One-column Matrix object, the estimated score.

Author(s)

Emeline Courtois
Maintainer: Emeline Courtois emeline.courtois@inserm.fr

Examples


set.seed(15)
drugs <- matrix(rbinom(100*20, 1, 0.2), nrow = 100, ncol = 20)
colnames(drugs) <- paste0("drugs",1:ncol(drugs))
ae <- rbinom(100, 1, 0.3)
psxgb2 <- est_ps_xgb(idx_expo = 2, x = drugs, nrounds = 100)
psxgb2$score_variables #selected variables to include in the PS model of drug_2



adapt4pv documentation built on May 31, 2023, 6:08 p.m.