# Analysis of variance with Weibull or Gamma distributions

I have been trying to find a method to analyse variance on Weibull and/or Gamma distributions but a Google search for

anovar  Weibull "gamma distribution"


yields nothing helpful. The data I have cannot be fitted to a normal distribution but fits a Weibull or Gamma distribution quite well.

Besides the issue of the misspelling of 'anova' that Stephan mentioned, I have a few points.

1) I'd also suggest inserting "|" (for "or") in your search, since otherwise it will be treated more like "and"

2) further, the word 'distribution' goes as much with Weibull as it does with gamma. So I suggest a search like so: anova weibull|gamma distribution.

3) further still, in the case of the gamma, an ANOVA-type model would normally be fitted using GLMs, so you may prefer to search on gamma GLM

4) Parametric Weibull models are often available under options relating to survival analysis in many statistics packages; while survival models often have censored data, they don't have to, so a Weibull model with grouping-factors as IVs ("ANOVA-like") models can often be fitted that way.

The usual way to compare gamma means would be via a GLM.

This has the underlying assumption of equal shape parameters (much as ordinary ANOVA carries the assumption of equal variances).

This assumption can be assessed, for example, either visually (by looking at whether they seem to have similar shapes), or by finding MLEs of the shape parameters of the groups being compared. If the values are not too dissimilar then this approach should work fine.

[Similarly, a comparison of Weibull means might be achieved by treating the values as (uncensored) survival times in a survival model.]

On the other hand if it's not expected that the gammas are at least reasonably similar in shape, it's more complicated; one might try to form a confidence interval for the difference in means in any of several ways. In large samples, one might try bootstrapping, for example, or the distribution of a ratio of ML estimates of the mean (difference in logs) might be approximated or even assessed via simulation.

For comparison purposes, the following can be done in R (the data set is built in):

summary(lm(weight~feed,chickwts)) # Linear regression model for one way model

summary(survreg(Surv(weight)~feed,data=chickwts))  # Weibull model


anova(...) can be used in place of summary(...) in those calls to obtain other information.

The first model is an ordinary one-way anova type model.

The second is the equivalent using a gamma model (in this case with essentially identical parameter estimates to the first model but different standard errors).

The third model is also a gamma anova-type model but where the parameters describe effects on the log scale (a test of the model is still a test for differences in means on the original scale, though).

The fourth model is a Weibull model, which has log-scale parameter estimates (which can be compared with the third model).

• I understand this a bit better now. My problem is that the sample sizes of the distributions are quite different. One has 34 observations while the other has 2465 observations. Thanks, Commented Apr 4, 2014 at 21:55
• It's not clear to me what you're trying to achieve. Can you clarify what your variables and problems are? Commented Apr 5, 2014 at 0:30
• That helps a lot. The 0.00001 is because you have exact 0's? Is there a spike of values at 0 or is this just rounding? Note that fitdistr is already giving you parameter estimates, that's where you'll want to start. A test based on the likelihood ratio may require also combining the two data sets and fitting that. Alternatively, with large samples you might base a test off treating the estimates as asymptotically bivariate normal, but this would require having an estimate of the covariance of the two parameter estimates for each fit, not just their standard error. Commented Apr 7, 2014 at 22:15
• There are an infinite number of continuous functions with a mode at 0. Hell, there's an infinite number of different gamma distributions with a mode at zero. The exponential is the least skew of those. If, as you say, the density actually falls off exponentially, that's the definition of an exponential! But beware judging density from a single histogram. Appearances can be misleading! Commented Apr 28, 2014 at 23:14
• ... (ctd) If you're reasonably satisfied that it's approximately exponential, an exponential may be a reasonable choice. What is best would depend on as yet unstated criteria. Commented Apr 28, 2014 at 23:19