Description Usage Arguments Details Value References Examples
blocking_estimator
estimates treatment effects in blocked experiments.
The function expects the user to provide the outcomes, a blocking object
and treatment assignments. It returns point estimates of sample average
treatment effects and variance estimates.
1  blocking_estimator(outcomes, blocking, treatments)

outcomes 
numeric vector with observed outcomes. 
blocking 

treatments 
factor specifying the units' treatment assignments. 
To produce point estimates, blocking_estimator
requires that each block
contains at least one unit assigned to each treatment condition. For variance
estimation, it requires that each block contains at least two units assigned to
each condition. When treatments have been assigned with the
assign_treatment
function (or an equivalent procedure), the
variance estimators are conservative in expectation (see the referenced
note below for details). If treatment is assigned with another method, the
estimator might not be valid.
The function estimates treatment effects by aggregating blocklevel effect estimates. It estimates effects within each block by taking the difference in mean outcomes in the block. The samplelevel estimate is then derived as the weighted average of the blocklevel effects using the size of the blocks as weights. In detail, let n_b be the number of units assigned to block b, and n be the total number of units in the sample. Let Y(t, b) be the average outcome for units assigned to treatment t in block b. The effect of treatment t versus treatment s is then estimated as:
∑\frac{n_b}{n}[Y(t, b)  Y(s, b)],
where the sum is taken over the blocks in the experiment. See the referenced note for more details.
A list with two numeric matrices with estimated treatment effects and
their estimated variances is returned. The first matrix (effects
)
contains estimated treatment effects. Rows in this matrix indicate minuends
in the treatment effect contrast and columns indicate subtrahends. For
example, in the matrix:
a  b  c  
a  0.0  4.5  5.5 
b  4.5  0.0  1.0 
c  5.5  1.0  0.0 
the estimated treatment effect between conditions a and b is 4.5, and the estimated treatment effect between conditions c and b is 1.0.
The second matrix (effect_variances
) contains estimates of
variances of the corresponding effect estimators.
Higgins, Michael J., Fredrik Sävje and Jasjeet S. Sekhon (2015), ‘Blocking estimators and inference under the NeymanRubin model’, arXiv 1510.01103. https://arxiv.org/abs/1510.01103
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  # Example blocking
my_blocking < qb_blocking(c("A", "A", "B", "C", "B",
"C", "B", "C", "B", "A",
"C", "C", "A", "B", "B",
"B", "B", "A", "A", "C"))
# Two treatment conditions
my_treatments < assign_treatment(my_blocking)
my_outcomes < rnorm(20)
blocking_estimator(my_outcomes, my_blocking, my_treatments)
# Three treatment conditions
my_treatments < assign_treatment(my_blocking, c("T1", "T2", "C"))
my_outcomes < rnorm(20)
blocking_estimator(my_outcomes, my_blocking, my_treatments)
# Four treatment conditions
# (This will throw an error because variances cannot be estimated)
my_treatments < assign_treatment(my_blocking, c("T1", "T2", "T3", "C"))
my_outcomes < rnorm(20)
## Not run: blocking_estimator(my_outcomes, my_blocking, my_treatments)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.