In: Computer Science
how to create a function to compute PACF of a time series in MATLAB without using built-in function ''parcorr''?
Specify the AR(2) model:
yt=0.6yt−1−0.5yt−2+εt,
where εt is Gaussian with mean 0 and variance 1.
-------------------------------------------------------------------------------------------
rng(1); % For reproducibility
Mdl = arima('AR',{0.6 -0.5},'Constant',0,'Variance',1)
------------------------------------------------------------------------------------------
Mdl = 
  arima with properties:
     Description: "ARIMA(2,0,0) Model (Gaussian Distribution)"
    Distribution: Name = "Gaussian"
               P: 2
               D: 0
               Q: 0
        Constant: 0
              AR: {0.6 -0.5} at lags [1 2]
             SAR: {}
              MA: {}
             SMA: {}
     Seasonality: 0
            Beta: [1×0]
        Variance: 1
Simulate 1000 observations from Mdl.
----------------------------------------------------------------------
y = simulate(Mdl,1000);
---------------------------------------------------------------------
Compute the PACF.
[partialACF,lags,bounds] = parcorr(y,'NumAR',2); bounds