Last modified: December 2024

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/reg_unc.html
Jump to: Description · Examples · PARAMETERS · Notes · Bugs · See Also


AHELP for CIAO 4.17 Sherpa

reg_unc

Context: confidence

Synopsis

Plot the statistic value as two parameters are varied.

Syntax

reg_unc(par0, par1, id=None, otherids=None, replot=False, min=None,
max=None, nloop=(10, 10), delv=None, fac=4, log=(False, False),
sigma=(1, 2, 3), levels=None, numcores=None, overplot=False)

Description

Create a confidence plot of the fit statistic as a function of parameter value. Dashed lines are added to indicate the current statistic value and the parameter value at this point. The parameter value is varied over a grid of points and the statistic evaluated while holding the other parameters fixed. It is expected that this is run after a successful fit, so that the parameter values are at the best-fit location.


Examples

Example 1

Vary the xpos and ypos parameters of the gsrc model component for all data sets with a source expression.

>>> reg_unc(gsrc.xpos, gsrc.ypos)

Example 2

Use only the data in data set 1:

>>> reg_unc(gsrc.xpos, gsrc.ypos, id=1)

Example 3

Only display the one- and three-sigma contours:

>>> reg_unc(gsrc.xpos, gsrc.ypos, sigma=(1, 3))

Example 4

Display contours at values of 5, 10, and 20 more than the statistic value of the source model for data set 1:

>>> s0 = calc_stat(id=1)
>>> lvls = s0 + np.asarray([5, 10, 20])
>>> reg_unc(gsrc.xpos, gsrc.ypos, levels=lvls, id=1)

Example 5

Increase the limits of the plot and the number of steps along each axis:

>>> reg_unc(gsrc.xpos, gsrc.ypos, id=1, fac=6, nloop=(41, 41))

Example 6

Compare the ampl parameters of the g and b model components, for data sets 'core' and 'jet', over the given ranges:

>>> reg_unc(g.ampl, b.ampl, min=(0, 1e-4), max=(0.2, 5e-4),
...         nloop=(51, 51), id='core', otherids=['jet'])

Example 7

Overplot the results on the `reg_proj` plot:

>>> reg_proj(s1.c0, s2.xpos)
>>> reg_unc(s1.c0, s2.xpos, overplot=True)

PARAMETERS

The parameters for this function are:

Parameter Type information Definition
par0 The parameters to plot on the X and Y axes, respectively.
par1 The parameters to plot on the X and Y axes, respectively.
id int, str, or None, optional The data set that provides the data. If not given then all data sets with an associated model are used simultaneously.
otherids sequence of int or str, or None, optional Other data sets to use in the calculation.
replot bool, optional Set to True to use the values calculated by the last call to `int_proj` . The default is False .
min pair of numbers, optional The minimum parameter value for the calculation. The default value of none means that the limit is calculated from the covariance, using the `fac` value.
max pair of number, optional The maximum parameter value for the calculation. The default value of none means that the limit is calculated from the covariance, using the `fac` value.
nloop pair of int, optional The number of steps to use. This is used when `delv` is set to none .
delv pair of number, optional The step size for the parameter. Setting this overrides the `nloop` parameter. The default is none .
fac number, optional When `min` or `max` is not given, multiply the covariance of the parameter by this value to calculate the limit (which is then added or subtracted to the parameter value, as required).
log pair of bool, optional Should the step size be logarithmically spaced? The default ( False ) is to use a linear grid.
sigma sequence of number, optional The levels at which to draw the contours. The units are the change in significance relative to the starting value, in units of sigma.
levels sequence of number, optional The numeric values at which to draw the contours. This overrides the `sigma` parameter, if set (the default is none ).
numcores optional The number of CPU cores to use. The default is to use all the cores on the machine.
overplot bool, optional If True then add the data to an existing plot, otherwise create a new plot. The default is False .

Notes

The difference to `reg_proj` is that at each step only the pair of parameters are varied, while all the other parameters remain at their starting value. This makes the result a less-accurate rendering of the projected shape of the hypersurface formed by the statistic, but the run-time is likely shorter than, the results of `reg_proj` , which fits the model to the remaining thawed parameters at each step. If there are no free parameters in the model, other than the parameters being plotted, then the results will be the same.


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

confidence
conf, confidence, covar, covariance, get_conf, get_conf_results, get_covar, get_covar_opt, get_covar_results, get_covariance_results, get_int_proj, get_int_unc, get_proj, get_proj_opt, get_proj_results, get_projection_results, get_reg_proj, get_reg_unc, int_proj, int_unc, proj, projection, reg_proj, set_conf_opt, set_covar_opt, set_proj_opt