phit
Examples

Exploring the t distribution

Compare Student's t densities and tail probabilities with the normal as the degrees of freedom change.
Uses phit

Inputs

Running

Student's t with 3 degrees of freedom has heavier tails than the normal. Every value here comes from the native distribution functions, which are checked against 60-digit references.

use function Phit\{dist_t_pdf_array, dist_t_sf};

dist_t_pdf_array($xs, 3);  // one native call for the whole grid
2 * dist_t_sf(1.96, 3);      // two-sided tail probability
t critical value (95%)
3.1824
Normal critical value
1.96

Densities

Two-sided tail probabilities

|x| > t normal
1.645 0.1985 0.1
1.96 0.1449 0.05
2.576 0.0821 0.01
3.291 0.046 9.983e-4

Script: site/vignettes/distributions.php in phpstats/phit@76b22f0.