MONT 107N -- Understanding Randomness 

Normal and Chi-Square Distributions 

April 14, 2010 

 

 

The first plot shows a histogram for a random sample of size 10000 from a standard 

normal distribution.  (Note:  The scaling is different from what we have used in class, though. 

The total area under the normal curve -- in red -- is 1, rather than 100%.) 

 

restart; -1; with(plots); -1; with(Statistics); -1 

`assign`(Y, RandomVariable(Normal(0, 1))); -1; `assign`(SampleY, Sample(Y, 10000)); -1 

`assign`(PDFPlot1, DensityPlot(Y, color = red)); -1 

`assign`(EmpPlot1, Histogram(SampleY)); -1; display(PDFPlot, EmpPlot1); 1 

Plot_2d
 

Now we ask, what does the distribution of the  squares  of the sample values for a sample of size 10000 from
a normally-distributed population look like?  
 

`assign`(SampleYSquared, Sample(`*`(`^`(Y, 2)), 10000)); -1 

`assign`(EmpPlot2, Histogram(SampleYSquared, range = 0.1e-3 .. 16)); -1 

`assign`(PDFPlot2, DensityPlot(ChiSquare(1), color = red)); -1 

display(EmpPlot2, PDFPlot2, view = [0 .. 16, 0 .. 3]); 1 

Plot_2d
 

This is following the curve for a `*`(`^`(chi, 2))distribution with one degree of freedom 

very closely.  This no coincidence.  In more mathematical statistics courses, 

like the one we teach for math majors, it is proved that the square of a  

standard normal random variable has precisely this `*`(`^`(chi, 2))distribution(!)