0

I have to test my data in three distributions: Poisson, Negative Binomial and Geometric.

To test Poisson, I'm using:

glm(formula = frequencia ~ frequencia , 
               family = poisson(link = "log"), 
               data = data_fit,
              method = "glm.fit") 

And the results are ok.

To test geometric, I'm using:

glm(formula = frequencia ~ frequencia, 
            family= negative.binomial(theta = 1),
            data=data_fit)

And the results are ok too.

But, to test negative binomial, I'm using:

MASS::glm.nb(formula = frequencia ~ frequencia, 
                       data = data_fit,
                       link = "log",
                       method="glm.fit")

And i'm receiving this error:

Error in while ((it <- it + 1) < limit && abs(del) > eps) { : missing value where TRUE/FALSE needed

My data_fit is a vector/dataframe with 1000 values; all values in vector are the same and equal to 0.06.

enter image description here

I'm looking for the AIC, BIC and Deviance results of glm.nb function and parameters of negative binomial distribution.

Is there any way to find the values (AIC, BIC, Deviance, Parameters) with a zero variance, like the problem that i have?

  • It's hard to answer a question about distributions of data that no one else has access to. [See here](https://stackoverflow.com/q/5963269/5325862) on making a reproducible example that is easier for folks to help with. – camille Jan 27 '22 at 19:40
  • @camille, i know it's hard, but is what i said, my data is a vector with 1000 values equal to 0.06. – Caio Somilia Jan 27 '22 at 19:53
  • Okay, I didn't realize that repeated value was the entirety of your dataset. I don't totally get the purpose of this, but when I ran your last block of code and then ran `warnings()`, I got this: "In dpois(y, mu, log = TRUE) : non-integer x = 0.600000". It's been a while since my last probability class, but is negative binomial a discrete distribution? – camille Jan 27 '22 at 20:32
  • @camille, i solve those warnings multiplying this values for 100, to remove decimal cases for test. I'm translating SAS code to R, and sometimes those cases happen and we have a vector with just one value. Both negtive binomial, geometric and poisson are discrete distribution. They count the number of events that happen. – Caio Somilia Jan 27 '22 at 20:56
  • @camille, do you know other ways to do those types of distribution fits with R or Python? – Caio Somilia Jan 27 '22 at 21:39

0 Answers0