[R] Fitting 4 moments distribution w/ Mixture Gaussian

From: Sam R <samuel.penagos_at_hotmail.com>
Date: Mon, 14 Mar 2011 10:16:48 -0700 (PDT)


Hello,

I know that Mclust does the fitting on its own but I am trying to implement an optimization with the aim to generate a the mixture gaussian with the combine moments as closed as possible to the moment of my return distribution.

The objective is to Min Abs((Mean Ret - MeanFit)/Mean Fit) + Abs((Std Ret
-Stdev Fit)/Stdev) + Abs((Sk Ret-Sk fit)/Sk Fit) + Abs((Kurt Ret- Kurt Fit))

Taking into account that I fix the weight between the two gaussians at (0.2;0.8) I implemented the below code in R:

distance <-function(parameter,x) {
 u=mean(x)
 s=sd(x)
 sk=skewness(x)
 kurt=kurtosis(x)
 d1=dnorm(x,parameter[1],parameter[2])
 d2=dnorm(x,parameter[3],parameter[4])
 dfit=0.2d1+0.8d2
 ufit=mean(dfit)
 sdfit=sd(dfit)
 skfit=skewness(fit)
 kurtfit=kurtosis(fit)

abs((u-ufit)/ufit)+abs(s-sdfit)/sdfit)+abs((sk-skfit)/skfit)+abs((kurt-kurtfit)/kurtfit)) }
Parameter<-c(0,0.01,0,0.01) ' starting point of the optimization opp<-optim(parameter,distance,x=conv)

1/ could anybody tell me whether it is the right approach ? 2/ should I add some constraint like
 ufit=0.2*mean(d1)+0.8*mean(d2)...

thank you very much in advance for your time and help.

Sam

--

View this message in context: http://r.789695.n4.nabble.com/Fitting-4-moments-distribution-w-Mixture-Gaussian-tp3354436p3354436.html Sent from the R help mailing list archive at Nabble.com.



R-help_at_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. Received on Mon 14 Mar 2011 - 18:42:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Mar 2011 - 19:00:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive