satlas.stats.fitting.likelihood_walk

satlas.stats.fitting.likelihood_walk(f, x, y, xerr=None, func=<function poisson_llh at 0x0000000008DF2D08>, nsteps=2000, walkers=20, filename=None)[source]

Calculates the uncertainty on MLE-optimized parameter values by performing a random walk through parameter space and comparing the resulting loglikelihood values. For more information, see the emcee package. The data from the random walk is saved in a file, as defined with the filename.

Parameters:
  • f (BaseModel) – Model to be fitted to the data.
  • x (array_like) – Experimental data for the x-axis.
  • y (array_like) – Experimental data for the y-axis.
Other Parameters:
 
  • func (function, optional) – Used to calculate the loglikelihood that the data is drawn from a distribution given a model value. Should accept input as (y_data, y_model). Defaults to the Poisson loglikelihood.
  • nsteps (integer, optional) – Determines how many steps each walker should take. Defaults to 2000 steps.
  • walkers (integer, optional) – Sets the number of walkers to be used for the random walk. The number of walkers should never be less than twice the number of parameters. For more information on this, see the emcee documentation. Defaults to 20 walkers.
  • filename (string, optional) – Filename where the random walk has to be saved. If None, the current time in seconds since January 1970 is used.

Note

The parameters associated with the MLE fit are not updated with the uncertainty as estimated by this method.