plotStudentT.frink

Download or view plotStudentT.frink in plain text format


// This program plots the density function for the Student's-t distribution
// and the normal distribution.

use statistics.frink

plotStudent[degreesFreedom, g is graphics] :=
{
   c = new polyline
   for x=-4 to 4 step .1
   {
      c.addPoint[x, -16 studentTDensity[x,degreesFreedom]]
   }

   g.add[c]
}

plotNormal[g is graphics] :=
{
   c = new polyline
   for x=-4 to 4 step .1
   {
      c.addPoint[x, -16 normalDensity[x,0,1]]
   }

   g.add[c]
}

g = new graphics
g.drawRectSides[-4,-16 * 0.4, 4, 0]
points = 100
g.color[0,1,0]
plotStudent[1, g]
g.color[1,0,0]
plotStudent[2, g]
g.color[1/2,0,0]
plotStudent[30, g]

g.color[0,0,1]
plotNormal[g]
g.show[]


Download or view plotStudentT.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen, eliasen@mindspring.com