incorrect first moment of non central t-distribution
See original GitHub issueMy issue is about the calculation of the first moment in t-distribution, which is wrong. I’m following the tutorial example from https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.t.html. By directly implementing the formula from wikipedia (https://en.wikipedia.org/wiki/Noncentral_t-distribution) I get a different result than through the scipy package. It seems that the first moment is always equal to the specified location (loc parameter).
Reproducing code example:
import numpy as np
from scipy.stats import t
from scipy.special import gamma
df = 10
loc = 1
scipy_first_moment = t.stats(df = df, loc = loc, moments='m')
real_first_moment = loc*np.sqrt(df/2)*(gamma(0.5*(df-1))/gamma(df/2))
print(scipy_first_moment == real_first_moment)
Error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
Scipy/Numpy/Python version information:
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Noncentral t-distribution
The noncentral t-distribution generalizes Student's t-distribution using a noncentrality ... distribution describes how t is distributed when the null is false.
Read more >Noncentral t Distribution
Describes the Noncentral t Distribution and how to calculate the cumulative distribution (cdf) and probability distribution (pdf) function values in Excel.
Read more >A Study of non-central Skew t Distributions and their ...
PROBLEM UNDER THE NON-CENTRAL SKEW t DISTRIBUTION 75 ... The moment generating function and the first few moments of the skew normal distribution....
Read more >statistics - Why is noncentral t-distribution for sample size ...
This is wrong because s itself is a random variable and therefore cannot be included in the bounds. If it were, I could...
Read more >Non-central t distribution and the power of the t test
ties in with the non-central t distribution, explicitly noted ... f (t) = (2) in which . (2). Its first statistical moments are:....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I agree w/ @josef-pkt If it starts to come up more frequently we can always revisit.
note in the docstring, We cannot identify when a user doesn’t interpret the parameters correctly.
(twice in a row in 11 years is not a whole lot)