t_sample¶
-
sherpa.astro.ui.
t_sample
(num=1, dof=None, id=None, otherids=(), numcores=None)¶ Sample the fit statistic by taking the parameter values from a Student’s t-distribution.
For each iteration (sample), change the thawed parameters by drawing values from a Student’s t-distribution, and calculate the fit statistic.
Parameters: - num (int, optional) – The number of samples to use (default is 1).
- dof (optional) – The number of degrees of freedom to use (the default is to use the number from the current fit).
- id (int or str, optional) – The data set containing the model expression. If not given then the default identifier is used, as returned by get_default_id.
- otherids (sequence of int or str, optional) – For when multiple source expressions are being used.
- numcores (optional) – The number of CPU cores to use. The default is to use all the cores on the machine.
Returns: A NumPy array table with the first column representing the statistic and later columns the parameters used.
Return type: samples
See also
fit()
- Fit a model to one or more data sets.
normal_sample()
- Sample from the normal distribution.
set_model()
- Set the source model expression for a data set.
set_stat()
- Set the statistical method.
uniform_sample()
- Sample from a uniform distribution.
Examples
The model fit to the default data set has three free parameters. The median value of the statistic calculated by t_sample is returned:
>>> ans = t_sample(num=10000) >>> ans.shape (1000, 4) >>> np.median(ans[:,0]) 119.9764357725326