DAPSopt: DAPSm with optimal weight Function that chooses the optimal...

Description Usage Arguments Value Examples

View source: R/DAPSopt_function.R

Description

DAPSm with optimal weight Function that chooses the optimal weight and fits DAPSm.

Usage

1
2
3
4
5
DAPSopt(dataset, caliper, coords.cols, cov.cols, cutoff = 0.1,
  trt.col = NULL, w_tol = 0.01, distance = StandDist,
  caliper_type = c("DAPS", "PS"), quiet = FALSE, coord_dist = FALSE,
  matching_algorithm = c("optimal", "greedy"),
  remove.unmatchables = FALSE)

Arguments

dataset

Data frame including treatment, outcome, coordinates, observed confounders, and propensity score estimates as 'prop.scores'.

caliper

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

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. Specify when weight is set to 'optimal'. Defaults to 0.1.

trt.col

The index of the column in the dataset including the binary treatment. Necessary when the column is not named 'X'.

w_tol

Tolerance on the choice of the optimal weight. Only needed when weight is 'optimal'. Defaults to 0.01.

distance

Function te takes in the distance matrix and returns the standardized distance matrix. Defaults to the function 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 either be 'DAPS', or 'PS'.

quiet

Whether we want to print the performance of weights.

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'.

remove.unmatchables

Logical. Argument of the optmatch function. Defaults to FALSE. If set to FALSE, the matching fails unless all treated units are matched. If set to TRUE, matching might return matches only for some of the treated units.

Value

List of weight chosen, matched dataset, standardized difference of the columns in cov.cols, indices of matched treated and controls.

Examples

1
2
3
4
5
6
7
data('toyData')
toyData$prop.scores <- glm(Z ~ X1 + X2 + X3 + X4, family = binomial,
                           data = toyData)$fitted.values
daps_opt <- DAPSopt(toyData, caliper = 0.5, coords.cols = c(4, 5),
                    cov.cols = 6:9, trt.col = 1, matching_algorithm = 'greedy')
class(daps_opt)
names(daps_opt)

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