I have two lists of values A and B. I calculated the standard deviation of A and the standard deviation of B. The standard deviation of A is bigger than that of B. How can I test if the difference in the standard deviation is significant? I understand that t-tests are used to test differences in mean but how can we do the same for standard deviation or for variation coefficient? Can you give some examples of tests to check the significance of stdv differences between two samples?

  • $\begingroup$ If you believe $A$ and $B$ each come from a normal distribution, you can do an $F$-test of equality of variances. Otherwise it is more complicated analytically, and you might want to consider bootstrap approaches $\endgroup$
    – Henry
    Commented Sep 21, 2022 at 12:25
  • $\begingroup$ @Henry Is there a non-parmateric version of the F-test? $\endgroup$
    – kaki no
    Commented Sep 21, 2022 at 12:32

3 Answers 3


The first test one learns for this is an F-test of variances, discussed in this nice video. While that explicitly tests for variance equality, variance equality is the same as standard deviation equality, so this will test for both.

A caveat is that, while the t-test is fairly robust to deviations from the assumption of normal distributions, the F-test is not. My question here mentions some alternatives to the F-test and also discusses some of their issues.

An additional point is that F-testing is more famous for its use in ANOVA, which is a comparisons of group means, not if group variances. The trick is that the F-test in such a case cleverly uses a comparison of two variances to say something about means.

  • $\begingroup$ what if my data does not have a normal distribution? $\endgroup$
    – kaki no
    Commented Sep 21, 2022 at 12:41
  • 1
    $\begingroup$ Then it’s a difficult problem, and I question if variance equality is even the right question to ask. // My question here is related and gives some possible alternatives to the usual F-test. $\endgroup$
    – Dave
    Commented Sep 21, 2022 at 12:44

There are two standard variance comparison tests, the second of which is more robust to departures from normality and skewness.

Here's an example comparing the standard deviation of the hospital stay lengths by patient gender using Stata. This data looks pretty skewed:

enter image description here

. use https://www.stata-press.com/data/r18/stay, clear

. spikeplot lengthstay, by(sex) subtitle(,nospan)

. sdtest lengthstay, by(sex) 

Variance ratio test
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
    Male |     884    9.087443     .329222    9.788475    8.441294    9.733592
  Female |     894    8.800671     .304622    9.108148    8.202813     9.39853
Combined |   1,778    8.943251    .2241349    9.450947    8.503655    9.382846
    ratio = sd(Male) / sd(Female)                                 f =   1.1550
H0: ratio = 1                                    Degrees of freedom = 883, 893

    Ha: ratio < 1               Ha: ratio != 1                 Ha: ratio > 1
  Pr(F < f) = 0.9840         2*Pr(F > f) = 0.0319           Pr(F > f) = 0.0160

. oneway lengthstay sex

                        Analysis of variance
    Source              SS         df      MS            F     Prob > F
Between groups      36.5538105      1   36.5538105      0.41     0.5225
 Within groups      158685.784   1776   89.3501034
    Total           158722.338   1777   89.3203925

Bartlett's equal-variances test: chi2(1) =   4.6026    Prob>chi2 = 0.032

. robvar lengthstay, by(sex)

            |  Summary of Length of stay in days
     Gender |        Mean   Std. dev.       Freq.
       Male |   9.0874434   9.7884747         884
     Female |    8.800671   9.1081478         894
      Total |   8.9432508   9.4509466       1,778

W0  =  0.55505315   df(1, 1776)     Pr > F = 0.45635888

W50 =  0.42714734   df(1, 1776)     Pr > F = 0.51347664

W10 =  0.44577674   df(1, 1776)     Pr > F = 0.50443411

The first variance ratio F test rejects the two-sided null that the ratio of the SDs is equal to one since the p-value is 0.03. But this is because the data is very non-normal, so this rejection should be disregarded. I only included it for completeness. The oneway version is equivalent here, but useful if you have more than two groups.

The third test gives Levene's $W_0$ test statistic first, which performs better under non-normality. The following two rows are two Brown and Forsythe versions, which use more robust estimators of central tendency in place of the mean: the median and the 10% trimmed mean. These should be more robust than Levene's test when dealing with skewed populations. For asymmetric distributions, the median test is closer to the correct level. In all three, we cannot reject the null hypothesis that the variances are equal: the p-values are in the third column and are all pretty far away from 0.05. robvar can also handle more than two groups at once.

The Stata manual has all the formulas and references.


One common cause of unequal variation is that the data are sampled from lognormal distributions, not normal distributions. If this is the case, the SD of the two groups would be approximately proportional to the means, so the coefficient of variation would be similar in the two groups. In other words, your concern that the SDs are quite different may be a clue that the usual assumption (normal distributions) is wrong, and the data are lognormal (with equal geometric standard deviations).

  • 3
    $\begingroup$ Can you elaborate on how this helps with the test? $\endgroup$
    – dimitriy
    Commented Nov 8, 2023 at 0:10
  • 1
    $\begingroup$ Why would the SD be proportional to the means? Are you perhaps assuming the geometric SDs of the two distributions are equal? $\endgroup$
    – whuber
    Commented Nov 8, 2023 at 1:01
  • 1
    $\begingroup$ @whuber is right (as always). The SDs will be proportional to the means (approximately, given random sampling) if both data sets are sampled from lognormal distributions AND they both have the same geometric SD. $\endgroup$ Commented Nov 8, 2023 at 2:37
  • $\begingroup$ @dimitriy. If you assume sampling from lognormal distributions, then you can log transform the data and run a t test on the transformed values. With sampling from lognormal, the logs will be sampled from normal, so the assumptions of the regular t test are met. $\endgroup$ Commented Nov 8, 2023 at 2:38
  • 1
    $\begingroup$ FYI, this has been flagged as a low quality post, which I am going to disagree with. It's a legit answer and disagreement can be reflected either by downvote or eliciting more information, instead of flagging it as low quality. $\endgroup$ Commented Nov 8, 2023 at 4:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.