[R] Fitting gamma distribution
Rolf Turner
r.turner at auckland.ac.nz
Tue Feb 17 06:39:12 CET 2015
On 17/02/15 12:59, smart hendsome wrote:
> I'm very new to r-programming. I have rainfall data. I have tried to fit gamma into my data but there is error. Anyone can help me please.
> My rainfall data as I uploaded. When I try run the coding:
> library(MASS)
>
> KLT1<-read.csv('C:/Users/User/Dropbox/PhD Materials/Coding_PhD_Thesis/Kelantan_Average/K1.csv')
>
> KLT<-KLT1$Amount
> fd_g <- fitdistr(KLT, "gamma")
> Error in stats::optim(x = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :
> initial value in 'vmmin' is not finite
> Anyone can help me? Thanks.
No. No one can help. Not unless you provided a self-contained
reproducible example as the posting guide requests.
cheers,
Rolf Turner
P. S. I am not sure, but the error may be indicating that your data
begin with a long string of zeros. (In which case fitting a gamma
distribution is simply idiotic.) Rainfall data often contain many
zeroes. (There are, contrary to popular belief, many dry days.)
What you *may* want to fit is a mixture of a gamma distribution and a
point-mass ("atom") at 0.
R. T.
--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619
More information about the R-help
mailing list