non parametric spectral analysis of time series
[rspec]=spectral(arg1,...,argn)
* arg1,...,argn = arguments which can be:
- a string equal to the name of a time series or a (n x k) real vector or matrix between quotes
- a real (n x 1) vector
- a real (n x k) matrix
- a list of such elemnts
- the string 'noprint' if the user doesn't want to display the results of the regression
- optional arguments that can be the following:
. 'trunc=xx' : lag window size (the default value is k=round(sqrt(T)))
. 'weight=xx' : (N x 1) vector of weights (equal weights by default) for cohesion
.'spec=1' : plot spectrum
.'dcorr=1' : plot dynamic correlation
.'phase=1' : plot phase spectrum
.'coher=1' : plot coherency
.'cohes=1' : plot cohesion
.'boot =1' : performs block-bootstrap estimation of confindence band
.B=xx' : number of draws for bootstrap replication (default is 200)
.'sb=xx' : size of blocks for block-bootstrap (default is 8)
* rspec = a results tlist with
- rspec('cospe') = matrix of cospectra
- rspec('cohes') = matrix of cohesion (if more than one TS)
- rspec('coher') = matrix of coherence (if more than one TS)
- rspec('dcorr') = matrix of dynamic correlations (if more than one TS)
- rspec('phase') = matrix of standardized phase spectrum (if more than one TS)
- rspec('order') = order of arrival of variable in cross-products
- rspec('ucohes') = matrix of upper bound for cohesion (compute by block-bootstrap)
- rspec('lcohes') = matrix of lower bound for cohesion (compute by block-bootstrap)
- rspec('ucoher') = matrix of upper bound for coherency (compute by block-bootstrap)
- rspec('lcoher') = matrix of lower bound for coherency (compute by block-bootstrap)
- rspec('ucospe') = matrix of upper bound for cospectra (compute by block-bootstrap)
- rspec('lcospe') = matrix of upper bound for cospectra (compute by block-bootstrap)
- rspec('udcorr') = matrix of upper bound for dynamic correlations (compute by block-bootstrap)
- rspec('ldcorr') = matrix of lower bound for dynamic correlations (compute by block-bootstrap)
- rspec('uphase') = matrix of upper bound for phase spectrum (compute by block-bootstrap)
- rspec('lphase') = matrix of lower bound for phase spectrum (compute by block-bootstrap)
// get the name of variable avaible in the database lvar =dblist(GROCERDIR+'\data\specgdp.dat'); // transforms by log and first difference for i = 1:size(lvar,1) execstr('dl'+lvar(i)+' = delts(log('+lvar(i)+'))') end // estimates and prints spectral density of each gdp with a truncation window of 6 rspec = spectral('dlger','dlfr','dlit','dlsp','trunc=6','spec=1','cospe=1'); // Example taken from spectral_d(): performs spectral analysis of QoQ growth rate of French (fr), German (ger), Italian (it) and Spanish (spa) PPP GDP. | ![]() | ![]() |