Dear developers,
I was trying to improve my estimation of a Student distribution from the scipy.stats method but found out that my use of OpenTURNS was way worse. So worse that I fear I made an huge mistake in using OpenTURNS.
But the Scipy estimator gave the right answer on a sample Student distribution generated by OpenTURNS.
Thus I am perplexed …
Any ideas ?
Thanks
Here is my code :
import openturns as ot
from scipy import stats
Nbre_mesures = 327680
ecart_type = 1
df = 1.5
# test openturns
# sample generation from scipy and parameter estimation
# from scipy and openturns
student = stats.t.rvs(df, scale=ecart_type, size=Nbre_mesures)
sample = ot.Sample.BuildFromPoint(student)
distribution = ot.StudentFactory().build(sample)
print(stats.t.fit(student), distribution.getParameter())
# In reverse
sample = ot.Student(df, 0.0, ecart_type).getSample(Nbre_mesures)
distribution = ot.StudentFactory().buildAsStudent(sample)
print(stats.t.fit(sample), distribution.getParameter())