On Fri, 2 Dec 2016, Artur T. wrote:

> Dear all,
>
> I experimenting a bit with simulating dynamic ARDL models. I've got
> three questions:

[...]

filter() only takes a scalar for pre-sample values. If you want to 
simulate an AR(p) with p>1 and p initial values fixed, I guess your best 
bet is to re-cast the model as a VAR(1) in companion form and then use 
varsimul(), as in

<hansl>
clear
set echo off
set messages off
open denmark.gdt -q
set seed 1234

series Y = LRY
list lD = const # time
scalar nD = nelem(lD)
scalar p = 4
ols Y lD Y(-1 to -p)
matrix ARbeta = $coeff[(1+nD):]
matrix mu = $coeff[1:nD]
series m = lincomb(lD, mu)

matrix A = ARbeta' | (I(p-1) ~ 0)
matrix y0 = mreverse({Y}[1:p])'

matrix U = {resample($uhat) + m} ~ zeros($T, p-1)
matrix S = varsimul(A, U, y0)
series ysim = S[,1]

gnuplot Y ysim --with-lines --time-series --output=display
</hansl>

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti(a)univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------

Reply via email to