# errplot - Plot sample profile uncertainty¶

 reload_errors Reload the MCMC state and compute the model confidence intervals. calc_errors_from_state Compute confidence regions for a problem from the Align the sample profiles and compute the residual difference from the measured data for a set of points returned from DREAM. calc_errors Align the sample profiles and compute the residual difference from the measured data for a set of points. show_errors Display the confidence regions returned by calc_errors().

Estimate model uncertainty from random sample.

MCMC uncertainty analysis gives the uncertainty on the model parameters rather than the model itself. For example, when fitting a line to a set of data, the uncertainty on the slope and the intercept does not directly give you the uncertainty in the expected value of y for a given value of x.

The routines in bumps.errplot allow you to generate confidence intervals on the model using a random sample of MCMC parameters. After calculating the model y values for each sample, one can generate 68% and 95% contours for a set of sampling points x. This can apply even to models which are not directly measured. For example, in scattering inverse problems the scattered intensity is the value measured, but the fitting parameters describe the real space model that is being probed. It is the uncertainty in the real space model that is of primary interest.

Since bumps knows only the probability of seeing the measured value given the input parameters, it is up to the model itself to calculate and display the confidence intervals on the model and the expected values for the data points. This is done using the bumps.plugin architecture, so application writers can provide the appropriate functions for their data types. Eventually this capability will move to the model definition so that different types of models can be processed in the same fit.

For a completed MCMC run, four steps are required:

1. reload the fitting problem and the MCMC state
2. select a set of sample points
3. evaluate model confidence intervals from sample points
4. show model confidence intervals

reload_errors() performs steps 1, 2 and 3, returning errs. If the fitting problem and the MCMC state are already loaded, then use calc_errors_from_state() to perform steps 2 and 3, returning errs. If alternative sampling is desired, then use calc_errors() on a given set of points to perform step 3, returning errs. Once errs has been calculated and returned by one of these methods, call show_errors() to perform step 4.

bumps.errplot.reload_errors(model, store, nshown=50, random=True)[source]

Reload the MCMC state and compute the model confidence intervals.

The loaded error data is a sample from the fit space according to the fit parameter uncertainty. This is a subset of the samples returned by the DREAM MCMC sampling process.

model is the name of the model python file

store is the name of the store directory containing the dream results

nshown and random are as for calc_errors_from_state().

Returns errs for show_errors().

bumps.errplot.calc_errors_from_state(problem, state, nshown=50, random=True, portion=1.0)[source]

Compute confidence regions for a problem from the Align the sample profiles and compute the residual difference from the measured data for a set of points returned from DREAM.

nshown is the number of samples to include from the state.

random is True if the samples are randomly selected, or False if the most recent samples should be used. Use random if you have poor mixing (i.e., the parameters tend to stay fixed from generation to generation), but not random if your burn-in was too short, and you want to select from the end.

Returns errs for show_errors().

bumps.errplot.calc_errors(problem, points)[source]

Align the sample profiles and compute the residual difference from the measured data for a set of points.

The return value is arbitrary. It is passed to the show_errors() plugin for the application. Returns errs for show_errors().

bumps.errplot.show_errors(errs)[source]

Display the confidence regions returned by calc_errors().

The content of errs depends on the active plugin.