/* (Programmed by Phil Chapman; revised 9-23-96; send comments or corrections to: pchapman@lamar.colostate.edu) This program graphs the width of a (1-alpha)x100% two-sided confidence interval for the difference between the means of two independently sampled populations versus n (sample size per group). (Pool estimate of variance is used.) We are (1-gamma)x100% sure that the interval will be narrower than the computed width. If the interval is of the form ybar-E to ybar+E then width=2E. The user inputs: alpha= the value to set the confidence level, gamma= the probability that the interval will be wider than calculated. (remember: even though sigma is claimed to be known, s is random and may be larger than sigma) sigma= the estimate of the error standard deviation (this value is taken to be known in the calculation) n1, n2, n3 : Sample size (per group) from n1 to n2 in increments of n3 will be considered. */ options ps=40 nodate; data powerci2; * Begin user inputs; alpha=0.05; gamma=0.1; sigma=4; n1=5; n2=15; n3=1; * End user inputs; do n=n1 to n2 by n3; df=2*n-2; tval=tinv(1-alpha/2,df); fudge=sqrt(cinv(1-gamma,df)/df); * fudge = a factor to allow that s may be larger than sigma; width=2*tval*fudge*sigma*sqrt(2/n); output; end; proc print; var fudge width n; run;