**[R] ameans** -- Arithmetic, geometric, and harmonic means

__Syntax__

**ameans** [*varlist*] [*if*] [*in*] [*weight*] [**,** *options*]

*options* Description
-------------------------------------------------------------------------
Main
__a__**dd(***#***)** add *#* to each variable in *varlist*
__o__**nly** add *#* only to variables with nonpositive values
__l__**evel(***#***)** set confidence level; default is **level(95)**
-------------------------------------------------------------------------
**by** is allowed; see **[D] by**.
**aweight**s and **fweight**s are allowed; see weight.

__Menu__

**Statistics > Summaries, tables, and tests >** **Summary and descriptive**
**statistics > Arith./geometric/harmonic means**

__Description__

**ameans** computes the arithmetic, geometric, and harmonic means, with their
corresponding confidence intervals, for each variable in *varlist* or for
all the variables in the data if *varlist* is not specified. **gmeans** and
**hmeans** are synonyms for **ameans**.

__Options__

+------+
----+ Main +-------------------------------------------------------------

**add(***#***)** adds the value *#* to each variable in *varlist* before computing the
means and confidence intervals. This option is useful when analyzing
variables with nonpositive values.

**only** modifies the action of the **add(***#***)** option so that it adds *#* only to
variables with at least one nonpositive value.

**level(***#***)** specifies the confidence level, as a percentage, for confidence
intervals. The default is **level(95)** or as set by **set level**.

__Examples__

Setup
**. webuse systolic**

Compute arithmetic, geometric, and harmonic means
**. ameans systolic**

Same as above, but add 7 to **systolic** before computing means
**. ameans systolic, add(7)**

__Video example__

Descriptive statistics in Stata

__Stored results__

**ameans** stores the following in **r()**:

Scalars
**r(N)** number of nonmissing observations; used for arithmetic
mean
**r(N_pos)** number of nonmissing positive observations; used for
geometric and harmonic means
**r(mean)** arithmetic mean
**r(lb)** lower bound of confidence interval for arithmetic mean
**r(ub)** upper bound of confidence interval for arithmetic mean
**r(Var)** variance of untransformed data
**r(mean_g)** geometric mean
**r(lb_g)** lower bound of confidence interval for geometric mean
**r(ub_g)** upper bound of confidence interval for geometric mean
**r(Var_g)** variance of ln x_i
**r(mean_h)** harmonic mean
**r(lb_h)** lower bound of confidence interval for harmonic mean
**r(ub_h)** upper bound of confidence interval for harmonic mean
**r(Var_h)** variance of 1/x_i
**r(level)** confidence level of confidence interval