Skip to contents

Constructs Tukey–Kramer-type simultaneous confidence intervals on one or more contrasts of covariate-adjusted means in the analysis of covariance (ANCOVA) when the covariate(s) are random, using the Bryant–Paulson generalized studentized range (see bryant_paulson). Unlike the per-comparison interval of ci_c_ancova, these intervals control the familywise error rate over the whole family of comparisons and, through the Bryant–Paulson critical value, correctly account for the extra sampling uncertainty that comes from estimating the covariate adjustment from random covariates. Naively applying Tukey's method to adjusted means ignores that uncertainty and produces intervals that are too narrow (below-nominal coverage); a simulation study of that undercoverage is maintained alongside the package.

Usage

ci_c_ancova_bp(
  adj_means,
  s_ancova,
  c_weights = NULL,
  n,
  num_covariates = 1,
  df = NULL,
  conf_level = 0.95,
  contrast_type = c("pairwise", "allowance"),
  ...
)

Arguments

adj_means

A numeric vector of the covariate-adjusted group means (one per group). The number of groups \(k\) is inferred from its length.

s_ancova

The standard deviation of the errors from the ANCOVA model, i.e., the square root of the ANCOVA error mean square (use the standard deviation, not the variance from the source table).

c_weights

Optional contrast weights. May be (i) a numeric vector of length \(k\) giving a single contrast, or (ii) a matrix/data.frame with \(k\) columns, each row a contrast. If NULL (the default), all \(k(k-1)/2\) pairwise comparisons are returned. For each contrast the weights should sum to zero.

n

Either a single number giving the common per-group sample size or a numeric vector of per-group sample sizes. The Bryant–Paulson distribution is exact for balanced designs; for unequal \(n\) a Tukey–Kramer harmonic adjustment is used (see Details).

num_covariates

The number of random covariates, \(p\). Default 1.

df

Optional error degrees of freedom \(\nu\). If NULL (default) it is computed for a one-way ANCOVA as \(\nu = \sum n - k - p\). Supply it directly for other designs (e.g., a randomized-block ANCOVA, where \(\nu\) differs).

conf_level

The simultaneous (familywise) confidence level. Default 0.95.

contrast_type

One of "pairwise" (default) or "allowance". "pairwise" uses the Tukey–Kramer quadratic standard error, exact for pairwise comparisons. "allowance" uses Tukey's allowance, which yields intervals that hold simultaneously over all contrasts, including complex ones (this is the form in Eq. (2.4) of Bryant and Bruvold, 1980). The width factor each choice applies is given in Details. The two coincide for pairwise comparisons.

...

Additional arguments (currently unused).

Value

A data.frame (class dmar_tbl) with one row per contrast and columns contrast (a label), estimate (the contrast of adjusted means \(\hat\psi\)), lower_limit, and upper_limit. The Bryant–Paulson critical value used is stored in the "critical_value" attribute and the confidence level in the "conf_level" attribute (printed beneath the table).

Details

The interval. For a contrast \(\psi = \sum_i c_i \theta_i\) of adjusted means, the simultaneous interval is $$\hat\psi \;\pm\; q_{\alpha;\,p,k,\nu}\; \hat\sigma_{y\mid x}\; w(c),$$ where \(q_{\alpha;\,p,k,\nu}\) is the upper-\(\alpha\) Bryant–Paulson critical value (qbryant_paulson) and the width factor is \(w(c) = \tfrac{1}{\sqrt2}\sqrt{\sum_i c_i^2/n_i}\) for contrast_type = "pairwise" or \(w(c) = \tfrac12 \sum_i |c_i| \sqrt{1/n}\) for contrast_type = "allowance" (balanced \(n\)). For a pairwise difference with common \(n\) both reduce to \(q_{\alpha;\,p,k,\nu}\,\hat\sigma_{y\mid x}\sqrt{1/n}\), reproducing the critical difference of Bryant and Bruvold (1980).

No per-comparison covariate term. By design the standard error here does not include the \((\bar X_i - \bar X_j)^2 / SS_{\mathrm{within}(x)}\) term that appears in a single-comparison ANCOVA interval (ci_c_ancova). In the Bryant–Paulson framework the random-covariate uncertainty is carried by the (larger) critical value, which holds on average over the covariate distribution; adding the per-pair term as well would double-count it.

Unequal sample sizes. For unbalanced designs the "pairwise" standard error uses \(\sqrt{c_i^2/n_i}\) directly (the Tukey–Kramer generalization); coverage is then approximate but typically very close to nominal and slightly conservative.

References

Bryant, J. L., & Paulson, A. S. (1976). An extension of Tukey's method of multiple comparisons to experimental designs with random concomitant variables. Biometrika, 63, 631–638.

Bryant, J. L., & Bruvold, N. T. (1980). Multiple comparison procedures in the analysis of covariance. Journal of the American Statistical Association, 75(372), 874–880. doi:10.2307/2287175

Maxwell, S. E., Delaney, H. D., & Kelley, K. (2027). Designing experiments and analyzing data: A model comparison perspective (4th ed.). Routledge. (See Chapter 9.)

Author

Ken Kelley kkelley@nd.edu

Examples

# The multiplier for these intervals is a Bryant-Paulson quantile, which has
# no closed form: it is obtained by inverting a numerical integral with a
# root search. With the single random covariate of the worked example below
# that takes about half a second per call, so nothing on this page is run;
# the calls, with the values they produce, are given here.

# Bryant and Bruvold (1980) worked example: 6 panels, 1 covariate, nu = 14,
# ANCOVA error MS = 0.01326. Here the design is a randomized block with
# s = 4 blocks, so the per-group "n" for the adjusted-mean SE is 4 and the
# error df (14) must be supplied directly.
# adj <- c(3.595, 3.619, 4.102, 4.515, 4.618, 4.876)
# bp <- ci_c_ancova_bp(adj_means = adj, s_ancova = sqrt(0.01326),
#                      n = 4, num_covariates = 1, df = 14)
# bp
# The multiplier is 4.83 and every pairwise critical difference is 0.278,
# matching the paper; the 15 intervals hold jointly at the 95 percent level.
# The multiplier is kept on the result, so the critical difference can be
# rebuilt by hand as q * s_ancova * sqrt(1/n):
# attr(bp, "critical_value")
# attr(bp, "critical_value") * sqrt(0.01326) * sqrt(1 / 4)

# A complex contrast (say panels 1 and 2 against panels 3 through 6) is
# requested by passing its weights to c_weights, together with
# contrast_type = "allowance", the all-contrasts form of Eq. (2.4) of
# Bryant and Bruvold. That contrast of adjusted means is -0.921, with
# simultaneous limits of -1.199 and -0.643.
# ci_c_ancova_bp(adj_means = adj, s_ancova = sqrt(0.01326),
#                c_weights = c(0.5, 0.5, -0.25, -0.25, -0.25, -0.25),
#                n = 4, num_covariates = 1, df = 14,
#                contrast_type = "allowance")