Description Usage Arguments Details Value Note Author(s) See Also Examples
For a given match, this function evaluates the balance of variables before and after matching. Balance is evaluated using standardized differences.
1 | covbalance(.data, grouplabel, matches, vars, details)
|
.data |
A data frame or matrix containing the informations on the |
grouplabel |
Argument describing the group structure. See the description in the
documentation of |
matches |
A character matrix describing the strata structure of the design. Standard
use is the output of Each row of the matrix corresponds to a strata and each entry corresponds to
rowname of |
vars |
A character vector of the names of the variables for which balance should be checked. |
details |
Optional argument. This argument can be used to get other details on the
|
Standardized difference of the covariates between two groups is computed as difference of the means of the variable over the squared root of the average variance of the variable in the groups.
For better understanding of the matching, details
can be used. This
argument can be used to get summaries of the variables before and after matching.
For example, details = c(mean = 'mean', median = 'function(x) quantile(x, probs=.5)')
given the mean and median of the variables. Only functions that give a single
number summary can be used!
Currently, this function cannot be immediately used for a design with different strata sizes. One way to get around would be to fill in the smaller stratum with false units and making all the strata of equal size.
A list consisting of the following elements.
std_diff |
Standardized differences of the specified variables before and after matching for every pair of groups. |
details |
Only if |
See kwaymatching
for usage.
Bikram Karmakar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
data(Dodgeram)
## An example strata structure
matches = as.matrix(sample(rownames(Dodgeram), 500), ncol = 5)
vars = c("AGE", "SEX.2", "IMPACT3.3", "DR_DRINK")
details = c('std_diff', 'mean', 'function(x) diff(range(x))',
'function(x) quantile(x, probs = .9)')
names(details) <- c('std_diff', 'mean', 'range', '90perc')
covbalance(.data=Dodgeram, grouplabel=c("NOSAB", "optSAB", "WITHSABS"),
matches = matches, vars = vars, details)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.