%\input /pros/doc/scidoc/skeleton.tex
\def\version{\it Rev. 1.0 --- 4/1/86}
\def\chapter{\it Timing Analysis: Random Deviations}
%\chapterhead{Science Specifications for the PROS}
%\chapterhead{Timing Analysis: Random Deviations}
\chapterhead{VI.~Random Deviations}

\@{Overview}

\noindent
{\it Science Contact}:  L. Van Speybroeck/J. McClintock

\noindent
{\it Function Purpose}:
The routines BINVAR and ARRIVL search for and assign statistical significance 
to random temporal deviations from steady emission.
\footnote*{This is an edited and concatenated
version of memoranda by L. Van Speybroeck contained in SAO Special
Report 393 (pp. 226-233) on the HEAO-2 data analysis system.}


The temporal characteristics investigated are:

\vskip 12 pt

\item{1.} Number vs. arrival time:  BINVAR
\item{2.} Interval distribution:  ARRIVL

Technique no.~1 is expected to be sensitive to low-frequency fluctuations
and technique no.~2 to high-frequency.  The programs are described below
in turn, and a method for dealing with data gaps is described in an appendix.


\@{Full Description:  BINVAR (Number vs. arrival time)}

This test is designed to determine if the photons are bunched into smaller
portions of the observation interval.  The test is performed one of two
ways depending upon the number of photons:


\**{Case A:  N $>$ 50}

{\list

The observation is defined into bins of equal length, and a $\chi^2$ test 
performed upon the numbers of photons in the bins.  The number of bins is 
determined by the criterion given in \S 11.2.3 of Eadie {\it et al.}$^{(1)}$:

}

$$k = b \left[ {2(N-1)\over \lambda\alpha + \lambda\beta} \right]^{2/5}$$

\itemitem{}where:

{ \list

$k$ = Number of bins

$N$ = Number of photons
          
$\lambda$ = Probability of indication that a constant source is
variable

$\beta$ = Probability of indication that a variable source is constant

$\lambda\alpha,\ \lambda\beta$ = Points of normal distribution:

$Q(\lambda\alpha) = \alpha$

$b$ = a constant between 2 and 4 depending upon the types of data; we chose $b = 4$

We also insist that the number of photons expected per bin be $\geq5$.  In our
simulations we have chosen $\lambda\alpha + \lambda\beta = 3.61$
(corresponding to $\alpha = 0.1,\ \beta = 0.01$).

}

\**{Case B:  N $\leq$ 50}

{\list

If there are not enough photons to satisfy the $N/k \leq 5$ criterion, then we use
the Smirnov-Cramer-Von Mises test (Eadie {\it et al.} \S 11.4.1).  This test
consists of calculating the area between the expected and observed cumulative 
distribution functions.  The photon times are sorted into time arrival order
and the observed cumulative distribution function, S$_{N}$, is
calculated:

}
$$\eqalign{S_{N}(t)&= 0 \qquad\qquad  t < t_1 \cr
&=i/N \qquad\quad t_i \leq t < t_i + 1 \cr
&= 1 \qquad\qquad t_N \leq t \cr }$$

{\list

Then, if $F(t)$ is the expected cumulative probability distribution, we
have:

}

$$W^2 = \int \lbrack S_N(t) - F(t)\rbrack^2 \left( {dF\over dt}\right) dt$$

{\list

and the statistic of interest is $NW^2$.  This statistic has been tabulated
by Anderson and Darling$^{(2)}$ and has the mean expected value of $1/6$.  
For HEAO-2, Adams has simulated a large number of cases, and he finds that 
the following expression is a useful approximation.  (It will probably be
necessary to redo these simulations for ROSAT):

}

$$P(NW^2 \geq x) = e^{-6x}$$

{\list

We use a constant probability distribution for $F$ that ignores dead
time effects, which are not important for the few photon case.

Thus, if the observation has length $T$ beginning at $t_o$, then:

}

$$\eqalign{F(t)& =0 \qquad\qquad\qquad\quad  t < t_o \cr
F(t)& =(t-t_o)/T \qquad\quad t_o\leq t < t_o + T \cr
F(t)& = 1.0 \qquad\qquad\qquad  t \leq t_o+T \cr }$$

\@{Full Description:  ARRIVL (Interval distribution)}

The intervals between photon arrivals are sorted and the tests of 
described above
are applied to the interval distribution.  The bin boundaries are
selected so that approximately equal numbers of intervals per bin are
expected.  The expected interval distribution for the Einstein HRI, including
deadtime effects, is given as follows:

\vskip 12pt
\halign{\indent#&\hfil#\hfil&#\hfil\quad&\hfil#\hfil&#\hfil \cr
&Let~~~&$\tau$&=  &the interval \cr
&&&& \cr
&&$P(\tau)$&=  &probability density function \cr
&&&& \cr
&&$F(\tau)$&=  &$\int dt\ P(t)$ \cr
&&&& \cr
&&$m$&=  &local source rate \cr
&&&& \cr
&&$M$&=  &total rate \cr
&&&& \cr
&&$T$&=  &gate interval = 0.01 sec \cr
&&&& \cr
&&$f_o$&=  &probability of zero events during an \cr
&&&&interval $T$ and define the integer $n$ by \cr
&&&&$\tau =  nT + \epsilon ;\qquad\qquad \epsilon < T;\qquad 0 \leq n$ \cr }

{\list

Then:

}

$$f_o = [1 - (m/M) (1- {\rm exp}(-MT))]$$

{\list

Case 1:

}

$$\eqalign{n & = 0 (\tau < T) \cr
P(\tau) & =m \sinh (M\tau)/( \exp (MT) - 1) \cr
F(\tau) & =(m/M) (\cosh (M\tau) - 1)/(\exp (MT) - 1) \cr }$$

{\list

Case 2:

}

$$\eqalign{ n & > 0 \ (\tau > T) \cr
P(\tau) & =(m/2)f_o^{n-1} \left[ (1 + m/M\ell^{-MT})\ell^{-M\epsilon} +
(1 - m/M)\ell^{-M(T-\epsilon)}\right] \cr
F(\tau) & = 1-f_o^{n-1} + (m/2M)f_o^{n-1} \left[ (1 - \ell^{-MT}) +
(1 - \ell^{-M\epsilon})F_1 \right] \cr
F_1 & = (1 + m/M\ \ell^{-MT}) + (1 -m/M) \ell^{-M(T-\epsilon)} \cr }$$

\@{References}

\refindent
1.  W.T. Eadie, D. Drijard, F.E. James, M. Roos, B. Sacloulet, 
{\it Statistical Methods in Experimental Physics}, North-Holland Pub.
Company, 1971.

\refindent
2.  T.W. Anderson and D.A. Darling, {\it Ann. Math. Statist.} {\bf 23}, 193 (1952).

\@{APPENDIX:  Detection of Random Fluctuations Including Data Gaps}

The present variability analysis program does not include the effects of
intervals, which obviously represents a loss of sensitivity.  This memo
suggests additions to our procedures to allow adding results from separate
data sets.

The first requirement is a program which gathers data from the
various SRT files pertinent to a source.  This program should 
use the position data determined by analysing the summed data,
and should create a file having a common reference time
definition.

The separate time segments then should be analyzed for
variability separately using the present variability program.

The program also should, as options, perform the following:

\item{(a).}  Print the photon times
\item{(b).}  Plot the photon arrival times as a histogram (with 
binning to be specified as an input, or calculated to
yield a specified mean number of events per bin).
\item{(c).}  Print the histogram of (b).
\item{(d).}  Perform (b) and (c) modulo a period (or set of periods -
the inputs should define a ``DO Loop'').

The remainder of this memo includes suggested techniques for treating 
non-contiguous data intervals.


\**{Classification of gaps}

{\list

The following classes of gaps are useful:

 }

\vskip 12pt

\halign{\indent\qquad\qquad\qquad#&#\hfil\quad\quad&#\hfil \cr
&\underbar{Class}&\underbar{Definition} \cr
&& \cr
&S&Short; defined to be $< \tau$ where $\tau$ is the mean \cr
&&time between events.  Typical examples include \cr
&&telemetry drop outs, {\it etc}. \cr
&& \cr
&I&Intermediate; defined to be values between $\tau$ \cr
&&and typical observation times.  Examples include source \cr
&&occultations, South Atlantic Anomaly crossing, {\it etc}. \cr
&& \cr
&L&Long; values large compared with an observation time \cr }

\vskip 12 pt

\**{Estimates of mean rates}

{\list

Mean rates should be estimated using the total
observing time; periods of bad data should be neglected.

}

\**{Number vs. arrival time}


\?? Short gaps.  These should be ignored, except for their effects
upon the expected mean number of counts per interval.

\?? Intermediate and long gaps.  The case of few photons and many
photons must be considered separately.

\itemitem{$\bullet$}The few photon case is treated by concatenating the
intervals (essentially the time width of a gap is
subtracted from all photon arrival times after the gap).

\itemitem{$\bullet$}The many photons case is treated by binning the data.  
The new complication is the desire not to have a data
bin include a sizeable gap.  Hence, the data between 
any two gaps should be binned so as to closely approximate
the criteria given above in the description of CASE A
($N > 50$), evaluated for the total observation
set.  Observation periods such that fewer than 5 photons
would be expected should be ignored.

\?? The present $\chi^2$ calculation is based upon equal mean numbers
of events per bin; it will be necessary to generalize the
calculation to allow different bin widths.

\**{Photon Interval Distribution}

{\list

The data are to be treated by concatenating the intervals.

}

\vfill\eject
