Description Usage Arguments Details Value Examples
Calculates the weights and/or perform matching of subject to balance the population
1 2 3 4 | ps.balance(data, covariates, estimand = "ATT", match.subjects = TRUE,
match.exact = NULL, match.ratio = 1, caliper.sigma = 0,
use.logit = FALSE, truncate.quantile = 0.95, truncate.method = "cap",
max.matching = 50000)
|
data |
Data Frame - containing the dataset with previously calculated PS. The data frame must contain a treatment indicator variable called 'treat' and a propensity score value called 'ps_values'. |
covariates |
Vector, containing the variable names to be included as potential confounding variables |
estimand |
String, specifying the desired estimand. Options are "ATT" (default) for the Average Treatment Effect in the Treated, or "ATE" for the Average Treatment Effect. |
match.subjects |
Boolean, indicating if matching should be used (default TRUE). This is only applicable when the estimand is "ATT" as "ATE" can only be estimated via IPTW. If the estimand is "ATT", SMRW will always be used to generate weights, but if match.subjects is set to TRUE, matches will also be generated. |
match.exact |
Vector, containing the list of covariate names to perform exact matching on. |
match.ratio |
Number, indicating the match ratio of control:treat |
caliper.sigma |
Number, indicating the width of the caliper to use in matching. A value of 0 indicates that calipers will not be used. A non-zero value will turn on calipers |
use.logit |
Boolean, indicating if the propensity score should be converted to logit before matching. This is generally recommended when using calipers and leads to better balance in most cases. |
truncate.quantile |
Number, indicating the upper quantile at which to apply weight trimming. |
truncate.method |
String, indicating the approach to use to trim the dataset. Large weights can adversely affect the ultimate balance of the population. Two approaches appear in the literature, capping weights at a quantile value or dropping subjects from the dataset. The default for this parameter is "cap", which will downwardly adjust any weights larger than the specified quantile to the value at that quantile. Alternatively, set this parameter to "drop" to remove the subjects from the dataset completely. User will be notified of how many subjects are lost in this step. |
max.matching |
The maximum number of samples that can be used in matching (default 50k) |
This function performs propensity score based population balancing. The details of how the population is balanced depend on the parameters specified by the user, including the requested estimand.
psBalanceData - Object containing parameters used in balancing, along with the resulting data frame. The dataframe has additional variable(s) added for the weights and matches. When matching is used, the is_matched is [0,1] indicating if the subject was matched or not.
1 2 3 4 5 | ## Not run:
ps.balance(myData, covariates)
ps.balance(myData, covariates, match.subjects = TRUE, match.exact = c("GENDER"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.