Function to calculate the exact confidence interval for a contrast in a fixed effects analysis of variance context. This function assumes homogeneity of variance (as does the ANOVA upon which 's.anova' is based).

1 2 3 |

`means` |
a vector of the group means or the means of the particular level of the effect (for fixed effect designs) |

`s.anova` |
the standard deviation of the errors from the ANOVA model (i.e., the square root of the mean square error) |

`c.weights` |
the contrast weights (choose weights so that the positive |

`n` |
sample sizes |

`N` |
total sample size |

`Psi` |
the (unstandardized) contrast effect, obtained by multiplying the |

`conf.level` |
confidence interval coverage (i.e., 1- Type I error rate); default is .95 |

`alpha.lower` |
Type I error for the lower confidence limit |

`alpha.upper` |
Type I error for the upper confidence limit |

`df.error` |
the degrees of freedom for the error. In one-way designs, this is simply |

`...` |
allows one to potentially include parameter values for inner functions |

Returns the confidence limits for the contrast:

`Lower.Conf.Limit.Contrast ` |
the lower confidence limit for the contrast effect |

`Contrast ` |
the value of the estimated unstandardized contrast effect |

`Upper.Conf.Limit.Contrast` |
the upper confidence limit for the contrast effect |

Be sure to use the standard deviation and not the error variance for `s.anova`

, not the square of this value (the error variance) which would come from the source table (i.e., do not use the variance of the error but rather use its square root, the standard deviation).

Be sure to use fractional *c*-weights when doing complex contrasts (not integers) to specify `c.weights`

. For example, in an ANCOVA of four groups, if the user wants to compare the mean of group 1 and 2 with the mean of group 3 and 4, `c.weights`

should be specified as c(0.5, 0.5, -0.5, -0.5) rather than c(1, 1, -1, -1). Make sure the sum of the contrast weights is zero.

Ken Kelley (University of Notre Dame; KKelley@ND.Edu)

Kelley, K. (2007). Constructing confidence intervals for standardized effect sizes: Theory, application, and implementation. *Journal of Statistical Software, 20* (8), 1–24.

Steiger, J. H. (2004). Beyond the *F* Test: Effect size confidence intervals and tests of close fit in the
analysis of variance and contrast analysis. *Psychological Methods, 9*, 164–182.

`conf.limits.nct`

, `ci.sc`

, `ci.src`

, `ci.smd`

, `ci.smd.c`

, `ci.sm`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
# Here is a four group example. Suppose that the means of groups 1--4 are 2, 4, 9,
# and 13, respectively. Further, let the error variance be .64 and thus the standard
# deviation would be .80 (note we use the standard deviation in the function, not the
# variance). The contrast of interest here is the average of groups 1 and 4 versus the
# average of groups 2 and 3.
ci.c(means=c(2, 4, 9, 13), s.anova=.80, c.weights=c(.5, -.5, -.5, .5),
n=c(3, 3, 3, 3), N=12, conf.level=.95)
# Here is an example with two groups.
ci.c(means=c(1.6, 0), s.anova=.80, c.weights=c(1, -1), n=c(10, 10), N=20, conf.level=.95)
# An example given by Maxwell and Delaney (2004, pp. 155--171) :
# 24 subjects of mild hypertensives are assigned to one of four treatments: drug
# therapy, biofeedback, dietary modification, and a treatment combining all the
# three previous treatments. Subjects' blood pressure is measured two weeks
# after the termination of treatment. Now we want to form a 95% level
# confidence interval for the difference in blood pressure between subjects
# who received drug treatment and those who received biofeedback treatment
## Drug group's mean = 94; group size=4
## Biofeedback group's mean = 91; group size=6
## Diet group's mean = 92; group size=5
## Combination group's mean = 83; group size=5
## Mean Square Within (i.e., 'error.variance') = 67.375
ci.c(means=c(94, 91, 92, 83), s.anova=sqrt(67.375), c.weights=c(1, -1, 0, 0),
n=c(4, 6, 5, 5), N=20, conf.level=.95)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.