hi again,

I am working on a script for a gmm estimation.

some of my variables are used in lags in some of the equations of the model I am trying to estimate.
When I try running the script I receive an error saying that missing values were encountered. I have checked (using ok) that the input series have no missing values in them.

I therefore suspect this might be happening when trying to use the lag for the first observation in the series.
Could this be the reason or does gretl 'know' how to handle this (skip the first observation maybe?)? If it could be the cause, any suggestions on handling it would be much appreciated. Finaly, if it is not the cause, any tips and where to look next would be nice.

thank you very much,
Raz Lev

(I am attaching the script in case it can help)

scalar gama = 0.4
scalar beta=0.99
scalar tau=0.025
scalar alpha=0.24
scalar gy=0.18
scalar lambdaw=1.5
rk_h=R
scalar ky=2.2

# initializations go here
series e1=0
series e2=0
series e3=0
series e4=0
series e5=0
series e6=0
series e8=0
series e9=0

# create the parameters and set their initial values

scalar gamaw=1
scalar h=1
scalar xip=1
scalar xiw=1
scalar sigmac=1.2
scalar phi=1.2
scalar rk_b=1.2
scalar gamap=1.2
scalar r_p=1
scalar r_y=1
scalar rdp=1
scalar rho=1
scalar sigmal=1

# create the list of the IVs
list IVs = const  Y(+1)
# turn the list into a matrix  
matrix Z = {IVs}
# create the initial weight matrix. Its dimension should be the number of IVs
matrix V = I(16) 
# create the errors

gmm

e1=(C*(1+h)-h*C(-1) - C(+1)-(sigmac-1)*(l-l(+1))/(sigmac*(1+lambdaw)) + (1-h)*(R-pie(+1))/(sigmac))*sigmac/(1-h)
   
e2 = (i*(1+beta)-i(-1)-beta*i(+1))*phi + Q

e3 = Q + R - pie(+1) - (1-tau)*Q(+1)/(1-tau+rk_b) - rk_b*R(+1)/(1-tau+ rk_b)

e4 = (Q - (1-tau)* Q(-1) - tau*i(-1))/tau

e5 = (1+beta*gamap)*(pie-inf_t) - beta*(pie(+1)-inf_t)- gamap*(inf_t(-1)- pie)-(1-beta*xip)*(alpha*rk_h-(1-alpha)*w + (1-alpha)*gama*t)/xip

e6 = w*(1+beta)-beta*w(+1) - w(-1) - beta*(pie(+1)-inf_t)+(1+beta*gamaw)* (pie(-1)-inf_t) + gamaw*(pie(-1) - inf_t) + (1-beta*xiw)*(1-xiw)* (w-sigmal*l*(C-h*C(-1)))/(1+(1+lambdaw)*sigmal/gamaw)

e8 = Y - (1-tau*ky-gy)*C - tau*ky*i - gy*gama*t

e9 = R - inf_t(-1) - rho*(R(-1)-inf_t(-1)) - (1-rho)*(r_p*(pie(-1)-inf_t(-1))-r_y) - rdp*(pie - inf_t(-1))

# declare who's orthogonal to whom 
orthog e1 ; Z
orthog e2 ; Z
orthog e3 ; Z
orthog e4 ; Z
orthog e5 ; Z
orthog e6 ; Z
orthog e8 ; Z
orthog e9 ; Z 
# declare what are the weights 
 weights V
# declare the parameters to be optimized
  params gamaw h xip xiw sigmac phi rk_b gamap r_p r_y rdp rho sigmal
 
# that is all!
end gmm