Hello, Thank You for response.Yes,It is discrete data.I have tried discrete model using goodfit() test.But that too is not working.Is there any other test for discrete data? When I try goodfit() test for discrete distribution:
gf<-goodfit(x[[1]],type= "nbinomial",method= "MinChisq") where x[[1]] is my data with 9 bins. x contains following data and interval is of 2800 seconds: V1 1 0 2 127 3 477 4 363 5 685 6 0 7 363 8 0 9 0 I get following errors: Warning messages: 1: NaNs produced in: pnbinom(q, size, prob, lower.tail, log.p) 2: NaNs produced in: pnbinom(q, size, prob, lower.tail, log.p) 3: NaNs produced in: pnbinom(q, size, prob, lower.tail, log.p) 4: NaNs produced in: pnbinom(q, size, prob, lower.tail, log.p) 5: NaNs produced in: pnbinom(q, size, prob, lower.tail, log.p) 6: NaNs produced in: pnbinom(q, size, prob, lower.tail, log.p) 7: NaNs produced in: pnbinom(q, size, prob, lower.tail, log.p) summary(gf) Goodness-of-fit test for nbinomial distribution X^2 df P(> X^2) Pearson 5.539024 2 0.06269258 Warning message: Chi-squared approximation may be incorrect in: summary.goodfit(gf) When i use poisson distribution : gf<-goodfit(x[[1]],type= "poisson",method= "MinChisq") I get following errors: Warning messages: 1: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 2: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 3: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 4: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 5: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 6: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 7: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 8: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 9: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) 10: NA/Inf replaced by maximum positive value in: optimize(chi2, range(count)) > summary(gf) Goodness-of-fit test for poisson distribution X^2 df P(> X^2) Pearson 4.137318e+138 3 0 Warning message: Chi-squared approximation may be incorrect in: summary.goodfit(gf) What should i do now?How can I remove these warnings and errors? Thank You. Aswad On 2/10/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Chenge your model, most likely. > > You are telling us a) the response is discrete and b) there is a > substantial probability that the value is zero. The gamma distributon > is a model for a continuous response, your response is integer valued. > Perhaps you should consider something the Poisson or Negative Binomial. > > Evem from the little you give us, the problem seems more statistical > than computational to me. > > > Bill Venables > CSIRO Laboratories > PO Box 120, Cleveland, 4163 > AUSTRALIA > Office Phone (email preferred): +61 7 3826 7251 > Fax (if absolutely necessary): +61 7 3826 7304 > Mobile: +61 4 8819 4402 > Home Phone: +61 7 3286 7700 > mailto:[EMAIL PROTECTED] > http://www.cmis.csiro.au/bill.venables/ > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Aswad Gurjar > Sent: Sunday, 10 February 2008 4:17 PM > To: r-help@r-project.org > Subject: [R] Error in optim while using fitdistr() function for > estimationof parameters > > Hello, > > I am trying to fit distribution for data consisting of 421 readings.It > is > basically no of requests arrived per minute.It contains many 0 entries > as no > of requests.When i use > fd<-fitdistr(V2,"gamma") > I get following error: > Error in optim(x = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, > : > initial value in 'vmmin' is not finite > > What should I do ? I need this function because I want to get value of > estimated parameters. > Is there any other function to perform such calculations? > Please help me. > Thank You. > > Code is as follows: > x<-data.frame() > N<-data.frame((read.table("cs2ip.txt"))) > attach(N) > library(MASS) > fd<-fitdistr(V2,"gamma") > > Aswad > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.