function [sig,test,stud]=par_sig(th,alpha);
% 
% Computes the statistical significance of parametres within the IDPOLY model
% Suitable only for ARMAX processes
% 
% syntax: [sig,test,stud]=par_sig(th,alpha)
% where
% 
% INPUTS:
% th      : IDPOLY model to be tested
% alpha   : level of significance
%         : (optional input - implicitly 0.05)
%         
% OUTPUTS:
% sig     : binary vector of parameter significance
%         : 1 = parameter significant, 0 = not significant
% test    : vector of empirical t-test values for each parameter        
% stud    : percentile of Student's t-distribution for testing stat. sig.
%
% Created: May 2005, Jan Capek
% Modified: April 2006, Jan Capek

if nargin < 1
    error('At least one input needed')
end

if nargin < 2
    alpha=0.05;
    disp('Setting alpha = 0.05')
end


test=abs(th.ParameterVector)./sqrt(diag(th.CovarianceMatrix));
stud=tinv(1-alpha/2,th.EstimationInfo.DataLength-length(th.ParameterVector));
sig= test>stud;