On Thu, 30 Oct 2014, Sven Schreiber wrote:
> Take the HIP package first (the function HIP_estimate). Yes, this
is
> fallout from the new parser, but it's an example of what I mentioned a
> while back, namely the greater rigour of the new parser.
>
> The trouble is that the string substitution token @bar is used
> unconditionally with "end mle", but the string variable "bar" is
> defined only in the cases where the scalar s has value 1 or 2 (and
> these are not the only possible values). The old parser ignored the
> undigested would-be string substitution @bar (in case s equals neither
> 1 nor 2) while the new one properly rejects it.
Having said this, let me add that we now have a new command "setopt" for
avoiding kludges like these (that is, setting options to a command
condtional on something by using string substitution). The script below
should be backward compatible and give a clear example of the new setopt
command.
<hansl>
### below ripped from mle-advanced.inp
nulldata 10000
set optimizer bfgs
# generate artificial data
series x1 = normal()
series x2 = normal()
series x3 = normal()
list X = const x1 x2 x3
series ystar = x1 + x2 + x3 + normal()
series y = (ystar > 0)
matrix b = zeros(nelem(X),1) # initialize b at 0
scalar vrb = 1
if $version < 11000
if vrb == 1
string bar = "-v"
else
string bar = ""
endif
mle logl = y*ln(P) + (1-y)*ln(1-P)
series ndx = lincomb(X, b)
series P = cnorm(ndx)
params b
end mle @bar
else
if vrb == 1
setopt mle --verbose
endif
string bar = "-v"
mle logl = y*ln(P) + (1-y)*ln(1-P)
series ndx = lincomb(X, b)
series P = cnorm(ndx)
params b
end mle
endif
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------