Student’s t-distribution

Contents

Student’s t-distribution#

import fesslix as flx
flx.load_engine()

import numpy as np
import fesslix.plot as flx_plot
import matplotlib.pyplot as plt
%matplotlib inline
Random Number Generator: MT19937 - initialized with rand()=1570929617;
Random Number Generator: MT19937 - initialized with 1000 initial calls.

Syntax#

property studentst#

Student’s t-distribution

studentst is a distribution type (flx_rv_type) for Random variables in Fesslix.

Parametrization:

Parameters of the distribution can be specified as additional key-value pairs in an object of type flx_rv_config. The Student’s t-distribuiton accepts only a single parameter:

Example:

rv_1 = flx.rv({'name':'rv_1', 'type':'studentst', 'dof':1. })
rv_2 = flx.rv({'name':'rv_2', 'type':'studentst', 'dof':2. })
rv_3 = flx.rv({'name':'rv_3', 'type':'studentst', 'dof':5. })
rv_4 = flx.rv({'name':'rv_4', 'type':'studentst', 'dof':10. })
rv_lst = [ rv_1, rv_2, rv_3, rv_4 ]

PDF#

x_bound = 6.

fig, ax = plt.subplots(figsize=(10, 4))

for rv in rv_lst:
    flx_plot.draw_pdf(ax, rv, config_dict={'label':rv.get_name(), 'x_low':-x_bound, 'x_up':x_bound}) 

ax.set_ylim([0., None])
ax.set_xlim([-x_bound, x_bound])
plt.xlabel(r"$x$")
plt.ylabel(r"$f_X(x)$")
plt.legend()
plt.show()
../_images/bb24206641d648118ab372f2005e9d7c5f0cdaf68a749fd86e07592d643e32a6.png

CDF#

x_bound = 6.

fig, ax = plt.subplots(figsize=(10, 4))

for rv in rv_lst:
    flx_plot.draw_cdf(ax, rv, config_dict={'label':rv.get_name(), 'x_low':-x_bound, 'x_up':x_bound}) 

ax.set_ylim([0., 1.])
ax.set_xlim([-x_bound, x_bound])
plt.xlabel(r"$x$")
plt.ylabel(r"$F_X(x)$")
plt.legend()
plt.show()
../_images/5fb6c9edb5f1a7f474accda87f217cb4cbdc2346079333c62f1eb099941e11e3.png