Download the complete program folder.
Figure-script dependency table. You can see which basic programs are needed to support the figure scripts.
Scripts that produce the figures in the book. These scripts assume you have the main scripts above, and only produce the figures.
permean1.m MATLAB function to estimate and remove seasonal (periodic) mean. Has options to plot estimated periodic mean with confidence intervals based on the t. Computes and plots seasonal variance with confidence intervals based on chi-squared. Data can be returned with seasonal mean removed and with seasonal variance scaled out.
peryule.m MATLAB function to solve for PAR(p) coefficients using periodic yule walker equations. It is assumed that the periodic mean has been removed. There is a flag to scale by the seasonal variance before estimation. This scaling can also be done in permean1.m .
par1cov.m MATLAB function to compute a PAR(1) correlation (or covariance since the mean is zero) from one period of the parameters phi_1(t) and del(t) where phi_1(t) are the autoregressive parameters and the del(t) are weights on the shocks. The correlations are returned in a rectangular array corresponding to the (s,t) pairs s=1:T and t=1:(numper*T).
parbatch.m MATLAB script that makes a batch of PAR(1) simulations. The parameters are set at the top. You can edit what is there to do your own investigation. It plots phi_1(t) and del(t) but my current examples have del(t) constant. It plots a sample from the simulated series and the estimated seasonal std (permean1.m is used). It uses sqplot.m to plot sample spectra of the series and of the squares of the series, the reason for which we will discuss in class.
sqplot.m MATLAB function to compute sample spectra (periodogram) of a time series and sample spectra of the squares of the series. This is one way that, in some situations, can detect the presence of PC structure.
textsc.m MATLAB function (a small utility) to put text on a plot where the placement is based on fractions of the xrange and yrange of the plot. It is used in sqplot.m.
twoparbatch.m MATLAB script that makes a batch of PAR(1) simulations where phi_1(t) is made up from switching between two AR(1) models. It uses twopar.m (below), permean1.m, sqplot.m and par1cov.m.
twopar.m MATLAB function to compute PAR(1) parameters phi_1(t) and del(t) by switching between two AR(1) models.
sdiff.m MATLAB function to compute seasonal differences (very simple).
acf.m MATLAB function to compute the usual acf (based on the stationary assumption).
acfpacf.m MATLAB function to compute the acf and the pacf, return them and also plot them if you set the plot flag.
armabat.m MATLAB function to compute ARMA models for p in pvec and q in qvec. The best model is returned.
sarmabat.m MATLAB function to compute SARMA or multiplicative models for p in pvec and q in qvec P in Pvec and Q in Qvec. The best model is returned.
do1.m MATLAB script to do seasonal de-trending and analysis by method 1.
do2.m MATLAB script to do seasonal de-trending and analysis by method 2.
do3.m MATLAB script to do seasonal de-trending and analysis by method 3.
do4.m MATLAB script to do seasonal de-trending and analysis by method 4.
r2pv.m MATLAB function that returns the p-value of a sample correlation coefficient based on the hypothesis (H_0) that r=0. Uses a transformation (see Cramer, p400) that transforms to a t, and then tcdf is used.
rinv.m MATLAB function r_0=rinv(p,n) computes the value of r_0 giving P(|r| <= r_0)=p for the case when the true correlation is zero. Based on the transformation to t and tinv.
Return to Harry Hurd's page