Excel: Pangkalahatang-tanaw
Nagbibigay ang Microsoft Excel ng mga built-in na function para sa pagkalkula ng parehong sample at population standard deviation. Available ang mga function na ito sa lahat ng modernong bersyon ng Excel.
Mga Function ng Excel
| Function | Uri | Paglalarawan |
|---|---|---|
| `STDEV.S()` | Sample | Sample standard deviation (hinahati sa n-1) |
| `STDEV.P()` | Population | Population standard deviation (hinahati sa N) |
| `STDEV()` | Sample | Legacy function, katulad ng STDEV.S |
| `STDEVP()` | Population | Legacy function, katulad ng STDEV.P |
Mga Halimbawa sa Excel
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 0Pro Tip
Gamitin ang STDEV.S para sa karamihang real-world na pagsusuri. Gamitin lang ang STDEV.P kapag sigurado kang mayroon kang kumpletong population.
Python: Pangkalahatang-tanaw
Nag-aalok ang Python ng maraming paraan para kalkulahin ang standard deviation. Ang mga pinakakaraniwang library ay ang NumPy, Pandas, at ang built-in na statistics module.
Paggamit ng NumPy
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.924Ano ang ddof?
Ang ddof ay nangangahulugang “Delta Degrees of Freedom”. Ang pagtatakda ng ddof=1 ay nagsasabi sa NumPy na maghati sa (n-1) para sa sample SD. Ang default na ddof=0 ay nagbibigay ng population SD.
Paggamit ng Pandas
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 columnsMabilisang Paghahambing
| Tool | Sample SD | Population 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()` |