Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Luis A. Afonso
Posts:
4,699
From:
LIsbon (Portugal)
Registered:
2/16/05


Binomial to Normal approach
Posted:
May 22, 2014 1:43 PM


Binomial to Normal approach
Though the sample size is large a 95% confidence Interval for the mean can be evaluated from a Binomial (a Bernoulli independent events sequence each one with the probability p to occur) sample from which it was obtained y successes out of n, Critical Interval approximate, y/n +/ 1.960*sqrt [y/n*(1y/n)/n] To simulate exactly Binomial r.v. is straightforward: from n events do count a success every time, a RND is lesser (or equal) than p, otherwise do not. The number of successes follows exactly a Binomial Distribution with parameters p, n. Project Ã routine, <saphir0> , in view to illustrate the accuracy we got relative to the expected difference between two proportions pX pY. For the Normal Approach Sigma= sqrt[pX*(1pX)/nX + pY*(1pY)/nY]____(a) Results Mean difference (out of 20 attempts) Mean sigma (a)
Experiment 1 ______(0.5, 40 )  (0.2, 35) 0.2993 against 0.3000 0.1040 against (a)= 0.1040 Experiment 2 ______(0.8, 40 )  (0.5, 30) 0.3001 against 0.3000 0.1114 against (a)= 0.1111 Experiment 2´ 0.3005 0.1108 Experiment 2´´ 0.3002 0.1110 Experiment 3 ______(0.8, 200 )  (0.5, 150) 0.2998 against 0.3000 0.0496 against (a)= 0.0497 Experiment 3´ 0.3002 0.0497
It worth to be noted that simulating 2000 samples size afresh we get a null bias compared with the classical Normal Approach even for 30 to 40 sizes and p so far as 0.2 (or 0.8) from ½. To corroborate this result I made a new experiment, (0.90, 30), (0.85, 30), providing, in mean, a difference= 0.0500 and sigma = 0.0852 when (1) give 0.0851.
Luis A. Afonso
REM "SAPHIR0" CLS DEFDBL AZ PRINT PRINT " <SAPHIR0> " PRINT PRINT " X  > BIN(0.8, 200) "; PRINT " Y  > BIN(0.5, 150) " PRINT : PRINT INPUT " pX , nX "; pX, nX INPUT " pY , nY "; pY, nY PRINT : PRINT : PRINT : PRINT FOR encore = 1 TO 20 RANDOMIZE TIMER rrpt = 2000 FOR rpt = 1 TO rrpt REM xi = 0: yi = 0 FOR i = 1 TO nX IF RND < pX THEN xi = xi + 1 NEXT i FOR i = 1 TO nY IF RND < pY THEN yi = yi + 1 NEXT i diff = xi / nX  yi / nY Ediff = Ediff + diff / rrpt ssdiff = ssdiff + diff * diff NEXT rpt PRINT " Ediff, ssdiff "; PRINT USING " ###.### "; Ediff; ssdiff; meanediff = meanediff + Ediff var = (ssdiff  rrpt * Ediff * Ediff) / (rrpt  1) PRINT USING " sigma ##.#### "; SQR(var) Esigma = Esigma + SQR(var) / 20 Ediff = 0: ssdiff = 0 NEXT encore PRINT PRINT USING " Meanediff= ##.#### "; meanediff / 20 PRINT USING " Esigma= ##.#### "; Esigma PRINT : COLOR 3 PRINT " Normal approach" u = pX * (1  pX) / nX + pY * (1  pY) / nY u = SQR(u) PRINT USING " ##.#### "; u END



