Probability Distribution Function and Shape

The Chi-Square Distribution

A random variable has a Chi-square distribution with [Maple Math] degrees of freedom ( [Maple Math] ( [Maple Math] ) ) if and only if its probability density is given by

[Maple Math] for x > 0

f ( x ) =

0 elsewhere.

The following code will draw the density function for the [Maple Math] ( [Maple Math] ) distribution for [Maple Math] . However, you are encouraged to try other values of [Maple Math] .

> restart;

> with(plots):

> nu:=5;

[Maple Math]

> f:=x->ChisquarePDF(nu,x);

[Maple Math]

> plot(f(x),x=0..20);

[Maple Plot]

To see the effect of [Maple Math] on the shape of the [Maple Math] ( [Maple Math] ) distribution, the following animation will draw a series of PDFs as [Maple Math] varies from 1 to 21 by increments of 1. What happens as [Maple Math] increases?

> nu[0]:=1; nu_step:=1;

[Maple Math]

[Maple Math]

> for n from 0 to 20 do

> density[n]:=plot(ChisquarePDF(nu[0]+n*nu_step,x),x=0..35):

> num:=convert(evalf(nu[0]+n*nu_step,3),string):

> tracker[n]:=textplot([18,0.3,`nu is `.num],color=blue);

> P[n]:=display({density[n],tracker[n]}):

> od:

> display([seq(P[n], n=0..20)], insequence=true);

>

[Maple Plot]

This next bit of code will animate the CDF of a [Maple Math] ( [Maple Math] ) through the same values of [Maple Math] as the previous example.

What happens to the CDF as [Maple Math] increases?

> nu[0]:=1; nu_step:=1;

[Maple Math]

[Maple Math]

> for n from 0 to 20 do

> density[n]:=plot(ChisquareCDF(nu[0]+n*nu_step,x),x=0..35):

> num:=convert(evalf(nu[0]+n*nu_step,3),string):

> tracker[n]:=textplot([18,0.3,`nu is `.num],color=blue);

> P[n]:=display({density[n],tracker[n]}):

> od:

> display([seq(P[n], n=0..20)], insequence=true);

[Maple Plot]

>