R/statpsych1.R
ci.lc.mean.bs.Rd
Computes a test statistic and confidence interval for a linear contrast of means. This function computes both unequal variance and equal variance confidence intervals and test statistics. A Satterthwaite adjustment to the degrees of freedom is used with the unequal variance method.
ci.lc.mean.bs(alpha, m, sd, n, v)
alpha level for 1-alpha confidence
vector of estimated group means
vector of estimated group standard deviations
vector of sample sizes
vector of between-subjects contrast coefficients
Returns a 2-row matrix. The columns are:
Estimate - estimated linear contrast
SE - standard error
t - t test statistic
df - degrees of freedom
p - two-sided p-value
LL - lower limit of the confidence interval
UL - upper limit of the confidence interval
Snedecor GW, Cochran WG (1989). Statistical Methods, 8th edition. ISU University Pres, Ames, Iowa.
m <- c(33.5, 37.9, 38.0, 44.1)
sd <- c(3.84, 3.84, 3.65, 4.98)
n <- c(10,10,10,10)
v <- c(.5, .5, -.5, -.5)
ci.lc.mean.bs(.05, m, sd, n, v)
#> Estimate SE t df p
#> Equal Variances Assumed: -5.35 1.300136 -4.114955 36.00000 0.0002152581
#> Equal Variances Not Assumed: -5.35 1.300136 -4.114955 33.52169 0.0002372436
#> LL UL
#> Equal Variances Assumed: -7.986797 -2.713203
#> Equal Variances Not Assumed: -7.993583 -2.706417
# Should return:
# Estimate SE t df
# Equal Variances Assumed: -5.35 1.300136 -4.114955 36.00000
# Equal Variances Not Assumed: -5.35 1.300136 -4.114955 33.52169
# p LL UL
# Equal Variances Assumed: 0.0002152581 -7.986797 -2.713203
# Equal Variances Not Assumed: 0.0002372436 -7.993583 -2.706417