Hello,
Thanks that helped for poisson.
When I changed method to ML it worked for poisson but when I used that for
nbinomial I got errors.But why is this happening?
gf<-goodfit(binCount,type= "poisson")
summary(gf)

         Goodness-of-fit test for poisson distribution

                     X^2 df P(> X^2)
Likelihood Ratio 2730.24  3        0

gf<-goodfit(binCount,type= "nbinomial")
Warning messages:
1: NaNs produced in: dnbinom(x, size, prob, log)
2: NaNs produced in: dnbinom(x, size, prob, log)

 summary(gf)

         Goodness-of-fit test for nbinomial distribution

                      X^2 df     P(> X^2)
Likelihood Ratio 64.53056  2 9.713306e-15

But how can I interpret above result?
When I was using goodfit using method "MinChisq" I was getting some P
value.More the P value among goodness of fit tests for different
distributions
(poisson,binomial,nbinomial) better the fit would be.Am I correct?If I am
wrong correct me.
But now with ML method how can I decide which distribution is best fit?
Thank You.

Aswad

On 2/10/08, Jason Q. McClintic <[EMAIL PROTECTED]> wrote:
>
> Try changing your method to "ML" and try again. I tried the run the
> first example from the documentation and it failed with the same error.
> Changing the estimation method to ML worked.
>
> @List: Can anyone else verify the error I got? I literally ran the
> following two lines interactively from the example for goodfit:
>
> dummy <- rnbinom(200, size = 1.5, prob = 0.8)
> gf <- goodfit(dummy, type = "nbinomial", method = "MinChisq")
>
> and got back
>
> Warning messages:
> 1: In pnbinom(q, size, prob, lower.tail, log.p) : NaNs produced
> 2: In pnbinom(q, size, prob, lower.tail, log.p) : NaNs produced
>
> Again, I hope this helps.
>
> Sincerely,
>
> Jason Q. McClintic
>
> Aswad Gurjar wrote:
> > Hello,
> >
> > Thanks for help.But I am facing different problem.
> >
> > I have 421 readings of time and no of requests coming at perticular
> time.Basically I have data with interval of one minute and corresponding
> no of requests.It is discrete in nature.I am collecting data from 9AM to
> 4PM.But some of readings are coming as 0.When I plotted histogram of data
> I could not get shape of any standard distribution.Now,my aim is to find
> distribution which is "best fit" to my data among standard ones.
> >
> >  So there was huge data.That's why I tried to collect data into no of
> bins.That was working properly.Whatever code you have given is working
> properly too.But your code is more efficient.Now,problem comes at next
> stage.When I apply fitdistr() for continuous data or goodfit() for
> discrete data I get following error.I am not able to remove that
> error.Please help me if you can.
> > Errors are as follows:
> > library(vcd)
> > gf<-goodfit(binCount,type= "nbinomial",method= "MinChisq")
> > 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)
> >> summary(gf)
> >
> >          Goodness-of-fit test for nbinomial distribution
> >
> >              X^2 df    P(> X^2)
> > Pearson 9.811273  2 0.007404729
> > Warning message:
> > Chi-squared approximation may be incorrect in: summary.goodfit(gf)
> >
> > for another distribution:
> >  gf<-goodfit(binCount,type= "poisson",method= "MinChisq")
> > 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))
> >  Goodness-of-fit test for poisson distribution
> >
> >                   X^2 df P(> X^2)
> > Pearson 1.660931e+115  3        0
> > Warning message:
> > Chi-squared approximation may be incorrect in: summary.goodfit(gf)
> >
> >
> > Aswad
> > On 2/10/08, Jason Q. McClintic < [EMAIL PROTECTED]> wrote:
> >
> > I get the digest, so I apologize if this is a little late.
> >
> > For your situation (based on the description and what I think your code
> > is doing, more on that below), it looks like you are modeling a Poisson
> > flow where the number of hits per unit time is a random integer with
> > some mean value.
> >
> > If I understand your code correctly, you are trying to put your data
> > into k bins of width f<-(max(V1)-min(V1))/k. In that case I would think
> > something like this would work more efficiently:
> >
> > m<-min(V1);
> > k<-floor(1 + log2(length(V1)));
> > f<-(max(V1)-min(V1))/k;
> > binCount<-NULL;
> > for(i in seq(length=k)){
> > binIndex<-which((m+(i-1)*f<V1)&(V1<m+i*f));
> > binCount[i]<-sum(V2[binIndex]);
> > };
> >
> > where i becomes the index of time intervals.
> >
> > Hope it helps.
> >
> > Sincerely,
> >
> > Jason Q. McClintic
> >
> > [EMAIL PROTECTED] wrote:
> >> Send R-help mailing list submissions to
> >>       r-help@r-project.org
> >>
> >> To subscribe or unsubscribe via the World Wide Web, visit
> >>       https://stat.ethz.ch/mailman/listinfo/r-help
> >> or, via email, send a message with subject or body 'help' to
> >>       [EMAIL PROTECTED]
> >>
> >> You can reach the person managing the list at
> >>       [EMAIL PROTECTED]
> >>
> >> When replying, please edit your Subject line so it is more specific
> >> than "Re: Contents of R-help digest..."
> >>
> >
> >
> >
>

        [[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.

Reply via email to