0

I have a set of data points sampled from a normal distribution.

mu, sigma = 0, 1
x = rng.normal(mu, sigma, 100)

I add outliers to the initial set

outliers =  np.random.uniform(low=6, high=7, size=10)

# Concatenate original samples with outliers
x = np.append(x, outliers)
y = stats.norm.pdf(x, 0, 1)

I then try to find the new distribution

# Find new mean and standard deviation
mu_new, sigma_new = stats.norm.fit(x)
# Get new distribution
y_norm_new = stats.norm.pdf(x_norm, mu_new, sigma_new)

And here is where I get stuck: I want to fit the t-distribution to the same data (x). However, stats.t.fit(x) returns three values:

unknown_value_maybe_df, mu_t, sigma_t = stats.t.fit(x)

I assume the first value is the degree of freedom. Is this correct? I cannot find a confirmation in the documentation. The only certainty is that the last two are loc and scale. The first one is an "Estimates for any shape parameters (if applicable)".

0 Answers0