Excel: overzicht
Microsoft Excel biedt ingebouwde functies voor het berekenen van zowel steekproef- als populatiestandaardafwijking. Deze functies zijn beschikbaar in alle moderne versies van Excel.
Excel-functies
| Functie | Type | Beschrijving |
|---|---|---|
| `STDEV.S()` | Steekproef | Steekproefstandaardafwijking (deelt door n-1) |
| `STDEV.P()` | Populatie | Populatiestandaardafwijking (deelt door N) |
| `STDEV()` | Steekproef | Verouderde functie, gelijk aan STDEV.S |
| `STDEVP()` | Populatie | Verouderde functie, gelijk aan STDEV.P |
Excel-voorbeelden
Excel Formulas
// Data in cells A1:A10
=STDEV.S(A1:A10) // Sample SD
=STDEV.P(A1:A10) // Population SD
// For specific values
=STDEV.S(4, 8, 6, 5, 3) // Returns 1.924
// Ignoring text and logical values
=STDEV.S(A1:A10) // Ignores text
=STDEVA(A1:A10) // Includes text as 0Tip
Gebruik STDEV.S voor de meeste praktijkanalyses. Gebruik STDEV.P alleen wanneer u zeker weet dat u de volledige populatie heeft.
Python: overzicht
Python biedt meerdere manieren om standaardafwijking te berekenen. De meest gebruikte bibliotheken zijn NumPy, Pandas en de ingebouwde statistics-module.
NumPy gebruiken
Python (NumPy)
import numpy as np
data = [4, 8, 6, 5, 3]
# Population standard deviation (default)
pop_sd = np.std(data)
print(f"Population SD: {pop_sd}") # 1.720
# Sample standard deviation
sample_sd = np.std(data, ddof=1)
print(f"Sample SD: {sample_sd}") # 1.924Wat is ddof?
ddof staat voor “Delta Degrees of Freedom” (delta vrijheidsgraden). Door ddof=1 in te stellen, deelt NumPy door (n-1) voor steekproef-SD. De standaardwaarde ddof=0 geeft populatie-SD.
Pandas gebruiken
Python (Pandas)
import pandas as pd
# Create a DataFrame
df = pd.DataFrame({'scores': [85, 90, 78, 92, 88]})
# Sample SD (default in pandas)
sample_sd = df['scores'].std()
print(f"Sample SD: {sample_sd}")
# Population SD
pop_sd = df['scores'].std(ddof=0)
print(f"Population SD: {pop_sd}")
# Multiple columns at once
df.std() # Returns SD for all numeric columnsSnelle vergelijking
| Tool | Steekproef-SD | Populatie-SD |
|---|---|---|
| Excel | `STDEV.S()` | `STDEV.P()` |
| NumPy | `np.std(data, ddof=1)` | `np.std(data)` |
| Pandas | `df.std()` | `df.std(ddof=0)` |
| Python statistics | `stdev()` | `pstdev()` |