Computes equal variance and unequal variance confidence intervals for a population 2-group mean difference using the estimated means, estimated standard deviations, and sample sizes. Use the t.test function for raw data input.
ci.mean2(alpha, m1, m2, sd1, sd2, n1, n2)
alpha level for 1-alpha confidence
estimated mean for group 1
estimated mean for group 2
estimated standard deviation for group 1
estimated standard deviation for group 2
sample size for group 1
sample size for group 2
Returns a 2-row matrix. The columns are:
Estimate - estimated mean difference
SE - standard error
t - t test statistic
df - degrees of freedom
p - 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.
ci.mean2(.05, 15.4, 10.3, 2.67, 2.15, 30, 20)
#> Estimate SE t df p
#> Equal Variances Assumed: 5.1 0.7151214 7.131656 48.00000 4.621279e-09
#> Equal Variances Not Assumed: 5.1 0.6846568 7.448987 46.17476 1.898214e-09
#> LL UL
#> Equal Variances Assumed: 3.662152 6.537848
#> Equal Variances Not Assumed: 3.721998 6.478002
# Should return:
# Estimate SE t df
# Equal Variances Assumed: 5.1 1.602248 3.183029 48.0000
# Equal Variances Not Assumed: 5.1 1.406801 3.625247 44.1137
# p LL UL
# Equal Variances Assumed: 0.0025578586 1.878465 8.321535
# Equal Variances Not Assumed: 0.0007438065 2.264986 7.935014