An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090114/c22917ef/attachment-0001.pl>
fitting data
2 messages · Serebrenik, A., Ben Bolker
Serebrenik, A. <a.serebrenik <at> tue.nl> writes:
Dear all,
I have a set of data which seem to be distributed almost exponentially but
only on [0;1]. I guess that the probability distribution in this case
would look like
\frac{lambda}{1-e^{-\lambda}) e^{-\lambda x}
I would like to use fitdistr to estimate the value of \lambda.
1) Would it be correct first to find lambda for the
exponential distribution and then to substitute it in the
formula above?
That might be a decent starting value.
2) I guess that it should somehow be possible to convince fitdistr to use the function above, but I have no clue how.
The help for fitdistr says that "densfun" may be ...
" a function returning a density evaluated at its first argument".
In case that's opaque to you, that means something like
dmyfun <- function(x,lambda) {
(1-exp(-lambda))/lambda*exp(-lambda*x)
}
fitdistr(mydata,dmyfun,start)
[note: totally untested ...]
Ben Bolker