samur {SAMUR} | R Documentation |
This function generates multiple subsets of the data in which the distribution of covariates is balanced across treatment groups. It works by binning the output of a base matching algorithm into a multidimensional histogram, and drawing - without replacement - from the full data set according to the histogram. This leads to higher data coverage across multiple matched subsets without duplication of cases within each subset.
samur(
formula, data
, matched.subset = 1:nrow(data)
, nsmp = 100
, use.quantile = TRUE, breaks = 10
, replace = length(unique(matched.subset)) < length(matched.subset)
)
## S3 method for class 'samur'
print(x, ...)
formula |
Formula expression used to describe the treatment variable (lhs) and covariates used during matching (rhs). |
data |
Data frame containing the treatment variables and matched covariates as specified in the |
matched.subset |
An integer vector representing the indexes of a subset of |
nsmp |
Number of stochastically matched subsets to generate. |
use.quantile |
Should numeric covariates be binned using quantiles ( |
breaks |
number of breaks to use in binning numeric covariates. |
replace |
Boolean flag indicating whether or not to perform sampling with replacement. |
x |
An object of class |
... |
Arguments passed to/from other methods. |
An object of class samur
, a matrix of size length(matched.subset)
by nsmp
, where each column is a matched subset wihtout case duplication. It also has the following attributes:
call |
Copy of function call. |
formula |
Formula passed to the function. |
mdg |
Multi-dimensional grid used for binning the matched data subsets. |
mdh |
Multi-dimensional histogram resulting frm binning |
data |
Copy of data frame passed to the function. |
Mansour T.A. Sharabiani, Alireza S. Mahani
## Not run:
library(SAMUR)
library(Matching)
data(lalonde)
myformula <- treat ~ age + educ
myglm <- glm(myformula, lalonde, family="binomial")
X <- myglm$fitted.values
# using M=1 and replace=F to ensure no duplication
bimatch <- Match(Tr = lalonde$treat, X = myglm$fitted.values
, M = 1, replace = F, caliper = 0.25)
idx <- c(bimatch$index.control, bimatch$index.treated)
my.samur <- samur(formula = myformula, data = lalonde
, matched.subset = idx, nsmp = 100
, breaks = 10, use.quantile = TRUE)
summary(my.samur, nboots = 500)
## End(Not run)