The complete program folder. You may find some things not listed below and can also check dates to see if you have the latest.

Programs that produce figures in periodogram notes These just produce the figures.

plotfpdf.m MATLAB script to plot the probability density and cdf for the F(m,n).

tpvwin.m MATLAB function to compute and plot P-values for an outlier test based on a running window estimate of mean and standard deviation. The total window is of length 2*win+1. The local mean and standard deviation are estimated from the first and last win points and the test is to see if the middle point is consistent with the estimated values. The P-value is determined by the MATLAB tcdf function.

runtpvwin.m MATLAB script to load the weekly DJ data (data11) and run tpvwin on data11 and log10(data11).

pickpoly.m MATLAB function for selecting zero and pole locations using cursor.

doarmasim.m MATLAB script to pick zero and pole locations, plot impulse response, plot some samples from a simulated ARMA series, plot the frequency response function. Output data left in a vector called "out".

sigratio.m MATLAB function to compute and plot F P-values for the moving two-window variance contrast test assigned as HW #2.

runsigratio.m MATLAB script that calls dodata11.m to load the DJ weekly series, calls tpvwin.m to plot the series and moving estimates of mean and sigma and in addition the P-value of the t-test for outliers. Then sigratio.m computes and plots the P-values of the variance contrast statistic.

tout.m MATLAB function to create a logical vector of the same length as the input data vector and in which 1 indicates the data value is an outlier. This program is derived from tpvwin.m but has also requires the Pr[type 1 error] to be specified from which the rejection threshold for a two sided test is determined. It is used in sigratio.m.

pacf.m MATLAB function to compute and optionally plot a partial autocorrelation using Eq. (3.4.2) from BD. It is the method of solving for \phi_{kk}, the last regression coefficient.

doarima.m MATLAB script to do an ARIMA(p,d,q) analysis where d is set but P and q can be vectors of values you want to try. It produces AIC and FPE (final prediction error) values for comparing models. The AIC is different than the one computed by S+, but they both minimize on the same model for the arma22.dat simulated data.

arimabat.ssc S-Plus script to load data and call arima.mle 6 times in succession for fixed values of (p,d,q) but d=0. It produces AIC, residual variance and loglik values for each model. The AIC is different than the one computed by MATLAB.

domultsim.m MATLAB script to simulate multiplicative ARMA(p,q)X(P,Q)_T model. Uses same pole-zero placement method as doarmasim.m, except you go through the placement procedure twice, first for the inter-season dynamics, and then for the intra-season (period) dynamics. Output data left in a vector called "out".

seasint.m MATLAB function to seasonally integrate a vector (time series). This is the inverse of seasonal differencing. For example, if the period is one year, the output for successive Januaries is the integral (cumsum) of the original January data. And the other months are done similarly.

sdtrend.m MATLAB function to seasonally detrend using separate polynomials for each season's data.

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