開始使用免費開始

平均數、偏差與標準差

平均數描述資料的中心位置;標準差描述資料的分散程度。不過,當要比較兩個變數時,把兩者都標準化會更方便。在本練習中,已提供兩個高度相關的資料陣列,你將計算並視覺化各自的標準化偏差。

本練習屬於課程

Python 線性建模入門

檢視課程

練習說明

  • 計算偏差 dxdy
  • 計算標準化偏差 zxzy
  • 呼叫 plot_cdfs(),比較原始資料與標準化後資料的差異。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Compute the deviations by subtracting the mean offset
dx = x - np.____(x)
dy = y - np.____(y)

# Normalize the data by dividing the deviations by the standard deviation
zx = dx / np.____(x)
zy = dy / np.____(y)

# Plot comparisons of the raw data and the normalized data
fig = plot_cdfs(dx, dy, zx, zy)
編輯並執行程式碼