Chapterبەش 3 · Lectureوانە 3.2

Variance and Standard Deviationلێکنەچوون و لادانی پێوانەیی

Squared deviations give the variance and its square root the standard deviation: population (N) and sample (n−1)(n - 1) formulas, why a sample divides by n−1n - 1 (with a simulation), the corrected grouped formulas, the course's Example 5 and H.W 1, S.D. versus variance, the effect of adding and multiplying, and Python's pvariance vs variance.

دووجای دەدات و : فۆرمولەکانی ⁦(N)⁩ و (n−1n - 1)، بۆچی دابەشی n−1n - 1 دەکات (لەگەڵ )، فۆرمولە پۆلێنکراوە ڕاستکراوەکان، نموونەی 5 و ئەرکی ماڵەوەی 1ی کۆرسەکە، ⁦S.D⁩ بەرامبەر ، کاریگەریی زیادکردن و لێکدان و pvariance بەرامبەر variance لە Python.

21 min read22 خولەک خوێندنەوە · 23 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Compute the variance and standard deviation of raw and grouped data.
  • Choose between the population formula (divide by N) and the sample formula (divide by n−1n - 1), and explain why.
  • Explain the difference between the variance and the standard deviation, including units.
  • Predict how adding a constant or multiplying by k changes the spread.
  • Use statistics.pvariance, variance, pstdev and stdev in Python.
  • و بۆ خاو و پۆلێنکراو بژمێریت.
  • لە نێوان فۆرمولەی (دابەشکردن بە N) و فۆرمولەی (دابەشکردن بە n−1n - 1) هەڵبژێریت و هۆکارەکەی ڕوون بکەیتەوە.
  • جیاوازیی نێوان و ڕوون بکەیتەوە، یەکەکانیش لەگەڵیدا.
  • پێشبینی بکەیت زیادکردنی یان لێکدان لە k چۆن دەگۆڕێت.
  • statistics.pvariance، variance، pstdev و stdev لە Python بەکاربهێنیت.

From absolute values to squaresلە نرخی ڕووتەوە بۆ دووجا

In Range and mean deviation we saw that deviations from the mean always add up to 0, so their signs must be removed. The mean deviation removes them with absolute values. The variance removes them by squaring: it is the mean of the squared deviations. The standard deviation is its square root.

لە مەودا و لادانی نێوانەیی بینیمان کە کۆی لە هەمیشە 0ـە، بۆیە دەبێت نیشانەکانیان لاببرێن. بە لایان دەبات. بە دووجاکردن لایان دەبات: دووجای . ئەوە.

Definitionپێناسە

The mean of the squared from the mean: σ2=∑(xi−μ)2N\sigma^2 = \frac{\sum (x_i - \mu)^2}{N} for a population. For a random variable, σ2=E(X2)−[E(X)]2\sigma^2 = E(X^2) - [E(X)]^2.

دووجای لە : بۆ σ2=∑(xi−μ)2N\sigma^2 = \frac{\sum (x_i - \mu)^2}{N}. بۆ ، σ2=E(X2)−[E(X)]2\sigma^2 = E(X^2) - [E(X)]^2.

Definitionپێناسە

The square root of the : σ=σ2\sigma = \sqrt{\sigma^2}. It measures spread in the same units as the data.

ڕەگی دووجای : σ=σ2\sigma = \sqrt{\sigma^2}. پەرتبوون بە هەمان یەکەی دراوەکە دەپێوێت.

Why squares and not absolute values? Three reasons:

بۆچی دووجا و نەک ؟ سێ هۆکار:

  1. A square is never negative, so the signs disappear: (−2)2=22=4(-2)^2 = 2^2 = 4.
  2. Big deviations count much more: a deviation of 4 adds 16, four times as much as a deviation of 2. Values far from the mean are punished.
  3. The algebra is smooth: the mean is exactly the point that makes the sum of squared deviations smallest, and squares work well in formulas, probability and finance.
  1. دووجا هەرگیز نەرێنی نییە، بۆیە نیشانەکان نامێنن: (−2)2=22=4(-2)^2 = 2^2 = 4.
  2. گەورە زۆر زیاتر هەژمار دەکرێن: 4، ⁦16⁩ زیاد دەکات، چوار هێندەی 2. نرخە دوورەکان سزا دەدرێن.
  3. جەبرەکەی ڕێکە: ڕێک ئەو خاڵەیە کە کۆی دووجای بچووکترین دەکات و دووجا لە فۆرمولە، و دارایدا باش کار دەکات.
Quick checkپشکنینی خێراThe deviations of a data set are −3, 0, 3-3,\ 0,\ 3. What is the sum of their squares? ئەمانەن: −3, 0, 3-3,\ 0,\ 3. کۆی دووجاکانیان چەندە؟

Variance and Standard Deviation: Why divide by n-1?zedstatistics · Englishئینگلیزی · 311K viewsبینین · 7.4K likesلایک · Partبەشی 2:39–6:55 (ofلە 13:46)

Why variance squares the deviations instead of using absolute values, and why only n − 1 deviations are free (degrees of freedom).

بۆچی دووجا دەکات لە جیاتی بەکارهێنانی ، هەروەها بۆچی تەنها n−1n - 1 ئازادن ().

Watch 2:39–6:55: why we square the deviations

لە ⁦2:39⁩ تا ⁦6:55⁩ سەیر بکە: بۆچی دووجا دەکەین.

Watch the squares add upسەیری کۆبوونەوەی دووجاکان بکە

Here is the whole idea on the course's Example 5, the sample 9, 8, 6, 5, 7 (mean 7). For each value, draw its deviation, build a square on it, and add the square's area to a running total.

ئەمە هەموو بیرۆکەکەیە لەسەر نموونەی 5ی کۆرسەکە، 9، 8، 6، 5، 7 ( ⁦7⁩). بۆ هەر نرخێک، بکێشە، چوارگۆشەیەکی لەسەر دروست بکە و ڕووبەری چوارگۆشەکە بخەرە سەر کۆی ڕۆیشتوو.

Animation in seven frames. The values 9, 8, 6, 5, 7 sit on a number line with the mean 7 marked. One by one each deviation is drawn (+2, +1, −1, −2, 0) and a square with that side appears below: areas 4, 1, 1, 4, 0. A box keeps the running total 4, 5, 6, 10, 10. The last frame shows s² = 10 ÷ (5 − 1) = 2.5 and s = 1.58 for a sample, and σ² = 10 ÷ 5 = 2, σ = 1.41 for a whole population.
Animation in seven frames. The values 9, 8, 6, 5, 7 sit on a number line with the mean 7 marked. One by one each deviation is drawn (+2, +1, −1, −2, 0) and a square with that side appears below: areas 4, 1, 1, 4, 0. A box keeps the running total 4, 5, 6, 10, 10. The last frame shows s² = 10 ÷ (5 − 1) = 2.5 and s = 1.58 for a sample, and σ² = 10 ÷ 5 = 2, σ = 1.41 for a whole population.
Each squared deviation is the area of a square. The variance is the average area; the standard deviation is the side of that average square.هەر دووجایەکی ڕووبەری چوارگۆشەیەکە. تێکڕای ڕووبەرەکانە؛ لای ئەو چوارگۆشە تێکڕاییەیە.CêIT

This picture also explains the name: the standard deviation is the side of the “average square”. A variance of 2.5 is a square of area 2.5; its side is 2.5=1.58\sqrt{2.5} = 1.58, back in the units of the data.

ئەم وێنەیە ناوەکەش ڕوون دەکاتەوە: لای «چوارگۆشە تێکڕاییەکە»یە. ⁦2.5⁩ چوارگۆشەیەکە بە ڕووبەری ⁦2.5⁩؛ لاکەی 2.5=1.58\sqrt{2.5} = 1.58ـە، دیسان بە یەکەی .

The population formulas: σ2\sigma^2 and σ\sigmaفۆرمولەکانی کۆمەڵگە: σ2\sigma^2 و σ\sigma

The course defines the standard deviation as the positive square root of the arithmetic mean of the squared deviations of the values from their mean. It is usually written σ\sigma (the Greek letter sigma). When the data are a whole population of N values with mean μ\mu:

کۆرسەکە وا پێناسە دەکات: ئەرێنیی دووجای نرخەکان لە . زۆرجار بە σ\sigma دەنووسرێت (پیتی گریکیی سیگما). کاتێک هەموو N نرخە بە μ\mu:

σ2=∑i=1N(Xi−μ)2N,σ=σ2,μ=∑XiN\sigma^2 = \frac{\sum_{i=1}^{N} (X_i - \mu)^2}{N}, \qquad \sigma = \sqrt{\sigma^2}, \qquad \mu = \frac{\sum X_i}{N}

Population variance and population standard deviation (ungrouped data).

و ().

  • Remark 1. If the deviations are measured from the arithmetic mean, the root-mean-square deviation is exactly the standard deviation (square → mean → root).
  • Remark 2. The square of the standard deviation, σ2\sigma^2, is called the variance.
  • تێبینیی 1. ئەگەر لە بپێورێن، ڕەگی تێکڕای دووجای ڕێک (دووجا ← تێکڕا ← ڕەگ).
  • تێبینیی 2. دووجای ، σ2\sigma^2، پێی دەوترێت .
Quick checkپشکنینی خێراA population has deviations 2, −2, 1, −12,\ -2,\ 1,\ -1 from its mean. What is σ2\sigma^2? لە ئەمانەن: 2, −2, 1, −12,\ -2,\ 1,\ -1. σ2\sigma^2 چەندە؟

The sample formulas: divide by n−1n - 1فۆرمولەکانی نموونە: دابەشی n−1n - 1 بکە

Usually we do not have the whole population, only a sample of n values, and we want to learn about the population from it. Then the sum of squares is divided by n−1n - 1:

زۆرجار هەموو نییە، تەنها n نرخ و دەمانەوێت لە ڕێگەیەوە شت دەربارەی بزانین. ئەو کاتە کۆی دووجاکان دابەشی n−1n - 1 دەکرێت:

s2=∑i=1n(Xi−xˉ)2n−1,s=s2s^2 = \frac{\sum_{i=1}^{n} (X_i - \bar x)^2}{n - 1}, \qquad s = \sqrt{s^2}

Sample variance and sample standard deviation.

و .

Two versions of the same ideaدوو وەشانی هەمان بیرۆکە
MeasureپێوەرPopulation (parameter) ()Sample (statistic) ()
SizeقەبارەNNnn
Meanμ\muxˉ\bar x
Varianceσ2=∑(X−μ)2N\sigma^2 = \frac{\sum (X - \mu)^2}{N}s2=∑(X−xˉ)2n−1s^2 = \frac{\sum (X - \bar x)^2}{n - 1}
Standard deviationσ\sigmass
Pythonstatistics.pvariance, pstdevstatistics.variance, stdev

The notes write the sample S.D. as S (capital); many books use a small s. Both mean the same thing. Why n−1n - 1 and not n? The next screens answer that.

تێبینییەکان بە S (گەورە) دەنووسن؛ زۆر کتێب s ـی بچووک بەکار دەهێنن. هەردووکیان یەک واتایان هەیە. بۆچی n−1n - 1 و نەک n؟ پەڕەکانی داهاتوو وەڵام دەدەنەوە.

Quick checkپشکنینی خێراWhich formula do you use for the marks of 10 students chosen at random from a school of 800?بۆ نمرەی ⁦10⁩ قوتابی کە بە هەڕەمەکی لە قوتابخانەیەکی ⁦800⁩ کەسی هەڵبژێردراون کام فۆرمولە بەکار دەهێنیت؟

Why n−1n - 1?بۆچی n−1n - 1؟

The notes give both formulas but do not say why the sample one divides by n−1n - 1. This is one of the most common questions in statistics, so the next four screens answer it from different sides: an intuition, a computer simulation, degrees of freedom, and a rule of thumb.

تێبینییەکان هەردوو فۆرمولەکە دەدەن، بەڵام ناڵێن بۆچی هی دابەشی n−1n - 1 دەکات. ئەمە یەکێکە لە باوترین پرسیارەکانی ، بۆیە چوار پەڕەی داهاتوو لە چەند لایەکەوە وەڵامی دەدەنەوە: تێگەیشتنێکی سادە، ، و ڕێسایەکی خێرا.

Why n−1n - 1?بۆچی n−1n - 1؟

A sample hugs its own meanنموونە لە ناوەندی خۆی نزیکە

The deviations in s2s^2 are measured from the sample mean xˉ\bar x, not from the true mean μ\mu, which we do not know. But xˉ\bar x is computed from these very values, so it sits in their middle: no other point gives a smaller sum of squared deviations.

لە s2s^2دا لە xˉ\bar x دەپێورێن، نەک لە ڕاستەقینە μ\mu کە نایزانین. بەڵام xˉ\bar x لە هەر ئەم نرخانەوە ژمێردراوە، بۆیە لە ناوەڕاستیانە: هیچ خاڵێکی تر کۆیەکی بچووکتری دووجای نادات.

  1. An extreme sampleنموونەیەکی توند

    A fair die has μ=3.5\mu = 3.5 and σ2=35/12=2.917\sigma^2 = 35/12 = 2.917. Roll it twice and get 6 and 6.

    بەردەزارێکی دادپەروەر μ=3.5\mu = 3.5 و σ2=35/12=2.917\sigma^2 = 35/12 = 2.917ی هەیە. دوو جار فڕێی بدە و 6 و 6 وەربگرە.

  2. From its own meanلە ناوەندی خۆیەوە

    xˉ=6\bar x = 6, so ∑(X−xˉ)2=0+0=0\sum (X - \bar x)^2 = 0 + 0 = 0. Dividing by n gives a variance of 0: “no spread at all”.

    xˉ=6\bar x = 6، بۆیە ∑(X−xˉ)2=0+0=0\sum (X - \bar x)^2 = 0 + 0 = 0. دابەشکردن بە n 0 دەدات: «هیچ نییە».

  3. From the true meanلە ناوەندی ڕاستەقینەوە

    ∑(X−μ)2=2.52+2.52=12.5\sum (X - \mu)^2 = 2.5^2 + 2.5^2 = 12.5. Measured from 3.5 the two rolls are clearly spread.

    ∑(X−μ)2=2.52+2.52=12.5\sum (X - \mu)^2 = 2.5^2 + 2.5^2 = 12.5. کە لە ⁦3.5⁩ەوە بپێورێت، دوو فڕێدانەکە بە ڕوونی پەرتن.

This happens to every sample, a little or a lot: ∑(X−xˉ)2≤∑(X−μ)2\sum (X - \bar x)^2 \le \sum (X - \mu)^2. So dividing by n gives a variance that is too small on average. Dividing by the slightly smaller number n−1n - 1 makes up for it exactly. This fix is called Bessel's correction.

ئەمە بۆ هەموو ڕوو دەدات، کەم یان زۆر: ∑(X−xˉ)2≤∑(X−μ)2\sum (X - \bar x)^2 \le \sum (X - \mu)^2. بۆیە دابەشکردن بە n دەدات کە بە تێکڕا زۆر بچووکە. دابەشکردن بە ژمارە کەمێک بچووکترەکەی n−1n - 1 ڕێک قەرەبووی دەکاتەوە. ئەم چاککردنە پێی دەوترێت .

Definitionپێناسە

Dividing by n−1n - 1 instead of nn in the . The sample's values sit closer to their own mean than to the true mean, so dividing by nn would underestimate the spread.

دابەشکردن بە n−1n - 1 لە جیاتی nn لە . نرخەکانی نموونە لە تێکڕای خۆیانەوە نزیکترن تا لە تێکڕای ڕاستەقینە، بۆیە دابەشکردن بە nn پەرتبوون کەمتر لە ڕاستی دەخەمڵێنێت.

Quick checkپشکنینی خێراWhy does dividing by n make the sample variance too small on average?بۆچی دابەشکردن بە n بە تێکڕا زۆر بچووک دەکات؟

Why does the sample variance have an n-1?Stats with Brian · Englishئینگلیزی · 88K viewsبینین · 3.6K likesلایک

Each value pulls the sample mean towards itself, so deviations from x̄ come out too small; dividing by n − 1 fixes this.

هەر نرخێک بەرەو خۆی ڕادەکێشێت، بۆیە لە xˉ\bar{x} زۆر بچووک دەردەچن؛ دابەشکردن بە n−1n - 1 ئەمە چاک دەکاتەوە.

Whole video: why a sample divides by n − 1

هەموو ڤیدیۆکە: بۆچی دابەش بە n−1n - 1 دەکرێت.

Why n−1n - 1?بۆچی n−1n - 1؟

A simulation: average many samplesهاوشێوەسازییەک: تێکڕای زۆر نموونە

Let a computer check the claim. It rolls a fair die n times, computes the variance of these n rolls both ways (dividing by n and by n−1n - 1), and repeats this 100,000 times. Then it averages each kind of estimate and compares it with the true variance 2.917.

با ئەم بانگەشەیە بپشکنێت. بەردەزارێکی دادپەروەر n جار فڕێ دەدات، ئەم n فڕێدانە بە هەردوو ڕێگا دەژمێرێت (دابەشکردن بە n و بە n−1n - 1) و ئەمە ⁦100,000⁩ جار دووبارە دەکاتەوە. پاشان تێکڕای هەر جۆرێکی خەمڵاندن وەردەگرێت و بەراوردی دەکات لەگەڵ ڕاستەقینەی ⁦2.917⁩.

Averaging 100,000 sample variancesتێکڕای ⁦100,000⁩ لێکنەچوونی نموونەwhy_n_minus_1.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
import random

random.seed(1)            # the same "random" rolls every time you run it
TRUE_VAR = 35 / 12        # variance of one fair die: 2.917

def two_estimates(sample):
    n = len(sample)
    mean = sum(sample) / n
    ss = sum((x - mean) ** 2 for x in sample)   # sum of squared deviations
    return ss / n, ss / (n - 1)

for n in (2, 3, 5, 10):
    trials = 100_000
    total_n = total_n1 = 0
    for _ in range(trials):
        sample = [random.randint(1, 6) for _ in range(n)]
        by_n, by_n1 = two_estimates(sample)
        total_n += by_n
        total_n1 += by_n1
    print(f"n = {n:>2}: divide by n -> {total_n / trials:.3f}, "
          f"divide by n-1 -> {total_n1 / trials:.3f}   (true {TRUE_VAR:.3f})")
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 3

A fixed seed makes the “random” rolls repeatable, so you get the same output.

چەسپاو فڕێدانە «هەڕەمەکی»یەکان دووبارەکراوە دەکات، بۆیە هەمان دەرئەنجام وەردەگریت.

Lineدێڕی 6-10

Both estimates use the same sum of squares; only the divisor differs.

هەردوو خەمڵاندن هەمان کۆی دووجاکان بەکار دەهێنن؛ تەنها دابەشکەرەکە جیاوازە.

Bar chart for sample sizes n = 2, 3, 5 and 10. Orange bars, dividing by n, have average heights 1.458, 1.944, 2.333 and 2.625, all below the dashed line at the true variance 2.917. Green bars, dividing by n − 1, all reach exactly 2.917.هێڵکاریی ستوونی بۆ قەبارەی نموونە n = 2، 3، 5 و 10. ستوونە پرتەقاڵییەکان، دابەشکردن بە n، تێکڕای بەرزییان 1.458، 1.944، 2.333 و 2.625ـە، هەموویان لە خوار هێڵە پچڕپچڕەکەی لێکنەچوونی ڕاستەقینە 2.917ن. ستوونە سەوزەکان، دابەشکردن بە n − 1، هەموویان ڕێک دەگەنە 2.917.
The exact averages (computed over every possible sample): dividing by n is always too small by the factor (n−1)/n(n - 1)/n; dividing by n−1n - 1 hits the true value.تێکڕا وردەکان (بۆ هەموو گونجاو ژمێردراون): دابەشکردن بە n هەمیشە بە ڕێژەی (n−1)/n(n - 1)/n زۆر بچووکە؛ دابەشکردن بە n−1n - 1 ڕێک دەپێکێت.CêIT

The simulation agrees with the exact chart: with ÷n\div n the average estimate is only n−1n\tfrac{n-1}{n} of the truth (half of it when n=2n = 2); with ÷(n−1)\div (n-1) it lands on 2.917. The gap shrinks as n grows: for n=100n = 100 the two formulas differ by only 1%.

لەگەڵ وردەکەدا ڕێکە: بە ÷n\div n تێکڕای خەمڵاندن تەنها n−1n\tfrac{n-1}{n}ی ڕاستییەکەیە (نیوەی کاتێک n=2n = 2)؛ بە ÷(n−1)\div (n-1) دەکەوێتە سەر ⁦2.917⁩. بە گەورەبوونی n جیاوازییەکە بچووک دەبێتەوە: بۆ n=100n = 100 دوو فۆرمولەکە تەنها ⁦1%⁩ جیاوازن.

Quick checkپشکنینی خێراWith samples of size n=4n = 4, what fraction of the true variance does dividing by n give on average?بە قەبارە n=4n = 4، دابەشکردن بە n بە تێکڕا چ بەشێک لە ڕاستەقینە دەدات؟

Why n−1n - 1?بۆچی n−1n - 1؟

Degrees of freedomپلەکانی ئازادی

A second way to see n−1n - 1: the deviations from xˉ\bar x always add up to 0. In Example 5 the first four deviations are 2, 1, −1, −22,\ 1,\ -1,\ -2; the fifth must be 0. Only n−1n - 1 deviations are free; the last one is fixed by the others. We say the sample variance has n−1n - 1 degrees of freedom, and we share the sum of squares among those free pieces.

ڕێگای دووەم بۆ بینینی n−1n - 1: کۆی لە xˉ\bar x هەمیشە 0ـە. لە نموونەی 5دا چوار یەکەم 2, 1, −1, −22,\ 1,\ -1,\ -2ن؛ پێنجەمیان دەبێت 0 بێت. تەنها n−1n - 1 ئازادن؛ دوایینیان بەهۆی ئەوانی ترەوە چەسپاوە. دەڵێین n−1n - 1 هەیە و کۆی دووجاکان بەسەر ئەو پارچە ئازادانەدا دابەش دەکەین.

Definitionپێناسە

The number of values that are still free to vary. For the it is n−1n - 1: the from xˉ\bar x must add up to 0, so once n−1n - 1 of them are known, the last one is fixed.

ژمارەی ئەو نرخانەی کە هێشتا ئازادن بگۆڕێن. بۆ دەکاتە n−1n - 1: کۆی لە xˉ\bar x دەبێت 0 بێت، بۆیە کاتێک n−1n - 1یان زانرا، دوایینیان چەسپاوە.

Sharing the bill in a tea houseدابەشکردنی پارە لە چایخانە

Five friends spent 10,000 dinars in total. The first four can say any amount they paid — 3,000, 1,000, 2,500, 1,500 — but then the fifth has no choice: he paid exactly 2,000. Five payments, only four free choices.

پێنج هاوڕێ بە گشتی ⁦10,000⁩ دینار خەرج دەکەن. چوارەکەی یەکەم دەتوانن هەر بڕێک بڵێن کە داویانە — ⁦3,000⁩، ⁦1,000⁩، ⁦2,500⁩، ⁦1,500⁩ — بەڵام پاشان پێنجەم هیچ هەڵبژاردنێکی نییە: ڕێک ⁦2,000⁩ی داوە. پێنج پارەدان، تەنها چوار هەڵبژاردنی ئازاد.

Where the analogy stops workingسنووری ئەم نموونەیە

In statistics the fixed total is 0 (the sum of deviations), not a bill; the idea of “one value is decided by the rest” is the same.

لە کۆ چەسپاوەکە 0ـە (کۆی )، نەک پارەی چایخانە؛ بیرۆکەی «یەک نرخ بەهۆی ئەوانی ترەوە دیاری دەکرێت» هەمان شتە.

Variance and Standard Deviation: Why divide by n-1?zedstatistics · Englishئینگلیزی · 311K viewsبینین · 7.4K likesلایک · Partبەشی 10:47–13:46 (ofلە 13:46)

Why variance squares the deviations instead of using absolute values, and why only n − 1 deviations are free (degrees of freedom).

بۆچی دووجا دەکات لە جیاتی بەکارهێنانی ، هەروەها بۆچی تەنها n−1n - 1 ئازادن ().

Watch 10:47–13:46: what degrees of freedom mean

لە ⁦10:47⁩ تا ⁦13:46⁩ سەیر بکە: چ واتایەکیان هەیە.

Why n−1n - 1?بۆچی n−1n - 1؟

Which formula should I use?کام فۆرمولە بەکاربهێنم؟

  • Your values are the whole group you care about (all students of one class, all days of a month): divide by N (σ2\sigma^2, Python pvariance).
  • Your values are a sample used to estimate a bigger group: divide by n−1n - 1 (s2s^2, Python variance).
  • If a test or a lecturer says which one, follow it. In this course the exercises name the version (“population”, “sample”).
  • نرخەکانت هەموو ئەو کۆمەڵەیەن کە گرنگە بۆت (هەموو قوتابییانی پۆلێک، هەموو ڕۆژەکانی مانگێک): دابەشی N بکە (σ2\sigma^2، pvariance لە Python).
  • نرخەکانت بۆ خەمڵاندنی کۆمەڵەیەکی گەورەتر: دابەشی n−1n - 1 بکە (s2s^2، variance لە Python).
  • ئەگەر تاقیکردنەوەیەک یان مامۆستایەک بڵێت کامیان، پەیڕەوی بکە. لەم کۆرسەدا ڕاهێنانەکان وەشانەکە ناو دەبەن («»، «»).
Quick checkپشکنینی خێراA teacher records the heights of all 25 students of her class to describe that class. Which divisor?مامۆستایەک باڵای هەموو ⁦25⁩ قوتابیی پۆلەکەی تۆمار دەکات بۆ وەسفکردنی ئەو پۆلە. کام دابەشکەر؟

Example 5: a sample of five numbersنموونەی 5: نموونەیەکی پێنج ژمارەیی

Find the variance S2S^2 and the S.D. of the sample 9, 8, 6, 5, 7. First Xˉ=355=7\bar X = \frac{35}{5} = 7.

S2S^2 و 9، 8، 6، 5، 7 بدۆزەرەوە. سەرەتا Xˉ=355=7\bar X = \frac{35}{5} = 7.

Table (5)خشتەی ⁦(5)⁩
XiX_i98657Σ
Xi−XˉX_i - \bar X21−1-1−2-200
(Xi−Xˉ)2(X_i - \bar X)^24114010
S2=∑(Xi−Xˉ)2n−1=105−1=52=2.5,S=52=1.581S^2 = \frac{\sum (X_i - \bar X)^2}{n - 1} = \frac{10}{5 - 1} = \frac{5}{2} = 2.5, \qquad S = \sqrt{\tfrac{5}{2}} = 1.581

The deviation row adds up to 0, a quick check that the mean was right.

ڕیزی کۆی 0ـە، پشکنینێکی خێرا کە دروست بووە.

If the five numbers were a whole population instead, the same sum would be divided by 5: σ2=10/5=2\sigma^2 = 10/5 = 2 and σ=2=1.414\sigma = \sqrt 2 = 1.414.

ئەگەر پێنج ژمارەکە لە جیاتی ئەوە هەموو بوونایە، هەمان کۆ دابەشی 5 دەکرا: σ2=10/5=2\sigma^2 = 10/5 = 2 و σ=2=1.414\sigma = \sqrt 2 = 1.414.

Quick checkپشکنینی خێراFor the sample 9, 8, 6, 5, 7, what is S?بۆ 9، 8، 6، 5، 7، S چەندە؟

A shortcut for hand calculationڕێگایەکی کورت بۆ ژماردنی دەستی

Subtracting the mean from every value is slow when the mean is a long decimal. Expanding the square gives a shortcut that needs only ∑X\sum X and ∑X2\sum X^2:

کەمکردنەوەی لە هەموو نرخێک هێواشە کاتێک ژمارەیەکی دەیی درێژە. کردنەوەی دووجاکە ڕێگایەکی کورت دەدات کە تەنها ∑X\sum X و ∑X2\sum X^2ی پێویستە:

∑(X−Xˉ)2=∑X2−(∑X)2n,∑F(X−Xˉ)2=∑FX2−(∑FX)2∑F\sum (X - \bar X)^2 = \sum X^2 - \frac{\left(\sum X\right)^2}{n}, \qquad \sum F(X - \bar X)^2 = \sum F X^2 - \frac{\left(\sum F X\right)^2}{\sum F}

Example 5: ∑x2=81+64+36+25+49=255\sum x^2 = 81 + 64 + 36 + 25 + 49 = 255 and (∑x)2/n=352/5=245(\sum x)^2/n = 35^2/5 = 245, so the sum of squares is 255−245=10255 - 245 = 10, as before.

نموونەی 5: ∑x2=81+64+36+25+49=255\sum x^2 = 81 + 64 + 36 + 25 + 49 = 255 و (∑x)2/n=352/5=245(\sum x)^2/n = 35^2/5 = 245، بۆیە کۆی دووجاکان 255−245=10255 - 245 = 10ـە، وەک پێشوو.

Quick checkپشکنینی خێرا∑x=20\sum x = 20, ∑x2=120\sum x^2 = 120, n=4n = 4. What is the sum of squared deviations?∑x=20\sum x = 20، ∑x2=120\sum x^2 = 120، n=4n = 4. کۆی دووجای چەندە؟

Grouped data: put the frequencies inدراوەی پۆلێنکراو: دووبارەبوونەوەکان دابنێ

In a frequency table, the midpoint XiX_i of each class stands for FiF_i values, so each squared deviation is counted FiF_i times. The number of values is ∑Fi\sum F_i:

لە ، XiX_iی هەر نوێنەری FiF_i نرخە، بۆیە هەر دووجایەکی FiF_i جار هەژمار دەکرێت. ژمارەی نرخەکان ∑Fi\sum F_iـە:

σ2=∑Fi(Xi−μ)2∑Fi,s2=∑Fi(Xi−xˉ)2(∑Fi)−1,xˉ=∑FiXi∑Fi\sigma^2 = \frac{\sum F_i (X_i - \mu)^2}{\sum F_i}, \qquad s^2 = \frac{\sum F_i (X_i - \bar x)^2}{\left(\sum F_i\right) - 1}, \qquad \bar x = \frac{\sum F_iX_i}{\sum F_i}

Population: divide by N=∑FN = \sum F. Sample: divide by n−1=∑F−1n - 1 = \sum F - 1. The standard deviations are the square roots.

: دابەشی N=∑FN = \sum F بکە. : دابەشی n−1=∑F−1n - 1 = \sum F - 1 بکە. ئەمانەن.

Quick checkپشکنینی خێراA table has ∑F=30\sum F = 30 and ∑F(X−xˉ)2=824.17\sum F(X - \bar x)^2 = 824.17. What is the sample variance?خشتەیەک ∑F=30\sum F = 30 و ∑F(X−xˉ)2=824.17\sum F(X - \bar x)^2 = 824.17ی هەیە. چەندە؟

H.W 1: population and sample from one tableئەرکی ماڵەوەی 1: کۆمەڵگە و نموونە لە یەک خشتەوە

H.W 1 asks for the variance and S.D. of Table (6), once as a population and once as a sample. Classes 0–5, 5–10, 10–15, 15–20, 20–25 with frequencies 2, 7, 12, 6, 3.

ئەرکی ماڵەوەی 1 داوای و خشتەی ⁦(6)⁩ دەکات، جارێک وەک و جارێک وەک . ⁦0–5⁩، ⁦5–10⁩، ⁦10–15⁩، ⁦15–20⁩، ⁦20–25⁩ بە 2، 7، ⁦12⁩، 6، 3.

Working table for H.W 1 (xˉ=380/30=12.6667)(\bar x = 380/30 = 12.6667)خشتەی کاری ئەرکی ماڵەوەی 1 (xˉ=380/30=12.6667\bar x = 380/30 = 12.6667)
ClassFiF_iXiX_iFiXiF_iX_iXi−XˉX_i - \bar X(Xi−Xˉ)2(X_i - \bar X)^2Fi(Xi−Xˉ)2F_i(X_i - \bar X)^2
0–522.55−10.1667-10.1667103.3611206.7222
5–1077.552.5−5.1667-5.166726.6944186.8611
10–151212.5150−0.1667-0.16670.02780.3333
15–20617.51054.833323.3611140.1667
20–25322.567.59.833396.6944290.0833
Σ30380824.1667
σ2=824.166730=27.472,σ=27.472=5.241s2=824.166729=28.420,s=28.420=5.331\begin{aligned} \sigma^2 &= \frac{824.1667}{30} = 27.472, & \sigma &= \sqrt{27.472} = 5.241 \\ s^2 &= \frac{824.1667}{29} = 28.420, & s &= \sqrt{28.420} = 5.331 \end{aligned}

Check with the shortcut: ∑FX2=5637.5\sum FX^2 = 5637.5 and 5637.5−3802/30=824.175637.5 - 380^2/30 = 824.17 ✓.

پشکنین بە ڕێگا کورتەکە: ∑FX2=5637.5\sum FX^2 = 5637.5 و 5637.5−3802/30=824.175637.5 - 380^2/30 = 824.17 ✓.

Quick checkپشکنینی خێراWhy is s=5.331s = 5.331 a little larger than σ=5.241\sigma = 5.241 for the same table?بۆچی بۆ هەمان خشتە s=5.331s = 5.331 کەمێک لە σ=5.241\sigma = 5.241 گەورەترە؟

What the standard deviation tells youلادانی پێوانەیی چیت پێ دەڵێت

Think of the standard deviation as the typical distance of a value from the mean, in the units of the data. Small σ\sigma: the values crowd around the mean. Large σ\sigma: they are spread far.

وەک دووریی ئاسایی نرخێک لە بیر لێ بکەرەوە، بە یەکەی . σ\sigmaـی بچووک: نرخەکان لە دەوری کۆدەبنەوە. σ\sigmaـی گەورە: زۆر بڵاو دەبنەوە.

Animation: twelve marks with mean 50 on a scale from 0 to 100. The standard deviation grows from σ = 3 to 8, 15 and 22; a shaded band from −1σ to +1σ widens as the dots spread out. The last frame shows the four versions stacked, from tightly packed (σ = 3) to widely spread (σ = 22).
Animation: twelve marks with mean 50 on a scale from 0 to 100. The standard deviation grows from σ = 3 to 8, 15 and 22; a shaded band from −1σ to +1σ widens as the dots spread out. The last frame shows the four versions stacked, from tightly packed (σ = 3) to widely spread (σ = 22).
Same mean, growing σ\sigma: the marks drift away from the mean and the ±1σ\pm 1\sigma band widens.هەمان ، σ\sigmaـی گەورەبوو: نمرەکان لە دوور دەکەونەوە و پشتێنەی ±1σ\pm 1\sigma پان دەبێتەوە.CêIT
Quick checkپشکنینی خێراMarks are roughly bell-shaped with mean 60 and σ=10\sigma = 10. About what share of the marks lies between 50 and 70?نمرەکان نزیکەی شێوەی زەنگیان هەیە بە ⁦60⁩ و σ=10\sigma = 10. نزیکەی چەند لە نمرەکان لە نێوان ⁦50⁩ و ⁦70⁩دان؟

How unusual is one value?نرخێک چەند نائاساییە؟

The two classes of the previous lesson have σ=2.29\sigma = 2.29 (A) and σ=15.27\sigma = 15.27 (B), as populations. The standard deviation also lets you compare single values: a mark of 74 in class A is (74−70)/2.29=1.75(74 - 70)/2.29 = 1.75 standard deviations above the mean, while 88 in class B is only (88−70)/15.27=1.18(88 - 70)/15.27 = 1.18. The 74 is the more unusual mark in its class. Counting “how many standard deviations from the mean” is the idea of the z-score: z-scores.

دوو پۆلەکەی وانەی پێشوو، وەک : پۆلی A σ=2.29\sigma = 2.29 و پۆلی B σ=15.27\sigma = 15.27. ڕێگە دەدات نرخە تاکەکانیش بەراورد بکەیت: نمرەی ⁦74⁩ لە پۆلی A (74−70)/2.29=1.75(74 - 70)/2.29 = 1.75 لە سەرووی ، لە کاتێکدا ⁦88⁩ لە پۆلی B تەنها (88−70)/15.27=1.18(88 - 70)/15.27 = 1.18ـە. ⁦74⁩ لە پۆلەکەی خۆیدا نمرەیەکی نائاساییترە. ژماردنی «چەند لە » بیرۆکەی : نمرە پێوانەییەکان.

Quick checkپشکنینی خێراClass A (σ=2.29\sigma = 2.29) and class B (σ=15.27\sigma = 15.27) both have mean 70. In which class is a mark of 80 more unusual?پۆلی A (σ=2.29\sigma = 2.29) و پۆلی B (σ=15.27\sigma = 15.27) هەردووکیان ⁦70⁩یان هەیە. نمرەی ⁦80⁩ لە کام پۆلدا نائاساییترە؟

Standard deviation vs varianceلادانی پێوانەیی بەرامبەر لێکنەچوون

The difference between S.D. and variance (the course's table, with the units row explained)جیاوازیی نێوان ⁦S.D⁩ و (خشتەی کۆرسەکە، لەگەڵ ڕوونکردنەوەی ڕیزی یەکەکان)
Standard deviationVariance
The square root of the variance The mean of the squared deviations دووجای
In the same units as the data (cm, marks, minutes)بە هەمان یەکەی (سم، نمرە، خولەک)In squared units (cm², marks², minutes²)بە یەکەی دووجا (سم²، نمرە²، خولەک²)
Useful to describe a population or a sample and to spot outliersبەسوودە بۆ وەسفکردنی یان و دۆزینەوەی Useful inside statistical formulas and in finance (risk)بەسوودە لە ناو فۆرمولە ئامارییەکان و لە دارایی (مەترسی)
  • Both are measures of the dispersion of data.
  • Both show how much the values vary from the average.
  • Both are never negative.
  • هەردووکیان پێوەری .
  • هەردووکیان نیشان دەدەن نرخەکان چەند لە جیاوازن.
  • هەردووکیان هەرگیز نەرێنی نین.
Quick checkپشکنینی خێراExam marks have variance 64 marks². What is their standard deviation?نمرەکانی تاقیکردنەوەیەک ⁦64⁩ نمرەی دووجایان هەیە. چەندە؟

The standard deviation is never negativeلادانی پێوانەیی هەرگیز نەرێنی نییە

  • Property 1. Always S≥0S \ge 0, and S=0S = 0 only when all values are equal (every Xi=XˉX_i = \bar X).
  • تایبەتمەندیی 1. هەمیشە S≥0S \ge 0 و S=0S = 0 تەنها کاتێک هەموو نرخەکان یەکسانن (هەموو Xi=XˉX_i = \bar X).

Why? Every squared deviation is 0 or more, so their mean is 0 or more, and the square root of that is 0 or more. It is 0 only when every deviation is 0, that is, when there is no spread at all.

بۆچی؟ هەموو دووجایەکی 0 یان زیاترە، بۆیە تێکڕاکەیان 0 یان زیاترە و ئەویش 0 یان زیاترە. تەنها کاتێک 0ـە کە هەموو 0 بێت، واتە هیچ نەبێت.

Quick checkپشکنینی خێراA calculator shows a standard deviation of −2.4-2.4 for your marks. What do you conclude? نمرەکانت بە −2.4-2.4 نیشان دەدات. چی دەگەیتە ئەنجام؟

Properties: adding and multiplyingتایبەتمەندییەکان: زیادکردن و لێکدان

  • Property 2. If Xi=kYiX_i = kY_i then σ2(X)=k2σ2(Y)\sigma^2(X) = k^2\sigma^2(Y) and S2(X)=k2S2(Y)S^2(X) = k^2S^2(Y); the S.D. is multiplied by ∣k∣|k|.
  • Property 3. If Xi=k+bYiX_i = k + bY_i then σ2(X)=0+b2σ2(Y)\sigma^2(X) = 0 + b^2\sigma^2(Y) and S2(X)=b2S2(Y)S^2(X) = b^2S^2(Y): adding a constant changes nothing.
  • تایبەتمەندیی 2. ئەگەر Xi=kYiX_i = kY_i ئەوا σ2(X)=k2σ2(Y)\sigma^2(X) = k^2\sigma^2(Y) و S2(X)=k2S2(Y)S^2(X) = k^2S^2(Y)؛ ⁦S.D⁩ لە ∣k∣|k| لێک دەدرێت.
  • تایبەتمەندیی 3. ئەگەر Xi=k+bYiX_i = k + bY_i ئەوا σ2(X)=0+b2σ2(Y)\sigma^2(X) = 0 + b^2\sigma^2(Y) و S2(X)=b2S2(Y)S^2(X) = b^2S^2(Y): زیادکردنی هیچ ناگۆڕێت.
Three dot plots on a scale from 0 to 20. Top: Y = 9, 8, 6, 5, 7 with s = 1.58. Middle: Y + 10, the same pattern moved 10 to the right, s = 1.58 unchanged. Bottom: 2Y = 18, 16, 12, 10, 14, twice as spread, s = 3.16. A shaded band of ±1 standard deviation sits around each mean.سێ هێڵکاریی خاڵ لەسەر پێوەرێک لە 0 تا 20. سەرەوە: Y = 9، 8، 6، 5، 7 بە s = 1.58. ناوەڕاست: Y + 10، هەمان شێوە 10 بەرەو ڕاست چووە، s = 1.58 نەگۆڕاوە. خوارەوە: 2Y = 18، 16، 12، 10، 14، دوو هێندە پەرت، s = 3.16. پشتێنەیەکی ڕەنگکراوی ±1 لادانی پێوانەیی لە دەوری هەر ناوەندێکە.
Adding 10 moves the data but keeps the spread; doubling doubles the S.D. and multiplies the variance by 4.زیادکردنی ⁦10⁩ دەجوولێنێت بەڵام دەهێڵێتەوە؛ دوو هێندەکردن ⁦S.D⁩ دوو هێندە دەکات و لە 4 لێک دەدات.CêIT

Check with Example 5 (S2=2.5S^2 = 2.5): adding 10 to every value gives 19, 18, 16, 15, 17, still S2=2.5S^2 = 2.5. Doubling gives 18, 16, 12, 10, 14 with S2=10=22×2.5S^2 = 10 = 2^2 \times 2.5 and S=3.16=2×1.58S = 3.16 = 2 \times 1.58. The same rules hold for a random variable: Rules for the variance.

بە نموونەی 5 بیپشکنە (S2=2.5S^2 = 2.5): زیادکردنی ⁦10⁩ بۆ هەموو نرخێک ⁦19⁩، ⁦18⁩، ⁦16⁩، ⁦15⁩، ⁦17⁩ دەدات، هێشتا S2=2.5S^2 = 2.5. دوو هێندەکردن ⁦18⁩، ⁦16⁩، ⁦12⁩، ⁦10⁩، ⁦14⁩ دەدات بە S2=10=22×2.5S^2 = 10 = 2^2 \times 2.5 و S=3.16=2×1.58S = 3.16 = 2 \times 1.58. هەمان یاسا بۆ ڕاستن: یاساکانی لێکنەچوون.

Bonus marks for the whole classنمرەی زیادە بۆ هەموو پۆلەکە

If the teacher adds 5 bonus marks to every student, everybody moves up together: the mean rises by 5 but the gaps between students stay the same, so σ\sigma does not change. If the teacher doubles every mark, every gap doubles too, so σ\sigma doubles.

ئەگەر مامۆستا 5 نمرەی زیادە بداتە هەموو قوتابییەک، هەموو پێکەوە بەرز دەبنەوە: 5 بەرز دەبێتەوە بەڵام بۆشاییەکانی نێوان قوتابییان وەک خۆیان دەمێننەوە، بۆیە σ\sigma ناگۆڕێت. ئەگەر مامۆستا هەموو نمرەیەک دوو هێندە بکات، هەموو بۆشاییەکیش دوو هێندە دەبێت، بۆیە σ\sigma دوو هێندە دەبێت.

Where the analogy stops workingسنووری ئەم نموونەیە

Real marks have a ceiling (100); bonus marks that push some students past it would squeeze the top and change σ\sigma.

نمرەی ڕاستەقینە سەقفی هەیە ⁦(100)⁩؛ ئەگەر نمرەی زیادە هەندێک قوتابی تێپەڕێنێت، سەرەوە دەپەستێت و σ\sigma دەگۆڕێت.

Quick checkپشکنینی خێراTemperatures have S=2 ∘CS = 2\,^{\circ}\text{C}. In degrees Fahrenheit (F=1.8C+32F = 1.8C + 32), what is S?پلەکانی گەرمی S=2 ∘CS = 2\,^{\circ}\text{C}ـیان هەیە. بە پلەی فەهرەنهایت (F=1.8C+32F = 1.8C + 32)، S چەندە؟

Variance in Pythonلێکنەچوون لە Pythonـدا

Python's statistics module has both versions. The names are easy to mix up: the one with a p (population) divides by N; the one without divides by n−1n - 1.

statistics لە Python هەردوو وەشانەکەی هەیە. ناوەکان ئاسان تێکەڵ دەبن: ئەوەی p ـی هەیە ⁦(population)⁩ دابەشی N دەکات؛ ئەوەی نییەتی دابەشی n−1n - 1 دەکات.

pvariance, variance, pstdev, stdevpvariance، variance، pstdev، stdevvariance.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
import statistics

sample = [9, 8, 6, 5, 7]                      # Example 5
print(statistics.variance(sample))           # s²: divides by n - 1
print(statistics.stdev(sample))              # s
print(statistics.pvariance(sample))          # σ²: divides by N
print(statistics.pstdev(sample))             # σ

# H.W 1: repeat every midpoint F times, then use the same functions
F = [2, 7, 12, 6, 3]
X = [2.5, 7.5, 12.5, 17.5, 22.5]
data = [x for f, x in zip(F, X) for _ in range(f)]
print(len(data), round(statistics.pvariance(data), 3), round(statistics.variance(data), 3))
print(round(statistics.pstdev(data), 3), round(statistics.stdev(data), 3))
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 4-7

Example 5: variance → 2.5 and stdev → 1.581 (sample); pvariance → 2 and pstdev → 1.414 (population).

نموونەی 5: variance ← ⁦2.5⁩ و stdev ← ⁦1.581⁩ ()؛ pvariance ← 2 و pstdev ← ⁦1.414⁩ ().

Lineدێڕی 12

A frequency table becomes a list by repeating each midpoint F times.

دەبێتە بە دووبارەکردنەوەی هەر F جار.

Lineدێڕی 13-14

H.W 1 again: 27.472 and 28.42, 5.241 and 5.331.

دیسان ئەرکی ماڵەوەی ⁦1: 27.472⁩ و ⁦28.42⁩، ⁦5.241⁩ و ⁦5.331⁩.

Quick checkپشکنینی خێراWhich call gives the sample variance s2s^2?کام بانگکردن s2s^2 دەدات؟

Common mistakesهەڵە باوەکان

MistakeهەڵەWhy it is wrongبۆچی هەڵەیەCorrectدروست
Dividing a sample by nدابەشکردنی بە nToo small on averageبە تێکڕا زۆر بچووکەSample: n−1n - 1; population: N: n−1n - 1؛ : N
Forgetting F in ∑F(X−xˉ)2\sum F(X - \bar x)^2لەبیرکردنی F لە ∑F(X−xˉ)2\sum F(X - \bar x)^2Each midpoint stands for F valuesهەر نوێنەری F نرخەMultiply each square by Fهەر دووجایەک لە F لێک بدە
∑F−1\sum F - 1 written as ∑Fi−1\sum F_{i-1}∑F−1\sum F - 1 وەک ∑Fi−1\sum F_{i-1} نووسراوەIt reads as a different sumوەک کۆیەکی تر دەخوێندرێتەوە(∑Fi)−1(\sum F_i) - 1
Squaring the sum instead of summing squaresدووجاکردنی کۆ لە جیاتی کۆکردنەوەی دووجاکان(∑d)2(\sum d)^2 is always 0(∑d)2(\sum d)^2 هەمیشە 0ـەSquare first, then addسەرەتا دووجا بکە، پاشان کۆ بکەرەوە
Reporting the variance as the S.D.ڕاگەیاندنی وەک ⁦S.D⁩Wrong units (cm² instead of cm)یەکەی هەڵە (سم² لە جیاتی سم)Take the square root وەربگرە
Rounding the mean too early زووEvery deviation inherits the errorهەموو هەڵەکە وەردەگرێتKeep 4 decimals, or use the shortcut4 بهێڵەرەوە، یان ڕێگا کورتەکە بەکاربهێنە
Mixing up variance and pvariance in Pythonتێکەڵکردنی variance و pvariance لە PythonThey use different divisorsدابەشکەری جیاوازیان هەیەp = population (divide by N)p واتە (دابەشکردن بە N)
Quick checkپشکنینی خێراA student computes ∑(X−xˉ)=0\sum (X - \bar x) = 0, squares it and gets variance 0 for Example 5. What went wrong?قوتابییەک ∑(X−xˉ)=0\sum (X - \bar x) = 0 دەژمێرێت، دووجای دەکات و بۆ نموونەی 5 0 وەردەگرێت. چی هەڵە بوو؟

Exercisesڕاهێنانەکان

ExerciseڕاهێنانThe spread of the Group B testپەرتبوونی تاقیکردنەوەی گرووپی B

Use the Group B frequency table from the practice lesson (midpoints 9.5, 21.5, …, 81.5; frequencies 4, 8, 14, 8, 8, 4, 4; ∑FX=2107\sum FX = 2107, ∑FX2=108672.5\sum FX^2 = 108672.5). Find σ2\sigma^2, σ\sigma, s2s^2 and s.

گرووپی B لە وانەی ڕاهێنان بەکاربهێنە ( ⁦9.5⁩، ⁦21.5⁩، …، ⁦81.5⁩؛ 4، 8، ⁦14⁩، 8، 8، 4، 4؛ ∑FX=2107\sum FX = 2107، ∑FX2=108672.5\sum FX^2 = 108672.5). σ2\sigma^2، σ\sigma، s2s^2 و s بدۆزەرەوە.

Hintئاماژە

Use the shortcut ∑FX2−(∑FX)2/∑F\sum FX^2 - (\sum FX)^2/\sum F.

ڕێگا کورتەکە بەکاربهێنە: ∑FX2−(∑FX)2/∑F\sum FX^2 - (\sum FX)^2/\sum F.

Show answerوەڵامەکە پیشان بدە
∑F(X−Xˉ)2=108672.5−2107250=108672.5−88788.98=19883.52σ2=19883.52/50=397.67,σ=19.94s2=19883.52/49=405.79,s=20.14\begin{aligned} \sum F(X - \bar X)^2 &= 108672.5 - \frac{2107^2}{50} = 108672.5 - 88788.98 = 19883.52 \\ \sigma^2 &= 19883.52/50 = 397.67, & \sigma &= 19.94 \\ s^2 &= 19883.52/49 = 405.79, & s &= 20.14 \end{aligned}
group_b_spread.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
import statistics

F = [4, 8, 14, 8, 8, 4, 4]                       # Group B frequency table
X = [9.5, 21.5, 33.5, 45.5, 57.5, 69.5, 81.5]    # class midpoints
data = [x for f, x in zip(F, X) for _ in range(f)]

print("population:", round(statistics.pvariance(data), 2), round(statistics.pstdev(data), 2))
print("sample:    ", round(statistics.variance(data), 2), round(statistics.stdev(data), 2))
ExerciseڕاهێنانThe two classes as samplesدوو پۆلەکە وەک نموونە

Suppose classes A (66, 68, 69, 70, 70, 71, 72, 74) and B (45, 52, 60, 70, 75, 82, 88, 88) were random samples from two large schools. Find s for each.

وا دابنێ پۆلەکانی ⁦A (66⁩، ⁦68⁩، ⁦69⁩، ⁦70⁩، ⁦70⁩، ⁦71⁩، ⁦72⁩، ⁦74⁩) و ⁦B (45⁩، ⁦52⁩، ⁦60⁩، ⁦70⁩، ⁦75⁩، ⁦82⁩، ⁦88⁩، ⁦88⁩) لە دوو قوتابخانەی گەورە. s بۆ هەریەکەیان بدۆزەرەوە.

Show answerوەڵامەکە پیشان بدە

Sums of squared deviations: A: 16+4+1+0+0+1+4+16=4216 + 4 + 1 + 0 + 0 + 1 + 4 + 16 = 42; B: 625+324+100+0+25+144+324+324=1866625 + 324 + 100 + 0 + 25 + 144 + 324 + 324 = 1866. Divide by n−1=7n - 1 = 7: sA=42/7=6=2.45s_A = \sqrt{42/7} = \sqrt 6 = 2.45, sB=1866/7=16.33s_B = \sqrt{1866/7} = 16.33 (as populations: 2.29 and 15.27).

کۆی دووجای : A: 16+4+1+0+0+1+4+16=4216 + 4 + 1 + 0 + 0 + 1 + 4 + 16 = 42؛ B: 625+324+100+0+25+144+324+324=1866625 + 324 + 100 + 0 + 25 + 144 + 324 + 324 = 1866. دابەشی n−1=7n - 1 = 7 بکە: sA=42/7=6=2.45s_A = \sqrt{42/7} = \sqrt 6 = 2.45، sB=1866/7=16.33s_B = \sqrt{1866/7} = 16.33 (وەک : ⁦2.29⁩ و ⁦15.27⁩).

ExerciseڕاهێنانUse the propertiesتایبەتمەندییەکان بەکاربهێنە

Example 5 has S=1.581S = 1.581. Every value is multiplied by 10 and then 5 is added (90+590 + 5, 80+580 + 5, …). Without recomputing, what are the new S and S2S^2?

نموونەی 5 S=1.581S = 1.581ی هەیە. هەموو نرخێک لە ⁦10⁩ لێک دەدرێت و پاشان 5ی بۆ زیاد دەکرێت (90+590 + 5، 80+580 + 5، …). بەبێ دووبارە ژماردنەوە، S و S2S^2ـی نوێ چەندن؟

Show answerوەڵامەکە پیشان بدە

Property 3 with k=5k = 5, b=10b = 10: adding 5 changes nothing, multiplying by 10 multiplies S by 10: S=15.81S = 15.81 and S2=102×2.5=250S^2 = 10^2 \times 2.5 = 250.

تایبەتمەندیی 3 بە k=5k = 5، b=10b = 10: زیادکردنی 5 هیچ ناگۆڕێت و لێکدان لە ⁦10⁩، S لە ⁦10⁩ لێک دەدات: S=15.81S = 15.81 و S2=102×2.5=250S^2 = 10^2 \times 2.5 = 250.

ExerciseڕاهێنانWhy not (n−1)(n - 1) for the mean?بۆچی بۆ ناوەند (n−1)(n - 1) نا؟

The sample mean divides by n, but the sample variance by n−1n - 1. Explain the difference in two sentences.

دابەشی n دەکات، بەڵام دابەشی n−1n - 1. جیاوازییەکە بە دوو ڕستە ڕوون بکەرەوە.

Show answerوەڵامەکە پیشان بدە

The mean does not use any estimated quantity, so on average xˉ\bar x already equals μ\mu. The variance measures deviations from xˉ\bar x, which was estimated from the same values and hugs them; dividing by n−1n - 1 makes up for that.

هیچ بڕێکی خەمڵێنراو بەکار ناهێنێت، بۆیە بە تێکڕا xˉ\bar x خۆی یەکسانە بە μ\mu. لە xˉ\bar x دەپێوێت کە لە هەمان نرخەکانەوە خەمڵێنراوە و لێیان نزیکە؛ دابەشکردن بە n−1n - 1 قەرەبووی ئەوە دەکاتەوە.

Summaryپوختە

  • Variance = mean of the squared deviations; standard deviation = its square root (in the data's units).
  • Population: σ2=∑(X−μ)2/N\sigma^2 = \sum (X - \mu)^2 / N. Sample: s2=∑(X−xˉ)2/(n−1)s^2 = \sum (X - \bar x)^2 / (n - 1).
  • Why n−1n - 1: a sample is closer to its own mean than to the true mean; dividing by n would be too small by (n−1)/n(n - 1)/n on average (Bessel's correction, n−1n - 1 degrees of freedom).
  • Grouped: σ2=∑F(X−μ)2/∑F\sigma^2 = \sum F(X - \mu)^2 / \sum F, s2=∑F(X−xˉ)2/(∑F−1)s^2 = \sum F(X - \bar x)^2 / (\sum F - 1).
  • Properties: S≥0S \ge 0; adding a constant changes nothing; multiplying by k multiplies S by ∣k∣|k| and S2S^2 by k2k^2.
  • Results: Example 5 S2=2.5S^2 = 2.5, S=1.581S = 1.581; H.W 1 σ2=27.47\sigma ^2 = 27.47, σ=5.24\sigma = 5.24, s2=28.42s^2 = 28.42, s=5.33s = 5.33.
  • = دووجای ؛ = (بە یەکەی ).
  • : σ2=∑(X−μ)2/N\sigma^2 = \sum (X - \mu)^2 / N. : s2=∑(X−xˉ)2/(n−1)s^2 = \sum (X - \bar x)^2 / (n - 1).
  • بۆچی n−1n - 1: لە خۆی نزیکترە تا لە ڕاستەقینە؛ دابەشکردن بە n بە تێکڕا بە ڕێژەی (n−1)/n(n - 1)/n بچووک دەبێت (، n−1n - 1 ).
  • پۆلێنکراو: σ2=∑F(X−μ)2/∑F\sigma^2 = \sum F(X - \mu)^2 / \sum F، s2=∑F(X−xˉ)2/(∑F−1)s^2 = \sum F(X - \bar x)^2 / (\sum F - 1).
  • تایبەتمەندییەکان: S≥0S \ge 0؛ زیادکردنی هیچ ناگۆڕێت؛ لێکدان لە k، S لە ∣k∣|k| و S2S^2 لە k2k^2 لێک دەدات.
  • ئەنجامەکان: نموونەی 5، S2=2.5S^2 = 2.5، S=1.581S = 1.581؛ ئەرکی ماڵەوەی 1، σ2=27.47\sigma ^2 = 27.47، σ=5.24\sigma = 5.24، s2=28.42s^2 = 28.42، s=5.33s = 5.33.
Review questionsپرسیارەکانی پێداچوونەوە
What is the variance of 4, 4, 4, 4?لێکنەچوونی 4، 4، 4، 4 چەندە؟

0: all values equal the mean, so there is no spread.

0: هەموو نرخەکان یەکسانن بە ، بۆیە هیچ نییە.

Why report the S.D. rather than the variance?بۆچی ⁦S.D⁩ ڕادەگەیەنین نەک لێکنەچوون؟

The S.D. is in the data's units; the variance is in squared units.

⁦S.D⁩ بە یەکەی ؛ بە یەکەی دووجا.

Which Python function divides by N?کام کرداری Python دابەشی N دەکات؟

statistics.pvariance (and pstdev).

statistics.pvariance (و pstdev).

Videoڤیدیۆ

Watch a videoسەیری ڤیدیۆیەک بکە

A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.

Calculating the Mean, Variance and Standard Deviation, Clearly Explained!!!StatQuest with Josh Starmer · Englishئینگلیزی · 640K viewsبینین · 15K likesلایک

Population mean, variance and standard deviation, and how a sample estimates them — dividing by n − 1 for the sample variance.

، و لە ، هەروەها چۆن مەزەندەیان دەکات: بۆ دابەش بە n−1n - 1 دەکەین.

Whole video: population formulas vs sample estimates (n − 1)

هەموو ڤیدیۆکە: بەرامبەر مەزەندەکانی (n−1n - 1).

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

Next lessonوانەی داهاتوو

Coefficient of Variation and Momentsهاوکۆلکەی گۆڕان و مۆمێنتەکان

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.