시작하기무료로 시작하기

정규성 검정

여러 가지 일반적인 가설 검정을 포함한 강력한 통계 도구 모음은 데이터가 정규 분포를 따른다는 가정에 의존합니다. 히스토그램은 데이터가 대략 정규 분포인지 가늠하게 해 주지만, 다양한 가설 검정을 통해 이 가정을 직접 검증할 수 있습니다. 또한 표본 크기가 작을수록 히스토그램은 구간(bin) 개수에 매우 민감합니다.

이 연습 문제에서는 salary_df에 담긴 오스틴 시 직원의 급여 데이터를 사용합니다. 특히 히스패닉 소방관을 대상으로 합니다. Anderson-Darling 가설 검정을 사용해 이들의 재직 연수가 대략 정규 분포를 따르는지 분석해 보세요.

이 연습은 강의의 일부입니다

Python에서 배우는 추론 통계 기초

강의 보기

연습 안내

  • 직원들의 Years of Employment에 대한 히스토그램을 그리세요.
  • Years of Employment가 대략 정규 분포인지 확인하기 위해 Anderson-Darling 정규성 검정을 수행하세요.
  • 검정 statistic이 어떤 critical_values보다 큰지 찾으세요.
  • 귀무가설이 기각되는 significance_level을 출력하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Plot a histogram of the employees' "Years of Employment"
____.plot(kind="____")
plt.show()

# Conduct an Anderson-Darling test using the years of employment from salary_df
result = stats.____(____)

# Print which critical values the test statistic is greater than the critical values
print(result.____ > result.____)

# Print the significance levels at which the null hypothesis is rejected
print(result.____[result.____ > result.____])
코드 편집 및 실행