/* (Programmed by Phil Chapman; revised 9-16-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 mean of a single population versus n. 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 sizes from n1 to n2 in increments of n3 will be considered */ options ps=40 nodate; data powerci; * Begin user inputs; alpha=0.05; gamma=0.1; sigma=4; n1=10; n2=50; n3=2; * End user inputs; do n=n1 to n2 by n3; df=n-1; 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(n); output; end; proc print; var fudge width n; run;