I'm trying to fit different statistical distributions (Gamma, Poisson, normal, inverse Gaussian) to my data with a glm. An example could be like this:
data <- rexp(500, 3) model <- glm(data~1, family=Gamma()) shape <- 1 / gamma.dispersion(model) rate <- shape*model$coef model2 <- glm(data~1, family=poisson()) lambda <- unique(model2$fitted.values)
So, here are the questions:
- If I want to select between all of them the best distribution fit with a glm, can I use the models AIC? Or should I use another method, like MSE? It's because I have really different results from one distribution to another.
- I already know that packages
MASSinclude specific functions to do this, but it's too slow for my data. If I use those functions to fit the data, mostly of the time I get as a result an exponential distribution. Is there a way to fit it with the glm families?
Update: The data comes from sales orders, but it is always grater than 0, that's why I can use the exponential or gamma distributions. (Only include the normal for the cases where there are so many orders that the negative part under the curve is almost 0).
Also, I need the distribution for simulate from it, a new series. With the result showed by the AIC i can't make them compete to get the best fitting. I would like a formal test, but i also need it to be really fast, so I'll settle for an approximation or something exploratory.