[R] fitdistr question

Antje Niederlein niederlein-rstat at yahoo.de
Fri Feb 11 10:38:34 CET 2011


Yes, I understand.
If I have a distribution which is not listed in fitdistr() but I still
would like to you compute the ML estimate.
Would it be correct to maximize the following function?

sum( log( dens_mydistr(x, my_distr_param)))

As I said, I try to step into this field by reading and trying things
and I'm not sure whether I got it right how to find the ML-function of
a more complex distribution...

Antje



On 11 February 2011 10:14, Ingmar Visser <i.visser at uva.nl> wrote:
> Antje,
>
> On Fri, Feb 11, 2011 at 9:58 AM, Antje Niederlein
> <niederlein-rstat at yahoo.de> wrote:
>>
>> Hi Ingmar, hi Dennis,
>>
>> okay, you're right. I was expecting that the result would give the
>> best fit to my data even if it's not a real poisson distribution. It
>> looks somehow similar...
>
> The ML estimate is of course made under the assumption that the data stems
> from a Poisson distribution, and under that assumption, the ML estimate is
> most efficient and unbiased compared with other estimates.
>
> Best, Ingmar
>
>>
>> But how to judge the goodness of fit? I was using the residual sum of
>> squares. I'm not a statistician, so I'm not sure whether this method
>> is the one to choose...
>> If I estimate lambda with mle2() and use the RSS as criteria to
>> minimize, my lambda is much smaller that with fitdistr().
>>
>> I'm happy about any suggestion!
>>
>> Antje
>>
>>
>>
>> On 11 February 2011 09:16, Ingmar Visser <i.visser at uva.nl> wrote:
>> > The ML estimate of lambda is the mean, so no need for (iterative)
>> > optimization. See eg:
>> > http://mathworld.wolfram.com/MaximumLikelihood.html
>> > hth, Ingmar
>> >
>> > On Fri, Feb 11, 2011 at 8:52 AM, Antje Niederlein
>> > <niederlein-rstat at yahoo.de> wrote:
>> >>
>> >> Hello,
>> >>
>> >> I tried to fit a poisson distribution but looking at the function
>> >> fitdistr() it does not optimize lambda but simply estimates the mean
>> >> of the data and returns it as lambda. I'm a bit confused because I was
>> >> expecting an optimization of this parameter to gain a good fit...
>> >> If I would use mle() of stats4 package or mle2() of bbmle package, I
>> >> would have to write the function by myself which should be optimized.
>> >> But what shall I return?
>> >>
>> >> -sum((y_observed - y_fitted)^2)
>> >>
>> >> ?
>> >>
>> >> Any other suggestions or comments on my solution?
>> >>
>> >> Antje
>> >>
>> >> ______________________________________________
>> >> 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.
>> >
>> >
>
>



More information about the R-help mailing list