home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / SIMTEL / CPMUG / CPMUG080.ARK / X2.STB < prev    next >
Text File  |  1984-04-29  |  1KB  |  34 lines

  1.  
  2.    10   @ : @"Version 02/27/81" : @
  3.    11   @"********"
  4.    30   Input"Enter a Chi-squared value. ",X2
  5.    40   Input"Enter the number of degrees of freedom. ",Freedom
  6.    41   If Freedom>60 Then @"Too many degrees of freedom." : Goto 40
  7.    50   Call .X2'value (X2,Freedom)
  8.    60   Goto 11
  9.    70 Procedure .X2'value (X2,Freedom)
  10.    80   Local I,Z,M,Trail,Numerator,Denominator
  11.    90   Denominator=1
  12.   100     For I=Freedom To 2 Step-2
  13.   110     Denominator=Denominator*I
  14.   120     Next I
  15.   130   Numerator=X2**(Int((Freedom+1)/2))*Exp(-X2/2)
  16.   140   If Fra(Freedom/2)=0 Then  Do
  17.   150     Factor=1
  18.   160     Else
  19.   170     Factor=Sqr(2/(X2*3.141592653599))
  20.   180     Enddo
  21.   190   Z=1
  22.   200   M=1
  23.   210     Repeat
  24.   220     Freedom=Freedom+2
  25.   230     M=M*X2/Freedom
  26.   240     Z=Z+M
  27.   250     Until M<1E-20
  28.   260   Tail=1-Factor*Z*(Numerator/Denominator)
  29.   270   @ : @"Significance >";
  30.   280   @ Using"##.#####",Tail
  31.   310   @
  32.   320   Endproc 
  33.