Reputation: 1646
I would like to compute the inverse CDF of Student T distribution using MATLAB without the statistic toolbox but with the help of Python and SciPy, see as well https://stackoverflow.com/a/20627638/7556646.
The following code running from MATLAB R2023a using Python 3.9.13
py.scipy.stats.t().ppf(0.975, df=4)
gives me the following error:
Error using _distn_infrastructure>__init__
Python Error: TypeError: _parse_args() missing 1 required positional argument: 'df'
Error in _distn_infrastructure>freeze (line 824)
Error in _distn_infrastructure>__call__ (line 829)
The argument df
is provided but not recognized. I don't understand why? See as well https://ch.mathworks.com/help/matlab/matlab_external/python-function-arguments.html
For a normal distribution I can use SciPy from MATLAB:
py.scipy.stats.norm().ppf(0.975)
returns 1.9600
as expected.
In Python I can do it:
>>> scipy.stats.t.ppf(0.975, df=4)
2.7764451051977987
Upvotes: 0
Views: 183
Reputation: 1646
The following code will work:
>> py.scipy.stats.t(df=4).ppf(0.975)
ans =
2.7764
Upvotes: 0