I am using libgretl in a C program and wish to perform an IV
regression via GMM. Here is the relevant code:
DATASET *data_set = create_new_dataset(nvar, nobs, 0);
for (i=0; i<nvar; i++) {
for (j=0; j<nobs; j++) {
dset_set_data(data_set, i, j, x[i*nobs+j]);
}
}
... create list using -100 as a separator ...
MODEL model_results = ivreg(list, data_set, OPT_G);
When I first tried it, I got this error:
realgen: exiting on expr() error 19
genr_compile: genrs[0] = 0x0, err = 19
formula: 'gmm___e = const-(b0+b1*+b2*+b3*+b4*+b5*+b6*+b7*+b8*+b9*)'
nls_genr_setup failed
Apparently variables without names were a big no-no, so I named the
variables in my data set by writing to data_set->varnames. Now I get
this error:
realgen: exiting on lex() error 15
genr_compile: genrs[0] = 0x0, err = 15
formula: 'gmm___e =
var0-(b0+b1*var5+b2*var6+b3*var7+b4*var8+b5*var9+b6*var10+b7*var11+b8*var12+b9*var13)'
The symbol 'var0' is undefined
nls_genr_setup failed
What am I doing wrong? I am using libgretl 1.9.8 on a Mac.
Thanks
Evan