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
studentstis 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:dof(flxParaPosNo0): degrees of freedom
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()
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()