(The documentation of function calculate_unbiased_stddev)
Last Update: 2025/8/7
◆機能・用途(Purpose)
実数値配列の要素\(d_1,\cdots,d_N\)の標準偏差
(不偏分散に対応して「データ数\(-1\)」(\(N-1\))を分母とするもの)
\[\begin{equation}
\sigma_d=\sqrt{\frac{1}{N-1}\sum_{i=1}^N\left(d_i-\bar{d}\right)^2}
\label{eq.stddev}
\end{equation}\]
を計算する。ここで\(\bar{d}\)は\(d_1,\cdots,d_N\)の平均値
\[\begin{equation}
\bar{d}=\frac{1}{N}\sum_{i=1}^Nd_i
\label{eq.average}
\end{equation}\]
である。
Calculate the standard deviation (eq. \ref{eq.stddev})
of the components of an array of real numbers \(d_1,\cdots,d_N\),
where the number of data subtracted by 1 (\(N-1\))
is used for the denominator to be consistent with an unbiased variance;
\(\bar{d}\) is the average (eq. \ref{eq.average}) of \(d_1,\cdots,d_N\).
実数値\(d_1,\cdots,d_N\)を並べた配列。
An array composed of the real numbers \(d_1,\cdots,d_N\).
average
\(d_1,\cdots,d_N\)の平均値。
An average of \(d_1,\cdots,d_N\).
◆戻り値(Return value)
(\ref{eq.stddev})式で計算した標準偏差。
The standard deviation calculated with eq. (\ref{eq.stddev}).
◆使用例(Example)
const int N=5;
const double d[]={1.2,3.4,5.6,7.8,9.0};
double a=calculate_average(N,d);
double sigma=calculate_unbiased_stddev(N,d,a);
◆使用上の注意(Important note)
この関数では
第3引数で与えた平均値が正しいかどうかのチェックは行われない
ので、間違いを防ぐために上の使用例のように
必ず関数calculate_averageで得た戻り値をそのまま与えること。
No check is conducted for the average given by the 3rd argument.
To avoid wrong calculation,
make sure to use the return value of function calculate_average
for the 3rd argument of this function, as the example above.
◆検証(Validation)
上の「使用例」の計算をこの関数を用いて行い、
正しい結果(3.178050)が得られることを確認した。
A calculation of the “Example” above
using this function yielded a correct result (3.178050).