[R] How to obtain parameters of a mixture model of two lognormal distributions
Charles C. Berry
cberry at tajo.ucsd.edu
Sat Sep 8 03:12:08 CEST 2007
On Fri, 7 Sep 2007, Jacques Wagnor wrote:
> Dear List,
>
> I have read that a lognormal mixture model having a pdf of the form
> f(x)=w1*f1(x)+(1-w1)*f2(x) fits most data sets quite well, where f1
> and f2 are lognormal distributions.
Whoa! There have to be a lot of qualifiers on an assertion like that!!
It will not fit these data well:
y <- rnorm(100)
>
> Any pointers on how to create a function that would produce the 5
> parameters of f(x) would be greatly appreciated.
Produce? Do you mean _estimate_ perchance?
The usual advice:
Read the posting guide and follow the advice there, which would
include trying stuff like the following...
?lognormal # fails but suggests help.search("lognormal")
help.search("lognormal") # bingo! It was 'Lognormal' I needed
?Lognormal # now read the help page and find dlnorm
RSiteSearch("fit mixture")
help.search("mle")
and so on.
And isn't a mixture of lognormals also a mixture of normals if you log
transform the data? ;-)
If so, you are almost done, thanks to the hits in RSiteSearch("fit mixture").
Chuck
p.s. if all you want is to 'fit data', try the logspline package or any of
the other density estimation tools in R or on CRAN.
>
>> version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 5.1
> year 2007
> month 06
> day 27
> svn rev 42083
> language R
> version.string R version 2.5.1 (2007-06-27)
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
More information about the R-help
mailing list