p-values and coefficients
You can use the .pvalues
attribute on a fitted smf.ols
regression model to retrieve the p-values for each coefficient.
Normally, p-values less than 0.05 are considered statistically significant.
Coefficients can be extracted from the fitted regression object using the .params
attribute.
In this example, a statistically significant negative SMB ('Small Minus Big') coefficient would signify a factor exposure to large cap stocks, while a positive coefficient would signify an exposure to small cap stocks.
The fitted regression model FamaFrench_fit
from the previous exercise is available in your workspace.
This is a part of the course
“Introduction to Portfolio Risk Management in Python”
Exercise instructions
- Extract the p-value for
'SMB'
. - Extract the regression coefficient for
'SMB'
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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)
This exercise is part of the course
Introduction to Portfolio Risk Management in Python
Evaluate portfolio risk and returns, construct market-cap weighted equity portfolios and learn how to forecast and hedge market risk via scenario generation.
Learn about the main factors that influence the returns of your portfolios and how to quantify your portfolio's exposure to these factors.
Exercise 1: The Capital Asset Pricing modelExercise 2: Excess returnsExercise 3: Calculating beta using co-varianceExercise 4: Calculating beta with CAPMExercise 5: Adjusted R-squaredExercise 6: Alpha and multi-factor modelsExercise 7: The Fama French 3-factor modelExercise 8: p-values and coefficientsExercise 9: Economic intuition in factor modelingExercise 10: The efficient market and alphaExercise 11: Expanding the 3-factor modelExercise 12: The 5-factor modelExercise 13: Alpha vs R-squaredWhat is DataCamp?
Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.