# How can I test two samples for different variance?

I am using an accelerometer to test for vibration. To clarify the physics, imagine an accelerometer (which measures acceleration) is sitting on top of a washing machine. On the spin cycle the accelerometer will move up and down, giving a continuous(ly changing sample) reading with the mean being earth's gravity. Put one wet towel in the machine, and the accelerometer will move up and down more, with (aprox) the same frequency. How can I tell if there is a wet towel?

As long as my samples are larger than the period (and the period of any harmonics I guess) then the mean is going to be constant. I want to test for change (quickly, and preferably formally) . The undergraduate text book I have doesn't seem to help; I was hoping to use the apache commons stats package: https://commons.apache.org/proper/commons-math/userguide/stat.html

I guess, given the above, I can take the mean of just the positive values from both samples and perform a one tailed test, but the distribution of the positive values will be awfully skewed...

The discussion here: Compare the variances of several groups Does seem to be the answer (note the comments below on ANOVA).

I am surprised my problem is not more mainstream - variance of variance, I would have thought, would have many uses. Mean number of people in hospital dying of the flu/covid-19 for instance is quite constant across the country I believe, but the rate in individual hospitals presumably varies enormously as the disease spreads. P

• Compare the variances of several groups – user2974951 Apr 6 at 11:27
• Despite the first comment to the linked question, analysis of variance (ANOVA), either parametric or nonparametric, is the wrong technique for this. ANOVA is a test of mean equality that uses variances in a way clever enough to get that word in the name, but it does not compare the variances of multiple groups. – Dave Apr 6 at 11:37
• This question could profit from a better description of the data and the question to answer , the kind of change that is to be detected..How is the title connected to the question? – Bernhard Apr 6 at 12:10
• Dave thanks for clearing that up. I had to go back and see if I had foolishly mis-remembered what an anova does and was about to say that anova compares variances in means; I want to compare variances in variances (presumably std deviations). – Petr Apr 6 at 16:13
• Re "not more mainstream:" based on your description of first observing baseline acceleration and then "putting in a wet towel,* this can be framed as a very specialized form of changepoint problem (q.v.). It is specialized because (a) you can collect streams of (b) large amounts of (c) highly autocorrelated (d) multivariate data and (e) you are interested in a change in variance rather than a change in level. There are still many standard solutions, depending on how you run your experiment and whether you know when the towel was introduced. – whuber Apr 6 at 18:49