Re: [R] fitdistr, mle's and gamma distribution

2003-10-08 Thread Lourens Olivier Walters
Thanks, your advice worked. I don't have much experience with maths, and therefore tried to stay away from dealing with optimization, but going down to this level opens a lot of possibilities. For the record, the code I used, as you suggested: ### shape - mean(data)^2/var(data) scale

Re: [R] fitdistr, mle's and gamma distribution

2003-10-08 Thread Spencer Graves
I'm sorry, but I don't have time to read all your code. However, I saw that you tested for x alpha in your Pareto distribution example. Have you considered reparameterizing to estimate log.del = log(alpha-min(x))? Pass log.del as part of the vector of parameters to estimate, then

Re: [R] fitdistr, mle's and gamma distribution

2003-10-08 Thread Lourens Olivier Walters
Thanks for the help, the wrapper function was very useful. I managed to solve the problem using Spencer Graves' suggestion. I am analyzing the interarrival times between HTTP packets on a campus network. The dataset actually has more than 14 Million entries! It represents the traffic generated by

Re: [R] fitdistr, mle's and gamma distribution

2003-10-08 Thread Spencer Graves
Are you interested in turning that into a monitor, processing each day's data sequentially or even each entry as it arrived? If yes, you may wish to evaluate the Foundations of Monitoring documents downloadable from www.prodsyse.com. If you have any questions about that, I might be able

[R] fitdistr, mle's and gamma distribution

2003-09-30 Thread Lourens Olivier Walters
Dear R Users, I am trying to obtain a best-fit analytic distribution for a dataset with 11535459 entries. The data range in value from 1 to 3. I use: fitdistr(data, gamma) to obtain mle's for the parameters. I get the following error: Error in optim(start, mylogfn, x = x, hessian =

Re: [R] fitdistr, mle's and gamma distribution

2003-09-30 Thread Spencer Graves
In my experience, the most likely cause of this problem is that optim may try to test nonpositive values for shape or scale. I avoid this situation by programming the log(likelihood) in terms of log(shape) and log(scale) as follows: gammaLoglik - + function(x, logShape, logScale,

Re: [R] fitdistr, mle's and gamma distribution

2003-09-30 Thread Ben Bolker
Spencer Graves's suggestion of using shape and scale parameters on a log scale is a good one. To do specifically what you want (check values for which the objective function is called and see what happens) you can do the following (untested!), which makes a local copy of dgamma that you

Re: [R] fitdistr, mle's and gamma distribution

2003-09-30 Thread Ben Bolker
PS. 11 MILLION entries?? On Tue, 30 Sep 2003, Ben Bolker wrote: Spencer Graves's suggestion of using shape and scale parameters on a log scale is a good one. To do specifically what you want (check values for which the objective function is called and see what happens) you can