DAPSchoiceModel: Choosing the optimal weight and fitting the corresponding...

Description Usage Arguments Value Examples

View source: R/Weight_balance_functions.R

Description

After using CalcDAPSWeightBalance() to calculate the balance of covariates for varying values of w, we can choose the w that acheives the optimal crieterion.

Usage

1
2
3
DAPSchoiceModel(dataset, out.col = NULL, trt.col = NULL, balance,
  cutoff = 0.1, pairs, full_pairs = NULL, distance_DAPS = NULL,
  weights, true_value = NULL)

Arguments

dataset

The dataset that was supplied to CalcDAPSWeightBalance() for calculating balance.

out.col

The index of the outcome column if it is not named 'Y' in the dataset.

trt.col

The index of the treatment column if it is not named 'X'.

balance

A 3-dimensional array including the SDM. First dimension is equal to length of weights, second dimension is equal to two corresponding to before and after matching, and third dimension is the covariates. Returned as an element of the list from the function CalcDAPSWeightBalance().

cutoff

The cutoff that is used for ASDM.

pairs

A list where each element corresponds to a weight. Each element is a vector including the row indices of the dataset that are included in the matched dataset for each weight w. 2nd element of the list returned by CalcDAPSWeightBalance().

full_pairs

A list where each element corresponds to a weight. Includes the basic info about the matched pairs. Returned by CalcDAPSWeightBalance() as full_pairs. Can be left NULL.

distance_DAPS

Numeric of length equal to the number of weights. Mean distance of DAPS matches. Can be left NULL. Or use distance_DAPS of CalcDAPSWeightBalance().

weights

The weights that we used to fit DAPSm.

true_value

A value that we wish to check if it is in the confidence interval.

Value

A list of: CE estimate and standard error from a linear model including only the matched pairs for the optimal w, the number of matches, mean distance of pairs if distance_DAPS is specified, balance of observed covariates, the chosen weight, and info on the matched pairs if full_pairs is specified.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(toyData)
toyData$prop.scores <- glm(Z ~ X1 + X2 + X3 + X4, family = binomial,
                           data = toyData)$fitted.values
bal <- CalcDAPSWeightBalance(toyData, weights = seq(0, 1, length.out = 30),
                             cov.cols = 6:9, trt.col = 1,
                             coords.columns = c(4, 5), caliper = 0.3,
                             matching_algorithm = 'greedy')
PlotWeightBalance(bal$balance, weights = seq(0, 1, length.out = 30),
                  cutoff = 0.15)
DAPS <- DAPSchoiceModel(toyData, trt.col = 1, balance = bal$balance,
                        cutoff = 0.15, pairs = bal$pairs,
                        weights = seq(0, 1, length.out = 30))
names(DAPS)
DAPS$est

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