/***************************************************************************************************************** SAS file name: t_Curves.sas File location: _________________________________________________________________________________________________________________ Purpose: Describe the t distribution and draw Probability Density functions for different degres of freedom and compare these to the standard normal density. Author: Peter Clemmensen Creation Date: 05/06/2017 This program supports the t distribution examples on SASnrd.com *****************************************************************************************************************/ /* Create T PDF Data */ data t_PDF; do DOF = 1, 3, 10; do x=-4 to 4 by 0.01; pdf_t=pdf('t', x, DOF); output; end; end; pdf_t = .; do x=-4 to 4 by 0.01; pdf_Normal=pdf('Normal', x); output; end; run; title 'Students t densities for different degrees of freedom'; proc sgplot data=t_PDF noautolegend; series x=x y=pdf_t / group=DOF lineattrs=(thickness=2); series x=x y=pdf_Normal / legendlabel="N(0,1)" lineattrs=(thickness=3 color=black); keylegend / position=NE location=inside across=1 noborder valueattrs=(Size=12 Weight=Bold) title="DOF =" titleattrs=(Size=12 Weight=Bold); yaxis min=0 max=0.42 label="PDF" labelattrs=(size=12 weight=Bold); xaxis min=-3 max=3 label='x' labelattrs=(size=12 weight=Bold); run; title;