【问题标题】:Storing p values using Econometrics toolbox in matlab在matlab中使用计量经济学工具箱存储p值
【发布时间】:2019-01-08 12:30:25
【问题描述】:

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

    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 个 p 值的向量)?

【问题讨论】:

    标签: matlab for-loop


    【解决方案1】:

    使用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
    

    【讨论】:

    • 谢谢,帮了大忙,但是有没有办法只为每个 for 循环的 AR{1} 系数获取 P 值
    • @Tony PValuesAR1(ii) = Results.Table.PValue(2) 因为AR{1} 是这里的第二行。记得预分配PValuesAR1
    猜你喜欢
    • 1970-01-01
    • 2012-09-28
    • 1970-01-01
    • 2021-04-02
    • 2011-07-08
    • 1970-01-01
    • 2011-02-12
    • 2013-01-13
    • 2015-06-03
    相关资源
    最近更新 更多