When I run that code I get:

gretl version 2016e-git
Current session: 2016-12-08 18:52

? function void varsim (series Y, matrix ARbeta "Coeff. vector of Y", list X \
  "List of exogenous (-pmin to -p)", matrix Xbeta "coeff vector of Xs", list \
  D "deterministics", matrix
> function void varsim (series Y, matrix ARbeta "Coeff. vector of Y", list X "List of exogenous (-pmin to -p)", matrix Xbeta "coeff vector of Xs", list D "deterministics", matrix
parameter 6: name is missing

Error executing script: halting
> function void varsim (series Y, matrix ARbeta "Coeff. vector of Y", list X "List of exogenous (-pmin to -p)", matrix Xbeta "coeff vector of Xs", list D "deterministics", matrix

Or is that your point?

C

On 8 December 2016 at 11:05, Artur T. <artur.tarassow@googlemail.com> wrote:
Btw, here is an example for an ARDL(p,p) model:

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

function void varsim (series Y, matrix ARbeta "Coeff. vector of Y", list
X "List of exogenous (-pmin to -p)",
    matrix Xbeta "coeff vector of Xs", list D "deterministics", matrix
Dbeta "coeff. vector of D",
    series e "resampled", int p, series *ysim)

    list lX = D X
    matrix DLcoef = Dbeta | Xbeta
    series m = lincomb(lX, DLcoef)
    scalar T = rows({e})

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

    matrix U = {e + m} ~ zeros(T, p-1)
    matrix S = varsimul(A, U, y0)
    S = {Y}[1:p-1] | S[,1]
    series ysim = S
end function

series Y = LRY
series X = LRM
list lD = const time
scalar nD = nelem(lD)
scalar p = 4
scalar minp = 0
ols Y lD Y(-1 to -p) X(minp to -p)
scalar ay = (1+nD)
scalar ey = ay+p-1
matrix ARbeta = $coeff[ay:ey]
matrix Dbeta = $coeff[1:nD]
matrix Xbeta = $coeff[1+ey:]
series ysim = 0
list lX = X(0 to -p)
varsim(Y, ARbeta, lX, Xbeta, lD, Dbeta, e, p, &ysim)

gnuplot Y ysim --with-lines --time-series --output=display

</hansl>

Artur

>> 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
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users



--
Clive Nicholas

"My colleagues in the social sciences talk a great deal about methodology. I prefer to call it style." -- Freeman J. Dyson