estimate_gps {CausalGPS}R Documentation

Estimate generalized propensity score (GPS) values

Description

Estimates GPS value for each observation using normal or kernel approaches.

Usage

estimate_gps(
  w,
  c,
  gps_density = "normal",
  params = list(),
  sl_lib = c("m_xgboost"),
  nthread = 1,
  ...
)

Arguments

w

A data frame of observed continuous exposure variable. Including id and w columns.

c

A data frame of observed covariates variable. Also includes id column.

gps_density

Model type which is used for estimating GPS value, including normal (default) and kernel.

params

Includes list of parameters that are used internally. Unrelated parameters will be ignored.

sl_lib

A vector of prediction algorithms.

nthread

An integer value that represents the number threads to be used in a shared memory system.

...

Additional arguments passed to the model.

Value

The function returns a S3 object. Including the following:

Note

If internal.use is set to be FALSE, only original data set + GPS will be returned.

The outcome variable is not used in estimating the GPS value. However, it is used in compiling the data set with GPS values.

Examples


m_d <- generate_syn_data(sample_size = 100)
data_with_gps <- estimate_gps(m_d[, c("id", "w")],
                              m_d[, c("id", "cf1", "cf2", "cf3",
                                      "cf4", "cf5", "cf6")],
                              gps_density = "normal",
                              params = list(xgb_max_depth = c(3,4,5),
                                       xgb_nrounds=c(10,20,30,40,50,60)),
                              nthread = 1,
                              sl_lib = c("m_xgboost")
                             )


[Package CausalGPS version 0.4.1 Index]