Data Science/개념과 용어

Trend, Pattern, and The Correlation Coefficient (r)

Chan Lee 2024. 11. 15. 07:34

When there are two numerical variables, there are 

 

Trend

  • Positive association
  • Negative association

 

Pattern

  • Any discernible "shape" in the scatter
  • Linear 
  • Non-linear

 

Visualize, then quantify 

 

The Correlation Coefficient r

Measures linear association. 

It is based on the standard units.

range of r
Scatter Plots of different r values

 

r is defined as:

The average of product of (x in standard units) and (y in standard units) 

표준 단위 x와 표준 단위 y의 곱의 평균 

 

In Python, we can write as: 

 

 

정확하게 y = x^2 그래프의 값을 가지는 x와 y의 상관계수는 몇일까요? 

x의 값을 알면 y는 정확하게 x^2이기 때문에 완벽하게 y값을 예측할 수 있습니다.

이런 경우에 Correlation Coefficient = 0 입니다. 

왜냐하면 상기 서술하였듯 r value는 linear correlation을 설명하는 값이기 때문입니다. 

 

이 값들을 하나의 직선으로 설명할 수 없다는 점을 이해하면 이러한 차이점을 이해할 수 있습니다. 

몇가지 추가 값 예시들을 보여드리고 마무리하겠습니다.

 

Data With an Outlier
Data w/o an Outlier
example data