next up previous contents
Next: Multiple Models: a Background Up: Walks through XSPEC Previous: Fitting Models to Data:

Simultaneous Fitting

XSPEC has the very useful facility of allowing models to be fitted simultaneously to more than one data file. It is even possible to group files together and to fit different models simultaneously. Reasons for fitting in this manner include:

Other scenarios are possible--the important thing is to recognize the flexibility of XSPEC in this regard.

As an example we will look at a case of fitting the same model to two different data files but where not all the parameters are identical. Again, this is an older dataset that provides a simpler illustration than more modern data. The massive X-ray binary Centaurus X-3 was observed with the LAC on Ginga in 1989. Its flux level before eclipse was much lower than the level after eclipse. Here, we'll use XSPEC to see whether spectra from these two phases can be fitted with the same model, which differs only in the amount of absorption. This kind of fitting relies on introducing an extra dimension, the group, to the indexing of the data files. The files in each group share the same model but not necessarily the same parameter values, which may be shared as common to all the groups or varied separately from group to group. Although each group may contain more than one file, there is only one file in each of the two groups in this example. Groups are specified with the data command, with the group number preceding the file number, like this:

XSPEC12>data 1:1 losum 2:2 hisum

2 spectra  in use
 
Spectral Data File: losum.pha  Spectrum 1
Net count rate (cts/s) for Spectrum:1  1.401e+02 +/- 3.549e-01
 Assigned to Data Group 1 and Plot Group 1
  Noticed Channels:  1-48
  Telescope: GINGA Instrument: LAC  Channel Type: PHA
  Exposure Time: 1 sec
 Using fit statistic: chi
 Using test statistic: chi
 Using Response (RMF) File            ginga_lac.rsp for Source 1

Spectral Data File: hisum.pha  Spectrum 2
Net count rate (cts/s) for Spectrum:2  1.371e+03 +/- 3.123e+00
 Assigned to Data Group 2 and Plot Group 2
  Noticed Channels:  1-48
  Telescope: GINGA Instrument: LAC  Channel Type: PHA
  Exposure Time: 1 sec
 Using fit statistic: chi
 Using test statistic: chi
 Using Response (RMF) File            ginga_lac.rsp for Source 1

Here, the first group makes up the file losum.pha, which contains the spectrum of all the low, pre-eclipse emission. The second group makes up the second file, hisum.pha, which contains all the high, post-eclipse emission. Note that file number is ``absolute'' in the sense that it is independent of group number. Thus, if there were three files in each of the two groups (lo1.pha, lo2.pha, lo3.pha, hi1.pha, hi2.pha, and hi3.pha, say), rather than one, the six files would be specified as da 1:1 lo1 1:2 lo2 1:3 lo3 2:4 hi1 2:5 hi2 2:6 hi3. The ignore command works on file number, and does not take group number into account. So, to ignore channels 1-3 and 37-48 of both files:

XSPEC12> ignore 1-2:1-3 37-48

The model we'll use at first to fit the two files is an absorbed power law with a high-energy cut-off:

XSPEC12> mo phabs * highecut (po)

After defining the model, we will be prompted for two sets of parameter values, one for the first group of data files (losum.pha), the other for the second group (hisum.pha). Here, we'll enter the absorption column of the first group as $10^{24}$ cm$^{-2}$ and enter the default values for all the other parameters in the first group. Now, when it comes to the second group of parameters, we enter a column of $10^{22}$ cm$^-2$ and then enter defaults for the other parameters. The rule being applied here is as follows: to tie parameters in the second group to their equivalents in the first group, take the default when entering the second-group parameters; to allow parameters in the second group to vary independently of their equivalents in the first group, enter different values explicitly:

XSPEC12>mo phabs*highecut(po)

Input parameter value, delta, min, bot, top, and max values for ...
Current:     1   0.001     0     0   1E+05   1E+06
DataGroup 1:phabs:nH>100
Current:     10   0.01  0.0001   0.01   1E+06   1E+06
DataGroup 1:highecut:cutoffE>
Current:     15   0.01  0.0001   0.01   1E+06   1E+06
DataGroup 1:highecut:foldE>
Current:     1   0.01    -3    -2     9    10
DataGroup 1:powerlaw:PhoIndex>
Current:     1   0.01     0     0   1E+24   1E+24
DataGroup 1:powerlaw:norm>
Current:    100   0.001     0     0   1E+05   1E+06
DataGroup 2:phabs:nH>1
Current:     10   0.01  0.0001   0.01   1E+06   1E+06
DataGroup 2:highecut:cutoffE>/*
========================================================================
Model phabs<1>*highecut<2>*powerlaw<3> Source No.: 1   Active/On
Model Model Component  Parameter  Unit     Value
 par  comp
                           Data group: 1
   1    1   phabs      nH         10^22    100.000      +/-  0.0          
   2    2   highecut   cutoffE    keV      10.0000      +/-  0.0          
   3    2   highecut   foldE      keV      15.0000      +/-  0.0          
   4    3   powerlaw   PhoIndex            1.00000      +/-  0.0          
   5    3   powerlaw   norm                1.00000      +/-  0.0          
                           Data group: 2
   6    1   phabs      nH         10^22    1.00000      +/-  0.0          
   7    2   highecut   cutoffE    keV      10.0000      = 2
   8    2   highecut   foldE      keV      15.0000      = 3
   9    3   powerlaw   PhoIndex            1.00000      = 4
  10    3   powerlaw   norm                1.00000      = 5
________________________________________________________________________

Notice how the summary of the model, displayed immediately above, is different now that we have two groups, as opposed to one (as in all the previous examples). We can see that of the 10 model parameters, 6 are free (i.e., 4 of the second group parameters are tied to their equivalents in the first group). Fitting this model results in a huge $\chi^2$ (not shown here), because our assumption that only a change in absorption can account for the spectral variation before and after eclipse is clearly wrong. Perhaps scattering also plays a role in reducing the flux before eclipse. This could be modeled (simply at first) by allowing the normalization of the power law to be smaller before eclipse than after eclipse. To decouple tied parameters, we change the parameter value in the second group to a value - any value - different from that in the first group (changing the value in the first group has the effect of changing both without decoupling). As usual, the newpar command is used:

XSPEC12>newpar 10 1

Fit statistic : Chi-Squared =   2.025975e+07 using 66 PHA bins.

Test statistic : Chi-Squared =   2.025975e+07 using 66 PHA bins.
 Reduced chi-squared =       343385.7 for     59 degrees of freedom
 Null hypothesis probability =   0.000000e+00
 Current data and model not fit yet.
XSPEC12>fit
...
 ========================================================================
Model phabs<1>*highecut<2>*powerlaw<3> Source No.: 1   Active/On
Model Model Component  Parameter  Unit     Value
 par  comp
                           Data group: 1
   1    1   phabs      nH         10^22    20.1548      +/-  0.181919
   2    2   highecut   cutoffE    keV      14.6847      +/-  5.59260E-02
   3    2   highecut   foldE      keV      7.41661      +/-  8.99590E-02
   4    3   powerlaw   PhoIndex            1.18693      +/-  6.33041E-03
   5    3   powerlaw   norm                5.88350E-02  +/-  9.30517E-04
                           Data group: 2
   6    1   phabs      nH         10^22    1.27017      +/-  3.77710E-02
   7    2   highecut   cutoffE    keV      14.6847      = p2
   8    2   highecut   foldE      keV      7.41661      = p3
   9    3   powerlaw   PhoIndex            1.18693      = p4
  10    3   powerlaw   norm                0.312138     +/-  4.49104E-03
________________________________________________________________________


Fit statistic : Chi-Squared =       15423.79 using 66 PHA bins.

After fitting, this decoupling reduces $\chi^2$ by a factor of six to 15,478, but this is still too high. Indeed, this simple attempt to account for the spectral variability in terms of ``blanket'' cold absorption and scattering does not work. More sophisticated models, involving additional components and partial absorption, should be tried.


next up previous contents
Next: Multiple Models: a Background Up: Walks through XSPEC Previous: Fitting Models to Data: