Performs a spectral analysis of a multiple time series (G. Tunnicliffe Wilson & R.P. Littlejohn).

### Options

`PRINT` = string token |
Controls printed output (`description` ); default `desc` |
---|---|

`PLOT` = string tokens |
Variables for which to plot the analysis (`explanatory` , `response` ); default `expl` , `resp` |

`CORRECT` = string token |
Whether to mean or trend correct the series (`mean` , `linear` , `quadratic` , `none` ); default `mean` |

`BANDWIDTH` = scalar |
Bandwidth for smoothing, must be between 0 and 0.5; if unset, a default is calculated automatically |

`MAXLAG` = scalar |
Maximum lag for the time domain outputs; if unset, a default is calculated automatically |

`PROBABILITY` = scalar |
Probability value for confidence limits; default 0.95 |

`TAPER` = scalar |
The proportion of data to be tapered using a cosine bell window; default 0 |

`YLOG` = string token |
Whether to plot the univariate spectra with a log_{10}-transformed y-axis (`yes` , `no` ); default `no` |

### Parameters

`Y` = variates |
Response time series |
---|---|

`X` = variates or pointers |
Explanatory time series |

`ALIGN` = variate |
Shifts to apply to the explanatory series; default none |

`SPECTRUM` = pointers |
Saves autospectra, co-spectra and quad-spectra |

`FREQUENCY` = variate |
Saves the frequency values at which the spectra are calculated |

`VARSPECTRUM` = pointers |
Saves information about the variation of the spectrum: coefficient of variation, degrees of freedom, and lower and upper multiplicative limits for the univariate spectra |

`MULTICOHERENCYSQUARED` = pointers |
Saves estimates, significance limits, lower and upper confidence limits for the squared multiple coherency between the response and explanatory series |

`PARTIALCOHERENCYSQUARED` = pointers |
Saves estimates, significance limits, lower and upper confidence limits for the squared partial coherency of the response series with each explanatory series |

`GAIN` = pointers |
Saves estimates, lower and upper limits for the estimated gain of response series from each of the explanatory series |

`PHASE` = pointers |
Saves estimates, lower and upper limits for the estimated phase of response series from each of the explanatory series |

`NOISESPECTRUM` = variates |
Saves the estimated spectrum of the noise process |

`IMPULSERESPONSE` = pointers |
Saves the impulse response from -maxlag to +maxlag: estimates and significance limit |

`LAGS` = variates |
Saves the lags for the impulse response |

`ACFNOISE` = variates |
Saves the ACF of the noise process |

### Description

`MCROSSPECTRUM`

performs a spectral analysis of a multiple time series. The response series is specified by the `Y`

parameter. The explanatory series are specified by the `X`

parameter; the setting can be a single variate if there is only one explanatory series, or a pointer of variates if there are several. All the series should be the same length, *n* say, and this must be greater than 10. There must also be no missing values and no restrictions. The `ALIGN`

parameter can supply a variate, with a value for each explanatory variate, which specifies a shift *s* so that *X*(*t*–*s*) is more closely aligned with *Y*(*t*). These are used to improve the accuracy of the analysis but the results still relate to the original (unshifted) series.

The band-width of the smooth is specified by the `BANDWIDTH`

option. If this is unset, a default is calculated automatically. If `BANDWIDTH`

is less than 1/*n*, only the sample spectra are returned with no smoothing. The `MAXLAG`

option defines the maximum lag for the time domain outputs. If this is not set, a default is calculated automatically. Also, if the supplied value of `MAXLAG`

is too great in relation to the series length or the bandwidth used, then it is adjusted as necessary. The `TAPER`

option specifies the tapering proportion (default 0), and the `PROBABILITY`

option defines the size of confidence limits and acceptance region for coherencies (default 0.95).

The `CORRECT`

option has settings `mean`

, `linear`

, `quadratic`

and `none`

to control whether a mean, linear or quadratic trend correction is applied to all the series. The default is mean correction.

Printed output can be suppressed by setting the option `PRINT=*`

; by default, `PRINT=description`

, which summarizes the variables used and the option settings. The plots that are produced are controlled by the `PLOT`

option, with settings:

`explanatory` |
produces a graphics page for each explanatory variable containing the spectrum, its partial coherency squared with the response variable, phase, gain and impulse response function, and |
---|---|

`response` |
produces a graphics page with the response and noise spectra, the multiple coherency squared, and the autocorrelation function for the noise process. Where given, green lines denote null significance limits. |

By default, both pages are produced.

The `YLOG`

option specified the transformation to be made to the y-axes of the autospectra plots. By default, the plot is on the natural, untransformed scale. Alternatively, you can set `YLOG=yes`

, to plot on the scale of logarithm, base 10.

The `SPECTRUM`

parameter saves a pointer, with 2 suffixes, storing variates of spectra: “diagonals” (e.g. `[1][1]`

, `[2][2]`

etc.) store autospectra, “super-diagonals” (`[1][2]`

etc.) store co-spectra, and “sub-diagonals” (`[2][1]`

etc.) store quad-spectra. The frequency values at which the spectra are calculated can be saved, in a variate, by the `FREQUENCY`

parameter. The frequency range is from 0 to 0.5 cycles per sampling interval of the series. This range is divided into a round number of intervals with approximately 10 divisions covering one bandwidth.

The `VARSPECTRUM`

parameter saves a pointer with information about the variation of the spectrum. The first element of the pointer is a variate storing the coefficient of variation of the spectrum. Similarly the second element stores the corresponding degrees of freedom, and the third and fourth elements store lower and upper multiplicative limits for the univariate spectra.

The `MULTICOHERENCYSQUARED`

parameter saves a pointer containing the squared multiple coherency between the response and explanatory series. The first element of the pointer is a variate storing the estimates, the second element stores the significance limits, and the third and fourth elements store the lower and upper confidence limits.

The `PARTIALCOHERENCYSQUARED`

, `GAIN`

, `PHASE`

and `IMPULSERESPONSE`

parameters each save their results in variates within a pointer with two suffixes. The first suffix changes according to the type of result, while the second suffix has an element 1…*m* for each of the *m* explanatory variates. The `PARTIALCOHERENCYSQUARED`

parameter saves results for the squared partial coherency of response series with the explanatory series; its first suffix has elements 1-4 to store the estimates, the significance limits, and the lower and upper confidence limits. The `GAIN`

and `PHASE`

parameters save the estimated gain and phase of response series from each of the explanatory series; their first suffixes have elements 1…3, storing the estimates, the lower and the upper limits. The `IMPULSERESPONSE`

parameter saves the impulse response, from -maxlag to +maxlag; its first suffix has elements 1 and 2, storing the estimates and the significance limits.

The `NOISESPECTRUM`

and `ACFNOISE`

parameters store the estimated spectrum and ACF of the noise process, in a variate. Finally, the `LAGS`

parameter stores the lags for the impulse response, again in a variate.

Options: `PRINT`

, `PLOT`

, `CORRECT`

, `BANDWIDTH`

, `MAXLAG`

, `PROBABILITY`

, `TAPER`

, `YLOG`

.

Parameters: `Y`

, `X`

, `ALIGN`

, `SPECTRUM`

, `FREQUENCY`

, `VARSPECTRUM`

, `MULTICOHERENCYSQUARED`

, `PARTIALCOHERENCYSQUARED`

, `GAIN`

, `PHASE`

, `NOISESPECTRUM`

, `IMPULSERESPONSE`

, `LAGS`

, `ACFNOISE`

.

### Action with `RESTRICT`

There must not be any restrictions.

### See also

Directive: `FOURIER`

.

Procedures: `DFOURIER`

, `PERIODTEST`

, `PREWHITEN`

, `REPPERIODOGRAM`

, `SMOOTHSPECTRUM`

.

Commands for: Time series.

### Example

CAPTION 'MCROSSPECTRUM example',\ !t('Two input series annually from 1958 to 2009:',\ 'The response Temp is Global temperature anomaly.',\ 'The explanatory series are CO2, the Atmospheric CO2 in ppm,'\, 'and SOI, Southern Oscillation Index.'); STYLE=meta,plain FILEREAD [NAME='%gendir%/examples/MCRO-1.DAT'; PRINT=*] Temp,CO2,SOI " The series are plotted to reveal a strong quadratic trend in CO2." FRAME [GRID=xy,yx] 1; XLOWER=.05; XUPPER=.95; YLOWER=0.2; YUPPER=0.8 PEN 1,2,3,4; METHOD=line; LINE=1,1,2,1; SYMBOL=0,0,0,1;\ COLOUR='blue','red','green','blue' VARIATE [VALUES=1958...2009] year DGRAPH [KEY=0; TITLE='Global Temperature Anomaly'] Temp; year; PEN=1 DGRAPH [KEY=0; TITLE='Atmospheric CO2 concentration'] CO2; year; PEN=2 DGRAPH [KEY=0; TITLE='Southern Oscillation Index'] SOI; year; PEN=2 " The series are corrected for a quadratic trend, otherwise the default settings are used, including graphical output." MCROSSPECTRUM [CORRECT=quadratic] y=Temp; x=!p(CO2,SOI); ALIGN=!(1,0) " The bandwidth is doubled from the default value and an alignment lag also introduced. These improve appreciably the significance of the results. The graphical output is suppressed, but the partial coherency and impulse responses are saved and plotted separately." MCROSSPECTRUM [PLOT=*; BAND=0.14; CORRECT=quadratic]\ y=Temp; x=!p(CO2,SOI); ALIGN=!(1,0); FREQUENCY=Freq;\ PARTIALCOHERENCYSQUARED=PartCohSq;\ IMPULSERESPONSE=ImpResp; LAGS=Lag DGRAPH [KEY=0; TITLE='Partial coherency between Temp and CO2']\ PartCohSq[1,2,3,4][1]; Freq; PEN=1,2,3,3 CALCULATE IRFul,IRFll = ImpResp[2][1] * (1,-1) DGRAPH [KEY=0; TITLE='Lagged response from CO2 to TEMP']\ ImpResp[1][1],IRFul,IRFll; Lag; PEN=4,3,3 DGRAPH [KEY=0; TITLE='Partial coherency between Temp and SOI']\ PartCohSq[1,2,3,4][2]; Freq; PEN=1,2,3,3 CALCULATE IRFul,IRFll = ImpResp[2][2] * (1,-1) DGRAPH [KEY=0; TITLE='Lagged response from SOI to Temp']\ ImpResp[1][2],IRFul,IRFll; Lag; PEN=4,3,3 " The series are corrected for a quadratic trend and the bandwidth is set fairly wide because the series are short." MCROSSPECTRUM [BAND=0.15; CORRECT=quadratic] Y=Temp; X=!p(CO2,SOI)