# How can I test the difference of two Weibull distributions?

I have two Weibull distribution sets from two wind datasets in order to check whether they are same.

I thought a 2 sample t-test would be applicable but I couldn't find any ways to do that on the Internet.

Does anyone know what type of test is applicable to my purpose? and what R function can you recommend?

Plus, if it turned out that there is a difference between the two datasets, can I just fit a linear line between the datasets?

• What do you mean by "the same"? What data have you got? A t-test compares two means; if you want to compare the means of two Weibull distributions, I see no reason you could not use a t-test. – Peter Flom - Reinstate Monica Nov 3 '13 at 12:58
• Weibull distributions are usually compared with accelerated failure time models, e.g. by 'survreg' in the R package 'survival'. t-test is problematic due to extreme right skewness of the data and unequal variances between groups. Of course, you cannot prove equality of distributions, except with infinite sample size. – Michael M Nov 3 '13 at 13:24
• Do you mean you have two datasets which you presume to be Weibull but may not be? And... if the time between observations is small, in some sense of the word, successive observations will not be independent of each other, complicating the problem. – jbowman Nov 3 '13 at 16:08
• Also, if the wind data sets cover the same time frame and are from sites that are not all that far apart, you'll likely have some contemporaneous correlation. – jbowman Nov 3 '13 at 17:03
• If you had independence and were prepared to assume Weibull, you could do a likelihood ratio test for equality of the parameters, but as jbowman points out you may not be able to assume independence. If you can model the dependence as well, then you may again be able to get back to some form of LRT – Glen_b -Reinstate Monica Nov 4 '13 at 0:04

If I understand you correctly, the fact that both datasets are Weibull is really irrelevant. You are more interested in testing the two sets of results and some measure of confidence if they are from the same distribution.

In this case, the simplest approach would probably be to use a distribution-free test, such as a Wilcoxon rank-sum test or a Kruskal-Wallis.

What may be a better test would be to use a two-sample empirical distribution function test such as a Cramer-von-Mises or Anderson-Darling test.

I would first suggest that you think about what you really need. If your intent is to address failure rates, than construct a sample estimate of the observed Weibull based failure rates over time. A regression of the observed natural log of the failure rates (also called hazard rates) should be linear versus the log of time, with the slope equaling the shape parameter minus one. For a two parameter Weibull distribution, the implied scale parameter can be determined by dividing the shape parameter by exp(regression intercept) and taking the result to the power (1/shape parameter). Source, per Wikipedia on the Weibull distribution, to quote: "Linear regression can also be used to numerically assess goodness of fit and estimate the parameters of the Weibull distribution. The gradient informs one directly about the shape parameter k and the scale parameter lambda can also be inferred".

I would argue there are a couple of advantages with this regression approach in addition to numerical simplicity over the MLE and being able to visualize the appropriateness of failure hazard rate model. One comment above notes a possible issue in auto correlated errors, which can be readily addressed in a regression setting. There is also a more subtle difference relating to experimental design with a possible significant increase in efficiency of parameter estimates. While the log regression is linear, the plot of the failure rate law itself for the Weibull can be highly nonlinear in time in the early phase for a shape parameter different from one (see, for example, the graph of the hazard rate for various shape parameters at http://www.weibull.com/hotwire/issue14/relbasics14.htm ). This suggests to me, based on experience, the need for more observations in this early phase to gain a more accurate estimate of the scale parameter (as derived from the estimate of the regression intercept). Such a censored sampling scheme in reducing tail observations could also reduce the possible introduction of other unwanted noise distributions (for example, a Weibull model of web browsing time until exiting the website could have noise introduced from the likes of a phone call, door bell,..,causing an inflated estimate of the actual browsing time).

Conveniently, regression theory provides the basis for confidence intervals for the parameters and even prediction intervals for future failures. One can also compare slope estimates for related regression regimes.

For those sticking with MLE, here is reference showing a derivation via MLE on the hazard rate (see http://www.weibull.com/hotwire/issue131/relbasics131.htm ). Note, in general, one can also compute MLE in the case of censored data.

 Nonparametric techniques are sensitive to violation of the independence assumption. Also, as hazard rates plots can confirm the validity of the well known versatile Weibull distribution as an appropriate failure distribution in this case, the argument for the use of nonparametric models is suspect, in my opinion.