Hi,
I am currently working on fitting a mixture density to financial data.

I have the following data:
http://s000.tinyupload.com/?file_id=00083355432555420222

I want to fit a mixture density of two normal distributions.

I have the formula:
f(l)=πϕ(l;μ1,σ21)+(1−π)ϕ(l;μ2,σ22)

my R code is:

normalmix<-normalmixEM(dat,k=2,fast=TRUE)

pi<-normalmix$lambda[1]
    mu1<-normalmix$mu[1]
mu2<-normalmix$mu[2]
    sigma1<-normalmix$sigma[1]
sigma2<-normalmix$sigma[2]

Now I have the problem, that the output is not consistent, i.e. every time
I run the code, I get different outputs! And they are very different, no
small differences, which could be due to the precision of the numerical
procedures.

E.g. sometimes for pi I get

[1] 0.2653939

or

[1] 0.3318069

I already recognized, that sometimes the numbering is changed, so the pi of
0.7 would be equal to a pi of 0.3. Okay, I got this, I don't know why the R
procedures does this, but this would not be a problem. But the problem is,
that the outputs are way to different, sometimes I even get an error
message (german): Fehler in while (dl > eps && iter < maxit) { : Fehlender
Wert, wo TRUE/FALSE nötig ist

Also, the number of iterations is very different, from 29 up to 1000 ......

Anyone can help? Thanks a lot!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to