[통계] 12-1. 회귀분석을 하기 위한 준비

Yewon Kim·2020년 7월 31일
0

Quantative Trading

목록 보기
2/9

🏃‍♀️내 데이터가 stationary한가?

  • 내 데이터의 평균, 분산, 공분산이 시간이 지나도 일정한가?
    = 내 데이터가 정상 확률 과정(stationary process)을 따르는가?

보통최소제곱법 OLS의 7대 전제

  1. The regression model is linear in the coefficients and the error term
  2. The error term has a population mean of zero
  3. All independent variables are uncorrelated with the error term
  4. Observations of the error term are uncorrelated with each other
  5. The error term has a constant variance
  6. No independent variable is a perfect linear function of other explanatory variables
  7. The error term is normally distributed (optional)

이분산성 문제(Heteroscedasticity)

  • 5번 전제를 만족시키지 못했을 때 발생하는 문제

브루쉬 파간 검정 (Breusch-Pagan test, BP 검정)

  • p-value ≥ 0.05 ⇒ 동분산성 Homoskedasticity
  • p-value < 0.05 ⇒ 이분산성 Heteroskedasticity

다중공선성 문제(Multicollinearity)

  • 6번 전제를 만족시키지 못했을 때 발생하는 문제

💫비정상 확률 과정을 정상 확률 과정으로 변환하기

  1. 차분 (differencing)
  2. 로그(logarithm) 변환
  3. Box-Cox 변환

차분 (differencing)

  • 기존 데이터에서 shift된 데이터 값을 빼는 방법

로그(logarithm) 변환

  • 분산이 자료의 크기에 정비례하여 증가하거나 지수함수적으로 증가할 경우
  • 로그 변환한 결과로 나온 확률 과정의 분산은 일정

✨Box-Cox 변환✨

  • 비정상 과정 데이터를 정규분포/동분산성을 따르게 변환하는 대표적인 방법
    y(λ)=T(x)={xλ1λ (λ0)lnx (λ=0)y^{(\lambda)} = T(x) = \left \{ \begin{array}{cc} \frac{x^{\lambda}-1}{\lambda}\ (\lambda \neq 0)\\ \ln{x}\ (\lambda = 0) \end{array} \right.
  • 가장 정규성을 높여주는 λ\lambda 값을 찾는다.
# scipy 패키지 boxcox 명령 
transformed_df, lambda = scipy.stats.boxcox(df.data_name)

📚References

profile
산업의 안팎에서 투자의 원칙을 배우고 싶은 학생입니다.

0개의 댓글