function plotpacf(y,nr)

% Plots PACF function with confidence levels.
% Usage: plotpacf(y,nr)
%

[par,parsig]=pacf(y,nr);
t=(1:length(par))';
hold off
plot(t,2*parsig,'r',t,-2*parsig,'r')
hold on
Up=find(par>0);
Lo=find(par<=0);
errorbar(t(Up),zeros(length(Up),1),zeros(length(Up),1),par(Up));
errorbar(t(Lo),zeros(length(Lo),1),par(Lo),zeros(length(Lo),1));
hold off
