I need to compare the time duration of a production operations done by two different workers. Basically, the raw material is divided into two independent groups: one group of objects will be processed worker A with a old machinery, taking a certain variable number of minutes for each processing, while the second group is processed by worker B with a new machinery, which will also take a certain variable number of minutes for processing. I will then have two sets of numbers: in the first will be the measured durations to produce the objects with the old machine and in the second the measured durations to produce the objects with new machine. What statistical test should I use to check if the processing times of new machine is significantly different, since the distribution of times will probably not be normal?
-
$\begingroup$ Just checking: is this homework? Homework questions are allowed, but you should tag them and indicate what you've tried so far to solve the problem yourself. If not homework, can you give us a little more context? (Hints that I should include in an answer: (1) t-tests are astonishingly robust to non-Normality; (2) non-parametric tests such as Mann-Whitney; (3) Gamma GLM ... $\endgroup$– Ben BolkerCommented Nov 28 at 13:53
-
2$\begingroup$ Many thanks for your reply: I am studying engineering, but no, it is not a homework assignment at all (I have already passed the statistics exam and the numerical calculus exam). It is just my curiosity that I expressed by giving an example. But wanting to generalize, is trying to figure out how do you test the difference between the duration of two processes? I found various answers including the use of logistic regression, but none convinced me. $\endgroup$– MatthewCommented Nov 28 at 14:16
2 Answers
I agree with most of what's in @jginestet's answer. Another possibility would be to use a generalized linear model with a Gamma response. The Gamma distribution is a sensible choice for modeling durations/waiting times (e.g. see this section of the Wikipedia page for the Gamma distribution). To implement this in R you would say something like
m <- glm(duration ~ worker, family = Gamma(link = "log"), data = your_data)
summary(m)
assuming that your data was in long format, i.e. a single column containing all of the durations and a column (a factor
) specifying which worker was associated with each duration.
If your data set is very small you might prefer one of the non-parametric tests suggested in the other answer, but if it is reasonably large (e.g. >25-50 durations per worker) the GLM will probably be more powerful.
It is not the two original distributions which need to be normal, but the sampling distribution of the difference of the means, for which you would have only a single observation. Now, depending on how "not normal" your data is, and how large your sample size is, the CLT may be your best friend. Strong asymmetry + fat tails (aka skewness and kurtosis) are the enemy of the CLT (for rapid convergence to a distribution which is sufficiently close to the normal that t-tests will give very reasonable results). The best way to get a feel for this is to run a simulation; take the ECDF of your data, approximate it with a distribution from a broad family (e.g. exponential), and then run simulations of the sampling distribution of the mean, for various sample sizes. You will see that in most cases, it will converge much faster than you would have thought. You may want to read this blog or this paper. This link and this other one have nice simulations. Note that in your case (process timing), you have positive data, which will be skewed, but most likely not excessively (past a certain time, a part/material will simply be scrapped).
If the CLT (or your sample size) does not satisfy you, you can try a median test (Mood's median test). It is basically a binomial test, so it will require larger sample sizes than a t-test to achieve similar power, but it makes no normality assumption.
Another option is to use a Mann-Whitney U test (MWUt), or rather a Brunner-Munzel test (BMt). The BMt is a non-parametric test, exactly equivalent to the MWUt (test of stochastic equality), but w/o the Behrens Fisher problem (just like the Welch t test solves the Behrens Fisher problem for the Student's t test).
Note that, in the way you described your experiment, you are confounding the difference in operator with the difference in machinery; if you find a difference, you will not know exactly why. A crossover design (both operators use both machines for the same # of parts/materials) may be preferable. And in that case, regression, or 2-way ANOVA (which basically runs a regression) would be good choices (but would require normality of the residuals, not of the original distributions).