이해하기 쉬운 계수로 상호작용 다루기
이전의 상호작용 항을 포함한 모델은 계수를 해석하기가 조금 까다로웠습니다. 모델이 무엇을 예측하는지 더 명확히 하려면, 이해하기 쉬운 계수를 반환하도록 모델을 다시 구성할 수 있습니다. 추가로, 각 주택 연식 범주에 대해 적합한 모델(mdl_0_to_15, mdl_15_to_30, mdl_30_to_45) 결과와 비교해 보세요.
taiwan_real_estate, mdl_0_to_15, mdl_15_to_30, mdl_30_to_45가 제공됩니다.
이 연습은 강의의 일부입니다
Python의 statsmodels로 배우는 중급 회귀
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Model price vs. house age plus an interaction, no intercept
mdl_readable_inter = ____
# Print the coefficients for mdl_0_to_15
print("mdl_0_to_15 coefficients:", "\n", ____)
# Print the coefficients for mdl_15_to_30
print("mdl_15_to_30 coefficients:", "\n", ____)
# Print the coefficients for mdl_30_to_45
print("mdl_30_to_45 coefficients:", "\n", ____)
# Print the coefficients for mdl_readable_inter
print("\n", "mdl_readable_inter coefficients:", "\n", mdl_readable_inter.params)