[system] / trunk / webwork / system / courseScripts / Distributions.pm Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Diff of /trunk/webwork/system/courseScripts/Distributions.pm

Revision 77 Revision 78
440 440
441# Autoload methods go after =cut, and are processed by the autosplit program. 441# Autoload methods go after =cut, and are processed by the autosplit program.
442 442
4431; 4431;
444__END__ 444__END__
445
445# Below is the stub of documentation for your module. You better edit it! 446# Below is the stub of documentation for your module.
446 447
448 449
449Statistics::Distributions - Perl module for calculating critical values of common statistical distributions 450Statistics::Distributions - Perl module for calculating probabilities and critical values of common statistical distributions
450 451
452 453
453 use Statistics::Distributions; 454 use Statistics::Distributions;
455
456 \$uprob=uprob(-0.85);
457 print "upper probability of the u distribution: Q(u) = 1-G(u) (u=1.43) = \$uprob";
458
459 \$tprob=tprob(3, 6.251);
460 print "upper probability of the t distribution: Q = 1-G (3 degrees of freedom , t = 6.251) = \$tprob";
461
462 \$chisprob=chisqrprob(3, 6.25);
463 print "upper probability of the chi-square distribution: Q = 1-G (3 degrees of freedom, chi-squared = 6.25) = \$chisprob";
464
465 \$fprob=fprob(3,5, .625);
466 print "upper probability of the F distribution: Q = 1-G (3 degrees of freedom in numerator, 5 degrees of freedom in denominator, F \$
467
468 \$u=udistr(.05);
469 print "u-crit (95th percentile = 0.05 level) = \$u";
470
471 \$t=tdistr(1, .005);
472 print "t-crit (1 degree of freedom, 99.5th percentile = 0.005 level) =\$t";
454 473
455 \$chis=chisqrdistr(2, .05); 474 \$chis=chisqrdistr(2, .05);
456 print "Chi-squared-crit (2 degrees of freedom, 95th percentile = 0.05 level) = \$chis"; 475 print "Chi-squared-crit (2 degrees of freedom, 95th percentile = 0.05 level) = \$chis";
457 476
458 \$u=udistr(.05);
459 print "u-crit (95th percentile = 0.05 level) = \$u";
460
461 \$t=tdistr(1, .005);
462 print "t-crit (1 degree of freedom, 99.5th percentile = 0.005 level) =\$t";
463
464 \$f=fdistr(1,3, .01); 477 \$f=fdistr(1,3, .01);
465 print "F-crit (1 degree of freedom in numerator, 3 degrees of freedom in denominator, 99th percentile = 0.01 level) = \$f"; 478 print "F-crit (1 degree of freedom in numerator, 3 degrees of freedom in denominator, 99th percentile = 0.01 level) = \$f";
466
467 \$uprob=uprob(-0.85);
468 print "upper probability of the u distribution: Q(u) = 1-G(u) (u=1.43) = \$uprob";
469
470 \$chisprob=chisqrprob(3, 6.25);
471 print "upper probability of the chi-square distribution: Q = 1-G (3 degrees of freedom, chi-squared = 6.25) = \$chisprob";
472
473 \$tprob=tprob(3, 6.251);
474 print "upper probability of the t distribution: Q = 1-G (3 degrees of freedom , t = 6.251) = \$tprob";
475 Note: this function works OK if t is close to 0, but is not accurate for if t is far from 0.
476
477 \$fprob=fprob(3,5, .625);
478 print "upper probability of the F distribution: Q = 1-G (3 degrees of freedom in numerator, 5 degrees of freedom in denominator, F = 6.25) = \$fprob";
479 479