The chi-square statistic is
chi^2 = (sum)_i [ [ N(i,S) - B(i,x,pB) - S(i,x,pS) ]^2 / sigma(i)^2 ]
where N(i,S)
is the total number of observed counts in bin 
i of the 
on-source region;
B(i,x,pB) 
is the number of predicted background model counts in bin 
i of the 
on-source region (zero for background-subtracted data), 
rescaled from bin 
i of the 
off-source region, and computed as a function of 
the model argument 
x(i) 
(e.g., energy or time) and set of background 
model parameter values 
pB; 
S(i,x,pS)
is the number of predicted source model counts in bin 
i,
as a function of the model argument x(i) 
and set of source model parameter 
values pS; and 
sigma(i) 
is the error in bin 
i.
The options for assigning 
sigma(i) 
are described in the documentation for 
CHI DVAR (CHIDVAR), 
CHI GEHRELS (CHIGEHRELS), 
CHI MVAR (CHIMVAR), and
CHI PRIMINI (CHIPRIMINI).
In each of these files,
N(i,B) 
is the total number of observed counts in bin i 
of the off-source 
region; 
A(B) 
is the off-source `area,' which could be the size of the region 
from which the background is extracted, or the length of a background time 
segment, or a product of the two, etc.; and
A(S) is the on-source `area.'
In the analysis of PHA data, 
A(B)  is the product of the
BACKSCAL and EXPTIME FITS header keyword values,
provided in the file containing the background data.
A(S) is computed 
similarly, from keyword values in the source data file.
Note that in the current version of Sherpa, 
it is assumed that there is a
one-to-one mapping between a given background region bin and a given
source region bin.  For instance, 
in the analysis of PHA data, it is assumed 
that the input background counts spectrum
is binned in exactly the same way as the input source counts spectrum, and
any filter applied to the source spectrum automatically applied 
to the background spectrum.
This means that currently, the user cannot, e.g., 
specify arbitrary background
and source regions in two dimensions and get correct results.
This will be changed in a future version of Sherpa.
(However, this limitation only applies when analyzing 
background data that have been entered with the 
BACK command.
One can always enter the background as a separate dataset and 
jointly fit the source and background regions.)