# Measurement of Central Tendency

Central Tendency:

A measure of central tendency is a single value that attempts to describe a set of data by identifying the central position within that set of data. As such, measures of central tendency are sometimes called measures of central location.

The mean, median and mode are all valid measures of central tendency

 `mean()` Arithmetic mean (“average”) of data. `harmonic_mean()` Harmonic mean of data. `median()` Median (middle value) of data. `median_low()` Low median of data. `median_high()` High median of data. `median_grouped()` Median, or 50th percentile, of grouped data. `mode()` Mode (most common value) of discrete data.

Python Code:

Mean:

The arithmetic mean is the sum of the data divided by the number of data points. It is commonly called “the average”, although it is only one of many different mathematical averages. It is a measure of the central location of the data.

import statistics as st
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

`81.82142857142857`

Harmonic Mean:

The harmonic mean, sometimes called the subcontrary mean, is the reciprocal of the arithmetic `mean()` of the reciprocals of the data. For example, the harmonic mean of three values a, b and c will be equivalent to `3/(1/a + 1/b + 1/c)`.

`76.1552251422324`

Median:

It return the median (middle value) of numeric data

`87.5`

Mode:

It return the most common data point from discrete or nominal data. The mode (when it exists) is the most typical value, and is a robust measure of central location.

`100`

note:If data is empty, or if there is not exactly one most common value, `StatisticsError` is raised.

Dispersion:

Dispersion in statistics is a way of describing how spread out a set of data is. When a data set has a large value, the values in the set are widely scattered; when it is small the items in the set are tightly clustered. Very basically, this set of data has a small value:
1, 2, 2, 3, 3, 4
…and this set has a wider one:
0, 1, 20, 30, 40, 100

In Python we can calculate the dispersion from following methods:

 `pstdev()` Population standard deviation of data. `pvariance()` Population variance of data. `stdev()` Sample standard deviation of data. `variance()` Sample variance of data.

Variance: Variance is a measurement of dispersion of the data from the mean value of the distribution. It tells how far the data points lie from the mean of the distribution.

Var(X)=E[(X-µ)2 ] for a population

Var(X)=E[(X-‾x)2 ] for a sample

Python:

`335.62882653061223`
• Jolene