반응형


Matching 데이터의 예


Matching이란 case의 control에서 혼란변수의 분포를 맞추어주는 방법으로 데이터셋을 구성할 때 자주 쓰이는 방식입니다. 이는 confounding을 방지하는 방법으로 알려져 있습니다. 이번엔 Matching 데이터를 분석할 때 매우 자주 쓰이는 Conditional Logistic Regression에 대해 아주 간단히 알아보겠습니다. R에서 먼저 사용할 데이터셋을 임포트합니다. 종속변수는 d이며, 이진변수입니다. 그래서 logistic regression으로 연관성 분석을 할 수 있는데요.


library(Epi)

data(bdendo)


setdgallhypobestdurnondurationagecestagegrpage3
11.001.00NoNoYesYes4Yes96.0074.00370-7465-74
21.000.00NoNoNo0No0.0075.00070-7465-74
31.000.00NoNoNo0No0.0074.00070-7465-74
41.000.00NoNoNo0No0.0074.00070-7465-74
51.000.00NoNoYesYes3Yes48.0075.00170-7465-74
62.001.00NoNoNoYes4Yes96.0067.00365-6965-74
72.000.00NoNoNoYes1No5.0067.00365-6965-74
82.000.00NoYesYesNo0Yes0.0067.00065-6965-74
92.000.00NoNoNoYes3No53.0067.00265-6965-74
102.000.00NoNoNoYes2Yes45.0068.00265-6965-74
113.001.00NoYesYesYes1Yes9.0076.00175-7975+
123.000.00NoYesYesYes4Yes96.0076.00275-7975+
133.000.00NoYesNoYes1Yes3.0076.00175-7975+
143.000.00NoYesYesYes2Yes15.0076.00275-7975+
153.000.00NoNoNoYes2Yes36.0077.00175-7975+


데이터셋의 대한 설명은 help(bdendo)를 입력하면 나오고, 아래를 참고 바랍니다.

 

Format


This data frame contains the following columns:


set: Case-control set: a numeric vector

d: Case or control: a numeric vector (1=case, 0=control)

gall: Gall bladder disease: a factor with levels No Yes.

hyp: Hypertension: a factor with levels No Yes.

ob: Obesity: a factor with levels No Yes.

est: A factor with levels No Yes.

dur: Duration of conjugated oestrogen therapy: an ordered factor with levels 0 < 1 < 2 < 3 < 4.

non: Use of non oestrogen drugs: a factor with levels No Yes.

duration: Months of oestrogen therapy: a numeric vector.

age: A numeric vector.

cest: Conjugated oestrogen dose: an ordered factor with levels 0 < 1 < 2 < 3.

agegrp: A factor with levels 55-59 60-64 65-69 70-74 75-79 80-84

age3: a factor with levels <64 65-74 75+


하지만 Matching 데이터에 일반적인 Unconditional Logistic regression을 쓰면 bias가 생깁니다. 왜냐하면 Matching을 하면서 가져온 데이터에는 데이터 고유의 특성이 있기 때문입니다. 예를 들어서 time matching을 한 경우에, 비슷한 시기의 데이터를 샘플링을해서 하나의 strata를 만들고 데이터셋을 구성하게 됩니다. 그러면 이 시기에 의한 효과가 추정량에 영향을 주게 됩니다. 따라서 conditional logistic regression 이라는 조금 더 개선된 logistic regression 방법을 사용하여야합니다. (수학적인 설명은 생략하겠습니다..)


## Analysis

res.clogistic <- clogistic(d ~ cest + dur, strata = set, data = bdendo)


R로 conditional logistic regression(clr)을 하는 방법은 간단한 데 Epi 패키지의 clogistic을 활용하면 됩니다.  분석하고자 하는 공변량을 ~ 뒤에 넣고, strata에 matching pair를 나타내는 변수값을 입력합니다. 이 데이터의 경우, set 이라는 변수가 strata의 정보를 갖고 있습니다. 총 5개의 row가 같은 strata임을 알 수 있습니다. 


결과를 돌리면 다음과 같이 나오는 것을 확인할 수 있습니다.


res.clogistic


Call: 

clogistic(formula = d ~ cest + dur, strata = set, data = bdendo)


         coef exp(coef) se(coef)      z    p

cest.L  0.240     1.271    2.276  0.105 0.92

cest.Q  0.890     2.435    1.812  0.491 0.62

cest.C  0.113     1.120    0.891  0.127 0.90

dur.L   1.965     7.134    2.222  0.884 0.38

dur.Q  -0.716     0.489    1.858 -0.385 0.70

dur.C   0.136     1.146    1.168  0.117 0.91

dur^4      NA        NA    0.000     NA   NA


Likelihood ratio test=35.3  on 6 df, p=3.8e-06, n=254


association을 알아보기 위한 변수 cest, dur의 추정량을 볼 수 있습니다. 



반응형
반응형