Hi,

 

I have tried to use system, restrict and estimate within a function in order to perform restricted VAR, passing the series I want to estimate as parameters as follows:

 

function varappx(series p_d,series d_d, series r, scalar rho)

    "xxx" <- system

        equation p_d 0 p_d(-1) d_d(-1) r(-1)

        equation d_d 0 p_d(-1) d_d(-1) r(-1)

        equation r 0 p_d(-1) d_d(-1) r(-1)

    end system

 

    restrict "xxx"

        1 - rho*b[1,1] - b[2,1] + b[3,1] = 0

        -b[2,2] + b[3,2] - rho*b[1,2] = 0

        -b[2,3] + b[3,3] - rho*b[1,3] = 0

    end restrict

    estimate "xxx" method=fiml

 

end function

 

 

Gretl fails on the system command with "Syntax error in command line".

The same syntax outside the function works just fine.

 

What am I doing wrong?

 

With kind regards,

 

Ofer Cornfeld

TAU