いろいろな平均
標本平均 sample mean
$n$個のデータ\[x_{1},x_{2},x_{3},\cdots,x_{n}\]が与えられたとき,\[\bar{x}=\frac{x_{1}+x_{2}+x_{3}+\cdots+x_{n}}{n}=\frac{1}{n}\sum_{i=1}^{n}x_{i}\]を標本平均という.
標本平均を python で計算する.
import numpy as np
from statistics import mean
x=[5,10,4,5,7,8,10.5,8.8,7.5]
x_mean = mean(x)
print(x_mean)
7.311111111111111
幾何平均 sample geometric mean
$n$個のデータ\[x_{1},x_{2},x_{3},\cdots,x_{n}\]が与えられたとき,\[x_{G}=\sqrt[n]{x_{1} \times x_{2} \times x_{3} \times \cdots \times x_{n}}\]を幾何平均という.
幾何平均を python で計算する.
import numpy as np
from scipy.stats.mstats import gmean
x=[5,10,4,5,7,8,10.5,8.8,7.5]
x_gmean = gmean(x)
print(x_gmean)
6.9696901872533115
標本調和平均 sample harmonic mean
$n$個のデータ\[x_{1},x_{2},x_{3},\cdots,x_{n}\]が与えられたとき,\[x_{H}=\frac{n}{\frac{1}{x_{1}}+\frac{1}{x_{2}}+\frac{1}{x_{3}}+ \cdots +\frac{1}{x_{n}}} = \frac{n}{\sum_{i=1}^{n}\frac{1}{x_{i}}} \]を標本調和平均という.
Mathematics is the language with which God has written the universe.