본문 바로가기
Main/통계

[통계] 올바른 상관분석 고르기 (pearson, spearman, Kendall, etc)

by research_notes 2024. 5. 16.
728x90
반응형
반응형

 

Choosing the Best Correlation Test

논문을 읽다보면 수많은 통계 방법들이 나와서 종종 멘붕에 빠질 때도 많고,

연구 초반에는 무적의 cor.test() 코드를 사용해 상관분석을 진행했다가,

올바른 분석 방법을 사용하지 않았다는 지적을 받고 분석을 처음부터 다시 시작해야 하는 실수를 하기도 했음... 

이 세상에 상관분석이 딱 하나만 존재한다면 얼마나 좋았을까

 


1. 상관분석 이해하기 (Understanding Correlation Analysis)

* 개념 (Concept)

- 상관분석은 두 변수 간의 관계의 강도방향을 측정하는 통계적 방법 (a statistical method used to assess the strength and direction of the relationship between two variables).

- 변수들 사이의 연관성을 파악, 한 변수가 증가하면 다른 한 변수도 선형적으로 증가 혹은 감소하는지를 나타냄 (identify the association between variables, determining determine whether changes in one variable predict changes in another).

- ex) 키가 증가할수록 몸무게가 증가하는가 => positive correlation between height and weight

- 두 변수 사이에 선형적 관계가 인과관계를 뜻하지는 않음 (important to note that the presence of a linear relationship between variables does not imply causation).

 

 

 

* 상관계수 (Correlation Coefficient)

- 상관분석에서 두 변수 간의 선형적 관계의 강도와 방향을 수치적으로 나타내는 통계적 지표로 -1에서 +1 사이의 값을 지님 (a number between  -1 and +1 that tells you the strength and direction of a relationship between variables).

- 상관계수의 절대값이 클수록 두 변수 간의 상관 관계가 강하다는 것을 의미하며, 부호는 그 관계의 방향을 의미함 (The closer the absolute value of the coefficient is to 1, the stronger the correlation between the variables, and the sign of the coefficient indicates the direction of the relationship).

 

 

 

* 가정 (Assumptions of Correlation Analysis)

  1. 선형성 (Linearity)
  2. 등분산성 (Homoscedasticity)
  3. 정규성 (Normality)
  4. 독립성 (Independence)

(상관분석 기본개념은 아래 링크 참고)

2022.07.20 - [Main/통계] - 상관분석 (Correlation Analysis) #1 Correlation Coefficient

 

상관분석 (Correlation Analysis) #1 Correlation Coefficient

1. Correlation (상관관계) : 한 변수가 다른 변수와 동시에 움직이는 정도를 나타내는 통계적 지수 (a statistical term describing the degree to which two variables move in coordination with one another) - 두 변수 간 직선관

kimtutor.tistory.com


2. 상관계수 종류 (Types of Correlation Coefficients)

 

* 상관계수를 계산하는 방법은 여러가지가 있으며, 상황에 따라 적절한 방법을 선택해야함 (

There are several methods to calculate correlation coefficients, and the appropriate method should be chosen based on the specific circumstances)

  • Data type (continuous vs categorical)
  • Relationship type (linear vs nonlinear)
  • Data distribution (parametric vs nonparametric)

출처: https://www.scribbr.co.uk/stats/correlation-coefficient-meaning/

* 연속형 vs 연속형

1) 피어슨 상관계수 (Pearson'r == Pearson product-moment correlation coefficient)

 

  • Linear =>  두 연속 변수 간의 선형 관계를 측정. 즉, 데이터가 직선으로 얼마나 잘 설명되는지를 측정 (measures the linear relationship between two continuous variables; how well a straight line can describe the scatter plot of the data)
  • Continuous => 연속형 변수 외에도 등간/간격척도나 비례척도에서도 사용됨 (Both variables are on an interval or ratio level of measurement).
  • Parmetric => 두 변수가 정규분포를 따라야 함 (Data from both variables follow normal distributions)
    • 모수적 검정이기 때문에 높은 검정력을 가짐. 따라서 유의한 효과를 검출할 확률이 높음 (parametric test -> high power)
  • Research Question Examples 
    • 나이와 키 사이에 유의미한 관계가 있습니까? (Is there a relationship between age and height?)
    • 기온과 아이스크림 판매량 사이에 관계가 있습니까? (Is there a relationship between temperature and ice cream sales?)
    • 직무 만족도와 소득 사이에 관계가 있습니까? (Is there a relationship between job satisfaction and income?)

 

 [출처] https://jukebox.esc13.net/interactiveGlossary/HTML_files/linearRelationships.html

 

 

 

2) Spearman's rho

  • Non-linear => 단조 관계(한 변수가 증가할 때 다른 변수도 일관되게 증가하거나 감소하는 관계)를 측정하는 데 적합 (Suitable for measuring monotonic relationships, where one variable consistently increases or decreases as another variable increases)
  • Continuous (rank) => 두 변수를 순위로 변환한 후,  순위들 사이의 상관 관계를 측정하기 때문에 연속형 변수가 아닌 순서형 변수에서도 사용 가능 (By converting two variables into ranks, this method measures the correlation between the ranks, making it applicable not only to continuous variables but also to ordinal variables)
  • Non-parametric => 데이터가 비모수적이거나 정규 분포를 따르지 않을 때 사용 (When the data are non-parametric or do not follow a normal distribution.)
  • Research Question Examples 
    • 참가자의 교육 수준(고등학교, 학사, 석사 학위)과 그들의 시작 급여 사이에 통계적으로 유의미한 관계가 있습니까? (Is there a statistically significant relationship between participants’ level of education (high school, bachelor’s, or graduate degree) and their starting salary?)
    • 경주에서 말의 도착 순위와 말의 나이 사이에 통계적으로 유의미한 관계가 있습니까? (Is there a statistically significant relationship between horse’s finishing position a race and horse’s age?)

[출처] https://www.simplilearn.com/tutorials/statistics-tutorial/spearmans-rank-correlation

 

 

3) Kendall's tau

 

  • 스피어만과 순위(rank)를 다룬다는데에서는  유사하지만, 데이터 쌍 사이의 동조 및 반동조 관계를 평가하여 계산 (similar to Spearman, but based on the number of concordant and discordant pairs of observations, that is, pairs that agree or disagree in their relative order)
    • 동조 (Concordant pairs): 두 변수가 같은 방향으로 움직이는 것. 즉, 두 변수의 순위가 서로 일관되게 증가하거나 감소하는 관계 (if both members of one observation are larger than their respective members of the other observations)
    • 반동조 (Discordant pairs): 두 변수가 반대 방향으로 움직이는 경우. 즉, 한 변수의 순위가 증가하는 동안 다른 변수의 순위는 감소할 때 (if the two numbers in one observation differ in opposite directions)
  • 특히 샘플 크기가 작을 때 유용하며, 순위 데이터에 적합

 

* 연속형 vs 범주형

 

1) Point-Biserial r

2) Biserial Correlation

3) Polyserial Correlation

* 범주형 vs 범주형

1) Phi Coefficient

2) Cramer's V

 


3. How to Choose

 

 

[출처] https://www.originlab.com/doc/Origin-Help/Correlation-Coefficient

 

Selecting the right correlation test depends on the data type and distribution.

 

Choosing the best correlation coefficient for your data depends on several factors, such as the type, level, and distribution of your variables

 

 

728x90
반응형