R/statpsych1.R
sim.ci.mean2.Rd
Performs a computer simulation of separate variance and pooled variance confidence interval performance for a population mean difference in a 2-group design. Sample data within each group can be generated from five different population distributions. All distributions are scaled to have a standard deviation of 1.0 in group 1.
sim.ci.mean2(alpha, n1, n2, sd.ratio, dist1, dist2, rep)
alpha level for 1-alpha confidence
sample size in group 1
sample size in group 2
ratio of population standard deviations (sd2/sd1)
type of distribution for group 1 (1, 2, 3, 4, or 5)
type of distribution for group 2 (1, 2, 3, 4, or 5)
1 = Gaussian (skewness = 0 and excess kurtosis = 0)
2 = platykurtic (skewness = 0 and excess kurtosis = -1.2)
3 = leptokurtic (skewness = 0 and excess kurtosis = 6)
4 = moderate skew (skewness = 1 and excess kurtosis = 1.5)
5 = large skew (skewness = 2 and excess kurtosis = 6)
number of Monte Carlo samples
Returns a 1-row matrix. The columns are:
Coverage - probability of confidence interval including population mean difference
Lower Error - probability of lower limit greater than population mean difference
Upper Error - probability of upper limit less than population mean difference
Ave CI Width - average confidence interval width
sim.ci.mean2(.05, 30, 25, 1.5, 4, 5, 1000)
#> Coverage Lower Error Upper Error Ave CI Width
#> Equal Variances Assumed: 0.934 0.044 0.022 1.354007
#> Equal Variances Not Assumed: 0.944 0.045 0.011 1.411572
# Should return (within sampling error):
# Coverage Lower Error Upper Error Ave CI Width
# Equal Variances Assumed: 0.93986 0.04022 0.01992 1.344437
# Equal Variances Not Assumed: 0.94762 0.03862 0.01376 1.401305