在MATLAB中使用Econometrics工具箱存储p值

时间:2019-01-08 12:30:26

标签: matlab for-loop

此代码将与计量经济学工具箱一起运行

    model = arima('Constant',0.5,'AR',{0.9999},'Variance',.4);
rng('default')
Y = simulate(model,50);
figure
plot(Y)
xlim([0,50])
title('Simulated AR(1) Process')

rng('default')
Y = simulate(model,50,'NumPaths',1000);
Y1=Y(:,1);

for ii = 1:50
Mdl = arima(1,0,0);
EstMdl = estimate(Mdl, [Y(:,ii)]);
end

如何为每次迭代存储EstMdl中的p值(即具有5个pvalue的向量)?

1 个答案:

答案 0 :(得分:3)

使用summarize(需要R2018a以上)来获得estimate的结果。

在此处显示一次迭代的结果:

>> ii=1;
>> Mdl = arima(1,0,0);
>> EstMdl = estimate(Mdl, [Y(:,ii)]);

    ARIMA(1,0,0) Model (Gaussian Distribution):

                 Value     StandardError    TStatistic      PValue  
                _______    _____________    __________    __________

    Constant     622.14        427.99         1.4536         0.14605
    AR{1}       0.87561      0.085586         10.231      1.4432e-24
    Variance    0.37122      0.079507          4.669      3.0263e-06

>> Results = summarize(EstMdl);
>> PValues = Results.Table.PValue

PValues =

    0.1460
    0.0000
    0.0000