WeightChoice: The central DAPS optimal function

Description Usage Arguments Value Examples

View source: R/WeightChoice_function.R

Description

Performs DAPS and checks whether balance of the covariates has been achieved, and chooses the next weight that should be checked.

Usage

1
2
3
4
WeightChoice(dataset, trt.col = NULL, caliper, coords.cols, cov.cols,
  cutoff, interval, distance = StandDist, caliper_type,
  coord_dist = FALSE, matching_algorithm = c("optimal", "greedy"),
  remove.unmatchables = FALSE)

Arguments

dataset

Data frame including treatment, outcome, coordinates, propensity score estimates (named prop.scores) and observed confounders.

trt.col

If the treatment column is not named 'X', set trt.col to the index of the column corresponding to the binary treatment.

caliper

A caliper for the DAPS Score difference of matched pairs. Defaults to 0.1.

coords.cols

If the columns of coordinates are not named 'Longitude' and 'Latitude', coords.columns are the column indices corresponding to longitude and latitude accordingly.

cov.cols

If the weight is set to 'optimal', standardized difference of means will be calculated on the columns whose indices are in cov.cols.

cutoff

The cutoff of standardized difference of means under which the covariates are considered balanced. Defaults to 0.1.

interval

The interval in which we are testing the weight. DAPS is fit in the middle of the interval and depending on whether balance is achieved in the middle, the function chooses the left or right half as the next interval in the iterative procedure.

distance

Function that takes in the distance matrix and returns the standardized distance matrix. Defaults to the funcion that subtracks the minimum and divides by the range.

caliper_type

Whether we want the caliper to be on DAPS or on the PS. caliper_type must be either 'DAPS', or 'PS'.

coord_dist

Set to true when we want to use a distance function that calculates the spherical distance of points instead of Euclidean. Defaults to FALSE.

matching_algorithm

Argument with options 'optimal', or 'greedy'. The optimal choice uses the optmatch R package to acquire the matches based on propensity score difference and a caliper on distance. The greedy option matches treated and control units sequentially, starting from the ones with the smallest propensity score difference. Defaults to 'optimal'.

Value

List of next interval, matched dataset, standardized difference of the columns in cov.cols, indices of matched treated and controls, whether balance was achieved, and the next interval in the iterative algorithm.

Examples

1
2
3
4
5
6
7
8
data('toyData')
toyData$prop.scores <- glm(Z ~ X1 + X2 + X3 + X4, family = binomial,
                           data = toyData)$fitted.values
r <- WeightChoice(toyData, trt.col = 1, caliper = 0.5, coords.cols = c(4, 5),
                  cov.cols= 6:9, cutoff = 0.1, interval = c(0.5, 1),
                  distance = StandDist, caliper_type = 'DAPS',
                  coord_dist = FALSE, matching_algorithm = 'greedy')
names(r)

gpapadog/DAPSm documentation built on May 17, 2019, 8 a.m.