# Standard deviation of a dichotomous variable

Suppose, I have a dichotomous variable - gender:

Male coded as 0 Female coded as 1

Frequency of male - 30 Frequency of female - 20

The mean of a dichotomous variable is just the proportion which has been coded as 1. So, in this case, I believe it is 30/50.

The confusing part is while solving for standard deviation. How can I do that? Also, is the answer a meaningful one?

If you code males as 0 and females as 1, the mean will be $$\frac{20}{50}$$, not $$\frac{30}{50}$$.

For the SD, just use the standard formula with your coding, $$x_i\in\{0,1\}$$ and the mean $$\frac{20}{50}$$ you calculated above.

No, I don't think this answer is meaningful. In reporting the mean and SD, we summarize a distribution in two numbers. If we have a binary distribution, we have a much easier and more intuitive way of summarizing it in two numbers: just report the numbers of males and females.

• So, I can do (x - mean(x)) squared divided by n - 1? Commented Sep 26, 2019 at 11:55
• Yes, exactly. (And sum.) Commented Sep 26, 2019 at 11:58
• Okay, great. Thank you! Commented Sep 26, 2019 at 15:14

In this instance, using either the mean or the standard deviation would not be appropriate/meaningful. Both of these measures typically assume a 'normally distributed' variable (as in a bell curve shape). The mean tells you 'central tendency' - where the highest point on that curve is. The SD tells you the typical amount of deviation or spread around that mean. What both these numbers are assuming is that you have a scale variable. From the mean and SD, you can say what percentage of people are included within a particular deviation from the mean, and that gives valuable information about the distribution of your variable, which can also help with comparisons between groups.

In the case of a dichotomous variable, none of these assumptions hold. I believe you should simply just report the ratio of males to females to give an indication of what is going on in your sample. You could also (though it would be obvious if you report the ratio) note for example, 'therefore, most participants are male'.

If you want to use means and SDs to make comparisons between groups in how a dichotomous variables is split across different conditions, you should consider instead using something such as the chi square test of independence.

• The mean (expectation) and SD do not assume any particular distribution. Commented Sep 26, 2019 at 14:32
• I was thinking that if you are going to describe a distribution using only the mean and SD, then for this to be meaningful/accurate, it ought to be a normal distribution. Commented Oct 3, 2019 at 13:38
• No, not at all. The mean and SD are defined for almost all distributions. For instance, it's very natural to define the negative binomial in terms of the mean and variance (which is just the SD squared). In the specific case of the normal distribution, we have the additional properties of having $x$% of the probability mass within the mean $\pm y$ SDs, but that is just specific to the normal. Commented Oct 3, 2019 at 13:47
• Ah, I see what you are saying. Commented Oct 7, 2019 at 13:08