2

I'm currently working on distribution fitting. I used fitdistr function, but having problem in determining the initial points for the MLE. For example, I want to fit my data (rainfall- 13149 by 1 matrix) with gamma distribution.

fit.gamma = fitdistr(rainfall,dgamma,start=list(shape = ?, scale = ?),method="Nelder-Mead")  
  • 1
    Maybe this might help: http://stackoverflow.com/questions/14266354/how-can-i-estimate-the-shape-and-scale-of-a-gamma-dist-with-a-particular-mean-a –  Jul 03 '15 at 05:27
  • thank you @Pascal for the suggestion – Miss Zahrah Jul 03 '15 at 06:21

1 Answers1

1

The library fitdistrplus is very good for this. It will guess gamma parameters for you if you don't have starting values. Also, you can use method of moments if your guesses fail.

x <- rgamma(100, 0.5, 0.5)

library(fitdistrplus)
(pars <- fitdist(x, "gamma"))
# Fitting of the distribution ' gamma ' by maximum likelihood 
# Parameters:
#        estimate Std. Error
# shape 0.4443304 0.05131369
# rate  0.5622472 0.10644511
Rorschach
  • 31,301
  • 5
  • 78
  • 129
  • Thank you Legalizelt.. I have found several packages for this purpose including fitdistrplus, but confused which is the best. Do you mean using methods of moments to find the starting values? – Miss Zahrah Jul 03 '15 at 06:29
  • @Legalizelt I have to do some research on the starting values and I don't know if there are some methods to find the optimal starting points that would give the best results of estiamtion. – Miss Zahrah Jul 03 '15 at 06:41
  • Okay, thanks a lot for the helpful responds @Legalizelt – Miss Zahrah Jul 03 '15 at 07:14