Partial Autocorrelation parcorr bug?

4 vues (au cours des 30 derniers jours)
Duncan Carlsmith
Duncan Carlsmith le 12 Mar 2025
When running parcorr on a sample of normally distributed noise, I get some strange results like one illustrated below. Others are shown in the attached pdf and .mlx. When I try longer (>1000) samples, the code seems to hang. The code is
N=400;
for itest=1:3
figure
y=randn(1,N);
stem(y,'o', 'MarkerFaceColor', 'r')
figure
parcorr(y,'NumLags',N-1)
end

Réponse acceptée

Shantanu Dixit
Shantanu Dixit le 28 Mar 2025
Modifié(e) : Shantanu Dixit le 28 Mar 2025
Hi Duncan,
The issue you're observing might be due to the choice of 'NumLags = N-1'. The 'PACF' values at larger lags have very little data left that can be used to estimate them. Using too many lags can lead to unstable estimates due to increasing standard errors. You can also refer to a related query on the forum: https://www.mathworks.com/matlabcentral/answers/122337-wrong-function-partial-autocorrelation-pacf-parcorr-greater-than-1-1.
I am able to run 'parcorr' on >1000 samples as well, although due to more samples, the execution takes some time.
Using n = 25 as number of lags in the above script
N=400;
lags = 25
lags = 25
for itest=1:3
figure
y=randn(1,N);
stem(y,'o', 'MarkerFaceColor', 'r')
figure
parcorr(y,'NumLags',lags)
end
Hope this helps!
  1 commentaire
Duncan Carlsmith
Duncan Carlsmith le 28 Mar 2025
Thank you, Shantanu!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits


Version

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by