About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/compute_statistic.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 compute_statistic Context: sherpa

Synopsis

Module function to estimate a statistic given arrays of data, model amplitudes, and errors, etc.

Syntax

Double_Type compute_statistic(Struct_Type)
Double_Type compute_statistic(Array_Type,Array_Type \
[,Array_Type[,Array_Type[,Array_Type]]]))

Error Return Value: NULL

Arguments:

(1) Structure containing data, model amplitude, etc., arrays; or

(1) Array of observed data

(2) Array of predicted model amplitudes

(3) Array of estimated errors

(4) Array of systematic errors

(5) Array of statistical weights

Description

This function computes the summed statistic value given Sherpa's current STATISTIC setting. (Note that the data et al. need not have been input into Sherpa!)

If an error array is input, then note that the actual setting of chi-square (e.g., CHI GEHRELS or CHI DVAR) does not matter (since the input errors are used instead of error estimates) if the chi-square statistic is used. Also note that the error array is ignored for likelihood-based statistics (e.g., CASH).

On the other hand, if an errors array is not provided, and a data-based variance is used (chi gehrels, chi dvar, and chi parent), then errors are estimated via a call to the function compute_errors; there is thus an implicit assumption that the input data array elements are counts. If chi mvar is used, then the errors are set equal to the input predicted model amplitudes.

Example

Compute the statistic given a data and model array (with errors estimated):

sherpa> get_stat_expr
chi gehrels
sherpa> d = [55,53,59]
sherpa> m = [55.5,55.6,55.7]
sherpa> compute_statistic(d,m)
0.243771

Because an error array was not provided, errors were estimated using the CHI GEHRELS variance formula; then the total statistic was computed. Below, we explicit create and use an array of errors:

sherpa> e = [5.5,5.3,5.9]
sherpa> compute_statistic(d,m,e)
0.561761
sherpa> STATISTIC CHI DVAR
sherpa> compute_statistic(d,m,e)
0.561761

The version of chi-square does not matter since the error estimates are provided.

Bugs

See the Sherpa bug pages online for an up-to-date listing of known bugs.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.