[R-SIG-Finance] implement quasi-bayesian maximum likelihood estimation for normal mixtures

Helena Richter helenar at gmx.de
Sat Feb 28 12:41:32 CET 2009


as you can see in the topic, I am trying to fit a normal mixture 
distribution with the approach suggested by Hamilton (1991). Since I 
couldn't find any existing packages including the quasi-bayesian mle, I 
have to write my own function. Unfortunately, I have absolutely no 
experience in doing this.

If you're not familiar with the QB-MLE, I attached the formula as pdf. 
The idea is to extend the usual MLE with prior beliefs about the values 
sigma_n and sigma_b. My priors are already included in the code below. I 
intend to try a mixture of two normal distributions with same mean, and 
variances 1 and 5 as starting values.
This is what I've done so far:

 > R <-read.table("C:\\...\\rendite.txt", header=F)
 > qbmle  <- function(p, data){
    mu <- mean(data);   
- 2.772/p[2]^2 - 13.86/p[3]^2 )}
 > start <-c(0.9, 1, 5)
 > out <- nlm(qbmle, start, data=R)

The result is: error in nlm(...): non-finite value for nlm, plus a lot 
of warnings, and the following output:

 > out
[1] -27513.60

[1]  3.478212e+04 -2.146767e+03 -3.806269e-02

[1] -5.971628e-02  1.939856e-03 -2.946156e+02

[1] 5

[1] 49

So, what did I do wrong? How can I implement any non-negative 
constraints, and a restriction for p to be between 0 and 1?
I'm sorry to bother you with such a beginners question and am very 
helpful for any remarks. I don't have to use the qb-mle so if you think 
there's a better way to do the estimation tell me.

Thanks a lot,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: formula.pdf
Type: application/pdf
Size: 33969 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090228/fb5785e9/attachment.pdf>

More information about the R-SIG-Finance mailing list