liveBook · Manning

Mean

As explained in Experimentation for Engineers

A mean is the arithmetic average of a collection of numerical values.

A mean is the arithmetic average of numerical measurements: add the values and divide by their count. In an experiment, averaging repeated measurements reduces the influence of unpredictable variation and usually moves the result closer to the underlying expectation. section 2.2.1 section 2.2

For a production decision, compare means rather than isolated observations. Measure execution cost repeatedly on each exchange, calculate one mean per exchange, and select the exchange with the lower mean when lower cost is better. Replication does not eliminate variation, but it makes the comparison more reliable. section 2.2.1

Three execution-cost measurements

Three ASDAQ measurements are 12.27626589, 10.14537192, and 12.62390111. Their mean is 11.681846307513723, which is closer to the expectation of 12 mips than two of the three individual measurements. With 300 measurements, the reported means are 12.000257642551059 for ASDAQ and 10.051095649188758 for BYSE. section 2.2.1

Listing 2.4 Aggregate measurement
def aggregate_measurement(exchange, num_individual_measurements):
    individual_measurements = np.array([
        trading_system(exchange)                      #1
        for _ in range(num_individual_measurements)   #2
    ])
    return individual_measurements.mean()             #3

Implements an aggregate measurement by collecting repeated observations with NumPy and returning their mean. section 2.2.1

Listing 2.5 Aggregate measurement with SE
def aggregate_measurement_with_se(exchange, num_individual_measurements):
    individual_measurements = np.array(
        [trading_system(exchange) for _ in range(num_individual_measurements)]
    )                                                         #1
    aggregate_measurement = individual_measurements.mean()    #2
    sd_1 = individual_measurements.std()                      #3
    se = sd_1 / np.sqrt(num_individual_measurements)          #3
    return aggregate_measurement, se

Extends the mean with a standard-error estimate, dividing the individual-measurement standard deviation by the square root of the replication count. section 2.2.1

How Experimentation for Engineers covers it

How deep it goes
Defines the arithmetic average, demonstrates its variation-reduction behavior, and extends calculation to standard error.
Examples
Uses ASDAQ and BYSE execution costs, three-observation calculations, 300-observation comparisons, and NumPy implementations.
What it assumes
Assumes individual measurements and expectation, while distinguishing observations from aggregate measurements.
What you can do after
Apply the mean via NumPy to aggregate replicated measurements and compare business metrics across alternatives.
How it connects
Connects mean with expectation, replication, measurement variation, standard deviation, standard error, and A/B testing.

Also explained in

Compare how 29 books explain mean →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Experimentation for Engineers. The section links point to the parts of the book it draws on.