ps.score: Centaur Propensity Score Calculation

Description Usage Arguments Details Value Examples

View source: R/psScore.R

Description

Performs propensity score Calculation.

Usage

1
2
3
ps.score(data, covariates, ps.method = "glm", max.covariates = 200,
  max.twang = 30000, min.twang = 25, control.ratio = 5,
  random.seed = 43762116, odds.ratio = FALSE, lr.summary.file = NULL)

Arguments

data

Data Frame - containing the dataset to be balanced. Must include treatment indicator as 0, 1 factor.

covariates

Vector - containing the list of variable names to be included as confounding variables

ps.method

String - name of the method to use for calculation of propensity scores. Options are glm (default) and twang

max.covariates

The maximum number of covariates that can be used to calculate propensity scores (default 200)

max.twang

The maximum number of samples that can be used with the twang ps.method (default 30k)

min.twang

The minimum number of covariates required to use the twang ps.method (default 25)

control.ratio

The desired ratio of control to treatment subjects. A large imbalance between control and treatment subjects can cause problems with algorithm convergence. If the control population exceeds control.ratio times as many subjects as the treatment group, the control population will be randomly sampled to the desired size.

random.seed

Sets the random number generator seed, which determines how the control population is sampled. Override the default (43762116) to generate a different sample of control subjects.

odds.ratio

A logical argument indicating if the odds ratio and 95 This is an intensive calculation that can take a while.

lr.summary.file

The file name where the logistic regression summary should be written to. If directory is provided as part of the file name, it has to already exist. Default value is NULL. If not given, no file will be written.

Details

This function calculates the propensity score based on the specified options. In order for this function to work correctly, the data argument must be a data frame containing the collection of confounding variables and a treatment indicator factor variable. Additionally, the covariates argument must contain a vector of the variable names to be included as covariates or confounding variables. See list of arguments for additional options.

Value

Data Frame - containing the original dataset, trimmed of any incomplete cases with additional variable added for ps_values (the calculated propensity scores)

Examples

1
2
3
4
5
## Not run: 
ps.score(myData, myCovariates)
ps.score(myData, myCovariates, ps.method = "twang")

## End(Not run)

OHDSI/Centaur documentation built on May 9, 2017, 3:24 p.m.