generate_pseudo_pop {CausalGPS}R Documentation

Generate Pseudo Population

Description

Generates pseudo population data set based on user-defined causal inference approach. The function uses an adaptive approach to satisfies covariate balance requirements. The function terminates either by satisfying covariate balance or completing the requested number of iteration, whichever comes first.

Usage

generate_pseudo_pop(
  Y,
  w,
  c,
  ci_appr,
  pred_model,
  gps_model = "parametric",
  use_cov_transform = FALSE,
  transformers = list("pow2", "pow3"),
  bin_seq = NULL,
  trim_quantiles = c(0.01, 0.99),
  optimized_compile = FALSE,
  params = list(),
  nthread = 1,
  ...
)

Arguments

Y

A vector of observed outcome variable.

w

A vector of observed continuous exposure variable.

c

A data.frame or matrix of observed covariates variable.

ci_appr

The causal inference approach. Possible values are:

  • "matching": Matching by GPS

  • "weighting": Weighting by GPS

  • "adjusting": Adjusting by GPS

pred_model

a prediction model (use "sl" for SuperLearner)

gps_model

Model type which is used for estimating GPS value, including parametric (default) and non-parametric.

use_cov_transform

If TRUE, the function uses transformer to meet the covariate balance.

transformers

A list of transformers. Each transformer should be a unary function. You can pass name of customized function in the quotes. Available transformers:

  • pow2: to the power of 2

  • pow3: to the power of 3

bin_seq

Sequence of w (treatment) to generate pseudo population. If NULL is passed the default value will be used, which is seq(min(w)+delta_n/2,max(w), by=delta_n).

trim_quantiles

A numerical vector of two. Represents the trim quantile level. Both numbers should be in the range of [0,1] and in increasing order (default: c(0.01,0.99)).

optimized_compile

If TRUE, uses counts to keep track of number of replicated pseudo population.

params

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

nthread

An integer value that represents the number of threads to be used by internal packages.

...

Additional arguments passed to different models.

Details

Additional parameters

Causal Inference Approach (ci.appr)
Prediction models (pred_model)

Value

Returns a pseudo population (gpsm_pspop) object that is generated or augmented based on the selected causal inference approach (ci_appr). The object includes the following objects:

Examples

m_d <- generate_syn_data(sample_size = 100)
pseuoo_pop <- generate_pseudo_pop(m_d$Y,
                                  m_d$treat,
                                  m_d[c("cf1","cf2","cf3","cf4","cf5","cf6")],
                                  ci_appr = "matching",
                                  pred_model = "sl",
                                  gps_model = "parametric",
                                  bin_seq = NULL,
                                  trim_quantiles = c(0.01,0.99),
                                  optimized_compile = FALSE,
                                  use_cov_transform = FALSE,
                                  transformers = list(),
                                  sl_lib = c("m_xgboost"),
                                  params = list(xgb_nrounds=c(10,20,30),
                                                xgb_eta=c(0.1,0.2,0.3)),
                                  nthread = 1,
                                  covar_bl_method = "absolute",
                                  covar_bl_trs = 0.1,
                                  covar_bl_trs_type= "mean",
                                  max_attempt = 1,
                                  matching_fun = "matching_l1",
                                  delta_n = 1,
                                  scale = 0.5)


[Package CausalGPS version 0.2.7 Index]