I am trying to estimate a linear model using the Dynare MH algorithm. In one of the equations, I have the variable for exchange rate (ER), which I want to impose as exogenous. However, this is actually an observed exogenous variable, so I cannot declare ER as varexo

Let me show you the part of code representing the trick. Say I want to estimate the parameter beta

- Code: Select all
`var y, ER;`

varexo v1, v2;

parameters beta;

model;

y = beta*ER + v1;

ER = v2;

end;

shocks;

var v1; stderr 1;

var v2; stderr 1;

end;

varobs y, ER;

ER and y are provided to dynare in a datafile. Here is the alternative, but quite similar part of code that should generate the same result as with the code above.

- Code: Select all
`var y, ER, ERobs;`

varexo v1, v2;

parameters beta;

model;

y = beta*ER + v1;

ER = v2;

ERobs = ER

end;

shocks;

var v1; stderr 1;

var v2; stderr 1;

end;

varobs y, ERobs;

However, these two codes do not return the same results. I have two questions.

1. Is any of these two codes answer to my question? If not, what should I change in the code?

2. Why do these two codes return different results?

I tried to be clear as much as I could, but am willing to provide any information that I might have missed. Thanks in advance.