Should not adding fv in the syntax as shown below just do the trick for allowing factor variables so that using xi: would not be needed? Why does xi works with my ML program but fv does not? How can I pinpoint what the problem is? Any ideas?
Below is a simplified example:
Code:
mata:
mata clear
void mymlmata(transmorphic scalar ML, real rowvector b, real colvector lnfj)
{
depvar = moptimize_util_depvar(ML, 1)
xb = moptimize_util_xb(ML,b,1)
// a lot of estimation algorithms here
}
end
capture program drop mymlprog
program mymlprog, eclass
syntax varlist(fv)
gettoken lhs rhs : varlist
_fv_check_depvar `lhs'
ml model lf mymlmata() (`lhs' = `rhs')
ml max
end
tab year, gen(yr)
mymlprog depvar yr2-yr5 var2 // THIS WORKS
xi: mymlprog depvar i.year var2 // THIS WORKS TOO and generates the same results as above
mymlprog depvar i.year var2 //THIS DOES NOT WORK and issues the mentioned error
0 Response to xi works with ml program but fv does not
Post a Comment