p 值與係數
你可以在已擬合的 smf.ols 迴歸模型上使用 .pvalues 屬性,取得各個係數的 p 值。
一般而言,p 值小於 0.05 被視為具統計上顯著。
可以用 .params 屬性,從已擬合的迴歸物件中擷取係數。
在這個例子中,若 SMB('Small Minus Big')係數為統計上顯著且為負,代表對大型股有因子曝險;若係數為正,則代表對小型股有曝險。
你在上一個練習中建立的已擬合迴歸模型 FamaFrench_fit 已經在你的工作環境中可用。
本練習屬於課程
Python 投資組合風險管理入門
練習說明
- 擷取「'SMB'」的 p 值。
- 擷取「'SMB'」的迴歸係數。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Extract the p-value of the SMB factor
smb_pval = FamaFrench_fit.____
# If the p-value is significant, print significant
if smb_pval < 0.05:
significant_msg = 'significant'
else:
significant_msg = 'not significant'
# Print the SMB coefficient
smb_coeff = FamaFrench_fit.____
print("The SMB coefficient is ", smb_coeff, " and is ", significant_msg)