*
* @CROSSPEC( options ) series1 series2 start end
*
* Computes and optionally graphs the estimated coherence and
* phase of a pair or series. series1 is treated as the "output"
* for the purposes of interpreting the phase, and series2 as
* the "input", so a positive value means 2 is that fraction of
* a cycle ahead of 1.
*
* Options:
* ORDINATES=Number of ordinates [depends upon length,seasonal]
* WINDOW=[FLAT]/TENT
* WIDTH=Window width [depends upon ordinates]
* [GRAPH]/NOGRAPH
* HEADER=Header for high-resolution graph
*
* Revision schedule
* 04/95 Replaced SPGRAPH(TWOSCALE) with GRAPH(OVERLAY=LINE,...)
* 04/95 COMPUTE HALF added
* 10/99 Update to version 5.0 replacing GRAPH with SCATTER.
* 05/05 Add calculation of the gain (from series2 to series1)
*
procedure crosspec series1 series2 start end
type series series1 series2
type integer start end
local integer i nobs startl endl freqords half
local series coherence phase harmonic frequencies
local real scalefac
option int width
option int ordinate
option choice window 1 flat tent
option switch graph 1
option string header
if .not.%defined(series1).or..not.%defined(series2) {
display 'syntax: @crosspec series1 series2 start end'
return
}
*
* Set the range to the maximum allowed by the series pair
* if start and end aren't provided.
*
inquire(reglist) startl<