ett | R Documentation |
These should primarily be used inside models. See Details.
ett(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
att(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
ate(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
etc(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
atc(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
ato(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
olw(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
owt(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
pwt(specification = NULL, dichotomy = NULL, by = NULL, data = NULL)
specification |
optional; a |
dichotomy |
optional; a formula defining the dichotomy of the treatment
variable if it isn't already |
by |
optional; named vector or list connecting names of unit of
assignment/ variables in |
data |
optional; the data for the analysis to be performed on. May be
excluded if these functions are included as the |
These functions should primarily be used in the weight
argument of lmitt()
orlm()
. All arguments are optional if used within
those functions. If used on their own, specification
and
data
must be provided.
ate
- Average treatment effect. Aliases: ate()
.
ett
- Effect of treatment on the treated. Aliases: ett()
,
att()
.
etc
- Effect of treatment on controls. Aliases: etc()
,
atc()
.
ato
- Overlap-weighted average effect. Aliases: ato()
,
olw
, owt
, pwt
.
In a StudySpecification
with block
s, the weights are
generated as a function of the ratio of the number of treated units in a
block versus the total number of units in a block.
In any blocks where that ratio is 0 or 1 (that is, all units in the block have the same treatment status), the weights will be 0. In effect this removes from the target population any block in which there is no basis for estimating either means under treatment or means under control.
If block is missing for a given observation, a weight of 0 is applied.
A dichotomy
is specified by a formula
consisting of a
conditional statement on both the left-hand side (identifying treatment
levels associated with "treatment") and the right hand side (identifying
treatment levels associated with "control"). For example, if your
treatment variable was called dose
and doses above 250 are
considered treatment, you might write:
ate(..., dichotomy = dose > 250 ~ dose <= 250
The period (.
) can be used to assign all other units of assignment.
For example, we could have written the same treatment regime as either
etc(..., dichotomy = dose > 250 ~ .
or
olw(..., dichotomy = . ~ dose <= 250
The dichotomy
formula supports Relational Operators (see
Comparison), Logical Operators (see Logic), and %in%
(see
match()
).
The conditionals need not assign all values of treatment to control or
treatment, for example, dose > 300 ~ dose < 200
does not assign
200 <= dose <= 300
to either treatment or control. This would be
equivalent to manually generating a binary variable with NA
whenever dose
is between 200 and 300. Standard errors will reflect
the sizes of the comparison groups specified by the dichotomy
.
Tim Lycurgus contributed code for the computation of weights. The ‘overlap weight’ concept is due to Li, Morgan and Zaslavsky (2018), although the current implementation differs from that discussed in their paper in that it avoids estimated propensity scores.
a WeightedStudySpecification
object, which is a vector of
numeric weights
Li, Fan, Kari Lock Morgan, and Alan M. Zaslavsky. "Balancing covariates via propensity score weighting." Journal of the American Statistical Association 113, no. 521 (2018): 390-400.
data(simdata)
spec <- rct_spec(z ~ unit_of_assignment(uoa1, uoa2), data = simdata)
summary(lmitt(y ~ 1, data = simdata, specification = spec, weights = ate()), vcov.type = "CR0")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.