function s = statcheck(phi)
% STATCHECK(PHI) checks stationarity (invertibility) of AR (MA) operator
% INPUTS: phi = column vector of AR (or MA) coefficients
% RETURNS: s = 1 - min modulus of roots of AR equation.
[p m] = size(phi);
c = [ -phi(p:-1:1)' 1];
r = roots(c);
m = min(abs(r));
s = 1-m;
