Internet Guide to Stata
Print article

(Estimation of) Means

mean wealth, over(class)

will compute the mean, the standard error (not, however, the standard deviation), and a 95 per cent confidence interval for each value of class.

The over option may be omitted, resulting in an estimation of the grand mean. On the other hand, you may indicate more than one variable over which the mean shall be computed. Thus,

mean wealth, over(class country)

will estimate means and s.e.s for all classes and all countries, presenting first the means of the first class for all countries, then for the second class, etc.


The mean procedure is useful for computing estimates of the mean and its S.E. under different conditions: It may be prefixed by svy (the by prefix, however, cannot be used), and options are available for bootstrapping and jackknifing. Also, the confidence level may be changed. Thus,

mean wealth, over(class) vce(bootstrap) level(99)

will estimate the standard error via bootstrapping and, in addition, will compute a 99 per cent confidence interval.


The arithmetic mean is not the appropriate statistic in some specific cases, such as growth rates or velocities. Command ameans will compute, in addition to the arithmetic mean, the harmonic mean and the geometric mean.

ameans speed

will compute the arithmetic, geometric and harmonic mean of variable speed plus their confidence. Means for several variables may be listed after ameans; however, the command cannot be combined with over, so you'll have to use the by prefix or if in case you want means conditional on the values of some other variable(s).

© W. Ludwig-Mayerhofer, Stata Guide | Last update: 10 Apr 2012