1
$\begingroup$

I am using the scipy.stats.t.fit function, and I am surprised by the results. If I fit on some bimodal data, say

data=[1,1,1,1,5,5]

I get

df=0.39126249808550329
loc=1.0
scale=5.7172845190830792e-21

That is, the scale is effectively zero, and I will never be able to sample anything near 5, just the more frequent data point 1.

I guess you really can't fit on data that is too different from a t-distribution - but is scipy really giving the best t dist fit to the data? I would think that if I compute a sample mean and variance myself, i.e,

df = 5
loc = 2.33
scale = 1.88

That I'd have a better fit, although I haven't computed the likelihood of sampling [1,1,1,5,5] from these two t distributinos.

$\endgroup$
1
$\begingroup$

The t-test has many assumptions. That dataset violates several of them:

  • Data should be sufficiently large (>30 independent points)
  • Data should be approximately normally distributed

Given that the assumptions are violated, you can not expect to valid results.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.