psrwe_est: Estimate propensity scores

View source: R/psrwe_ps_est.R

psrwe_estR Documentation

Estimate propensity scores

Description

Estimate propensity scores using logistic regression or random forest model.

Usage

psrwe_est(
  data,
  ps_fml = NULL,
  ps_method = c("logistic", "randomforest"),
  v_covs = "V1",
  v_grp = "Group",
  cur_grp_level = 1,
  v_arm = NULL,
  ctl_arm_level = NULL,
  stra_ctl_only = TRUE,
  nstrata = 5,
  ...
)

Arguments

data

Data frame with group assignment and covariates.

ps_fml

Propensity score (PS) formula. If NULL, all covariates will be included in the PS model in a linear form.

ps_method

Method to calculate propensity scores. Can be set to logistic for logistic regression or randomforest for a random forest approach.

v_covs

Column names corresponding to covariates.

v_grp

Column name corresponding to group assignment.

cur_grp_level

Group level for the current study. Default is cur_grp_level = 1. Ignored for single arm studies.

v_arm

Column name corresponding to arm assignment.

ctl_arm_level

Arm level for the control arm. Ignored for single-arm studies.

stra_ctl_only

Create strata by control arm patients only. Default TRUE. Ignored by single arm studies. For randomized studies, when stra_ctl_only is FALSE, strata are created based on the PS scores of the entire current study patients.

nstrata

Number of PS strata to be created.

...

Additional parameters for calculating the propensity score to be used in randomForest or glm .

Value

A list of class PSRWE_DAT with items:

  • dataOriginal data with column _ps_ for estimated PS scores and _strata_ for PS stratum added.

  • ps_fmlPS formula for estimated PS scores.

  • is_rctWhether the current study is a randomized study.

  • nstrataNumber of strata.

Examples

data(ex_dta)
psrwe_est(ex_dta,
       v_covs = paste("V", 1:7, sep = ""),
       v_grp = "Group",
       cur_grp_level = "current")


psrwe documentation built on March 18, 2022, 5:33 p.m.