Function to obtain the confidence interval for a standardized contrast in a fixed effects analysis of variance context.
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 (chose weights so that the positive cweights sum to 1 and the negative cweights sum to 1; i.e., use fractional values not integers). 
n 
sample sizes per group or sample sizes for the level of the particular factor (if length 1 it is assumed that the sample size per group or for the level of the particular factor are are equal) 
N 
total sample size 
Psi 
the (unstandardized) contrast effect, obtained by multiplying the jth mean by the jth contrast weight (this is the unstandardized effect) 
ncp 
the noncentrality parameter from the tdistribution 
conf.level 
desired level of confidence for the computed interval (i.e., 1  the Type I error rate) 
alpha.lower 
the Type I error rate for the lower confidence interval limit 
alpha.upper 
the Type I error rate for the upper confidence interval limit 
df.error 
the degrees of freedom for the error. In oneway designs, this is simply Nlength (means) and need not be specified; it must be specified if the design has multiple factors. 
... 
optional additional specifications for nested functions 
Lower.Conf.Limit.Standardized.Contrast 
the lower confidence limit for the standardized contrast 
Standardized.contrast 
standardized contrast 
Upper.Conf.Limit.Standardized.Contrast 
the upper confidence limit for the standardized contrast 
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 the error variance and not its square root (i.e., use the variance of the standard deviation of the errors).
Be sure to use the standard deviations of errors for s.anova
and s.ancova
, not the square of these values (i.e., do not use the variance of the errors).
Be sure to use fractional cweights when doing complex contrasts (not integers) to specify c.weights
. For exmaple, 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 are 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.
Lai, K., & Kelley, K. (2007). Sample size planning for standardized ANCOVA and ANOVA contrasts: Obtaining narrow confidence intervals. Manuscript submitted for publication.
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.src
, ci.smd
, ci.smd.c
, ci.sm
, ci.c
1 2 3 4 5 6 7 8 9 10 11 12  # Here is a four group example. Suppose that the means of groups 14 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 standardized contrast of interest here is the average of groups 1 and 4
# versus the average of groups 2 and 3.
ci.sc(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.sc(means=c(1.6, 0), s.anova=.80, c.weights=c(1, 1), n=c(10, 10), 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.