Semi-amplitude Confidence Intervals for the two normal difference means
With normal data X~N(muX, sigma): nX, Y~N(muY, sigma): nY whatever the sample sizes nX, nY , the C.I. for D= muX-muY is obtained from:
Obsvdiff - t0*s <= D <= Obsvdiff + t0*s
Where Obsvdiff is the observed difference of the sample mean values, t0(1- alpha/2) is the student T value nX+nY-2 degrees of freedom, and s is such that s0^2 = (ssdX+ssdY)/(nX+nY-2) *(1/nX+1/nY) ssd= sum of squared deviations.
The T values were 2.306, 2.011, 2.048, 2.024, 2.011, 2.002, respectively. Aim: these evaluations do show how large should be the samples in order that a given difference on observed sample means can be ascribed to differences on Populations and not to unavoidable random fluctuations. Luis A. Afonso REM "class-2" CLS PRINT " < class-2 > " DEFDBL A-Z DIM ww(8001) INPUT " nX, nY (<= ) "; nX, nY pi = 4 * ATN(1) df = nX + nY - 2 PRINT " df= "; df INPUT " Tstudent "; tst INPUT " How many "; many FOR rt = 1 TO 10 RANDOMIZE TIMER REM FOR rpt = 1 TO many REM mx = 0: xx = 0 FOR i = 1 TO nX aa = SQR(-2 * LOG(RND)) x = 0 + aa * COS(2 * pi * RND) mx = mx + x / nX xx = xx + x * x NEXT i sqdX = xx - nX * mx * mx my = 0: yy = 0 FOR i = 1 TO nY aa = SQR(-2 * LOG(RND)) Y = 0 + aa * COS(2 * pi * RND) my = my + Y / nY yy = yy + Y * Y NEXT i sqdY = yy - nY * my * my sqd = sqdX + sqdY uW = SQR(sqd / (nX + nY - 2)) * SQR(1 / nX + 1 / nY) uW = tst * uW uu = INT(uW * 1000 + .5) IF uu > 8000 THEN uu = 8000 ww(uu) = ww(uu) + 1 / many NEXT rpt g = .975 sw = 0 FOR t = 0 TO 8000 sw = sw + ww(t) IF sw > g THEN GOTO 14 NEXT t 14 PRINT USING " #.### "; t / 1000; sw REM xi = t / 1000 mix = mix + xi / 10 xxi = xxi + xi * xi FOR tt = 0 TO 8001: ww(tt) = 0: NEXT tt NEXT rt REM ssdi = xxi - 10 * mix * mix v = ssdi / (10 * 9) e = SQR(v / 9) PRINT USING " mean #.### "; mix; PRINT USING "+/- #.### "; e END