開始使用免費開始

母體參數的估計

想像有一個繞行一整年的衛星「母體」,我們以公里為單位,量測每小時的行進距離。由於軌道動力學中存在未知的複雜因素,每小時量得的距離會有變動。假設我們無法量完一整年的所有資料,但希望根據一個測量樣本,建立每小時軌道距離變動(速度)的母體模型。

在這個練習中,你將假設每小時距離的母體最適合用高斯分佈建模,並進一步假設此母體模型的參數可以由樣本統計量來估計。從已預先載入、取自衛星母體的 sample_distances 開始。

本練習屬於課程

Python 線性建模入門

檢視課程

練習說明

  • 計算 sample_distances 的平均與標準差。
  • 使用樣本統計量 meanstdev 作為母體模型參數 musigma 的良好估計值。
  • 將這些數值與 sample_distances 傳入預先定義的 gaussian_model(),以建立母體模型。
  • 使用預先定義的 plot_model_and_data(),將樣本資料與母體模型一起繪圖。

動手互動練習

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

# Compute the mean and standard deviation of the sample_distances
sample_mean = np.mean(____)
sample_stdev = np.std(____)

# Use the sample mean and stdev as estimates of the population model parameters mu and sigma
population_model = gaussian_model(____, mu=____, sigma=____)

# Plot the model and data to see how they compare
fig = plot_data_and_model(sample_distances, population_model)
編輯並執行程式碼