program define chisq4 version 4.0 preserve clear gph open gph pen 1 set obs 501 gen x=70*uniform() gen y=.1*uniform() graph y x,xlab(0,10,20,30,40,50,60,70) ylab(0,.025,.05,.075,.1) s(i) gphconv replace x=70*((_n-1)/500) pdf_chi2 x y 10 lines x y pdf_chi2 x y 20 lines x y pdf_chi2 x y 30 lines x y pdf_chi2 x y 40 lines x y gph text 1000 16000 0 0 chi-square curves for 10, 20, 30, and 40 degrees of freedom gph close restore exit end