On Tue, 21 Feb 2012, Dan Běsoň wrote:
I am trying to write a script for MLE estimation of a CARR model,
similar to GARCH. It is a MEM model in daily ranges of some instrument, i,e,
Eq. 1: lRng = lambda * epsilon # epsilon is exponentially distributed here, giving the
shape of LL
Eq. 2: lambda = a + b*Rng(-1) + c*lambda(-1)
I tried the following code but the algorithm never
converges. What should I improve?
scalar a = 0.1
scalar b = 0.4
scalar c = 0.4
mle ll = -ln(lambda) + Rng/lambda
Improve here: use the correct loglikelihood!
mle ll = -ln(lambda) - Rng/lambda
series lambda = mean(Rng)
series lambda = a + b*Rng(-1) + c*lambda(-1)
params a b c
end mle
You may also have to constrain all the parameter values to be
positive, if I'm reading the CARR literature correctly. In
which case you could, for example, express lambda as
exp(a) + exp(b)*Rng(-1) + exp(c)*lambda(-1).
Allin Cottrell