1. Concepts & Definitions
1.1. Continous random distribution of probability
1.2. Normal distribution of probability
1.3. Standard normal distribution of probability
1.4. Inverse standard normal distribution
1.6. Inverse Student's T distribution
2. Problem & Solution
2.1. Weight, dimension, and value per HS6
2.2. How to fit a distribution
2.3. Employing standard deviation
2.4. Total time spent in a system
It is denoted as X ∼ t(k). And is read as X is a continuous random variable that follows Student’s T distribution with parameter k. Where k is the degrees of freedom. If the sample size is n, then k = n-1. Student’s T distribution is a small sample size approximation of a normal distribution. As the degrees of freedom increase, the t distribution tends to become the Standard Normal distribution.
The Student’s T distribution PMF formula follows the next equation.
The Student’s T distribution CDF formula follows the next equation.
Instead of employing the previous equations, the values from tables or from computational commands are employed in problems that need Student's T distribution.
Visually, the Student’s t distribution looks much like a normal distribution but generally has fatter tails. Fatter tails as you may remember allows for a higher dispersion of variables, as there is more uncertainty.
The second characteristic of the Student’s t-statistic is that there are degrees of freedom. Usually, for a sample of n, we have n-1 degrees of freedom. So, for a sample of 20 observations, the degrees of freedom are 19.
The following code shows how to compute Student's T probabilities employing PDF of Normal distribution using norm.ppf command.
from scipy.stats import t
import matplotlib.pyplot as plt
import numpy as np
#creating an array of values between
#-3 to 3 with a difference of 0.2
x = np.arange(-3, 3, 0.2)
deg_f = 10
y = t.pdf(x, df = deg_f)
plt.plot(x,y,'r-',x, y,'bo')
plt.show()
plt.bar(x, y)
plt.show()
The following code is particularly interesting to show how to compute the interval of probabilities employing the cumulative distribution function (CDF) of Student's T distribution using t.cdf command.
from scipy.stats import t
import matplotlib.pyplot as plt
import numpy as np
#creating an array of values between
#-3 to 3 with a difference of 0.2
x = np.arange(-3, 3, 0.2)
mean = 0
std = 1
deg_f = 10
y = t.cdf(x, df = deg_f, loc = mean, scale = std)
plt.grid()
plt.plot(x, y)
plt.show()
The following code shows the probability of the numerical example employing CDF of Normal distribution using norm.cdf command.
from scipy.stats import t
import matplotlib.pyplot as plt
import numpy as np
x = [-3, 3]
mean = 0
std = 1
deg_f = 10
y = t.cdf(x, df = deg_f, loc = mean, scale = std)
print(y)
[0.00667183 0.99332817]
pinterval = y[1] - y[0]
print('P(-3 <= X <= 3) = ',pinterval)
P(-3 <= X <= 3) = 0.9866563449774304
The previous complete code is available in the following link:
https://colab.research.google.com/drive/1lCaiy-2PJvrgPbCKoKyRoLTA_y5r_Ne6?usp=sharing