Skip to menu

matching을 하려고 합니다.

권혜미 2016.12.02 17:45 Views : 428

Rstudio을 사용하여 matching을 진행하려고 했습니다..



## Propensity score estimation (pscore object returned)
dat.nonrandom <- pscore(formula     = Alc ~ Age + Sex_F0M1 + R_BMI 
                        data        = dat,
                        family      = "binomial",
                        name.pscore = "ps")



## Actual Propensity score matching
res.ps.match <- ps.match(object             = dat.nonrandom,
                         control.matched.by = matched.by,
                         who.treated        = 1,                # value 1 is treated
                         name.match.index   = "match.index",
                         ratio              = 1,              
                         caliper            = "logit",
                         x                  = 0.2,
                         givenTmatchingC    = TRUE,
                         bestmatch.first    = TRUE,
                         setseed            = FALSE,
                         combine.output     = TRUE)
res.ps.match





res.ps.match를 시행하여보면

Matching data:
                                        
Number of treated obs.:              260
Number of matched treated obs.:      260
Number of untreated obs.:           1061
Number of matched untreated obs.:    260
Number of total matched obs.:        520
Number of not matched obs.:          801
Number of matching sets:             260
Number of incomplete matching sets:    0

이러한 결과가 나오는데

## Extract matched data
defMatched <-dat[unlist(res.ps.match[c("match.index","control.index")]), ]
## Construct a table
tabMatched <- CreateTableOne(vars = vars, factorVars = catvars, strata = "Alc", data = defMatched, test = TRUE)
## Show table with SMD
print(tabMatched, smd = TRUE, test=TRUE)

하면

                                       0                1                p      test SMD   
  n                                          434               86                            


로 treated 군이 86명으로 나옵니다ㅠ


저는 어디서 잘못된건지 모르겠습니다.ㅠ

위에 결과보면 260씩 매칭이된거 같은데- matched set을 만들때 잘못된건지 모르겠습니다....


저의 작은 지식으로는 이해가 안됩니다.ㅠ

조언부탁드립니다ㅜㅜ 감사합니다.


No. Subject Author Date
1134 교수님 일전에 메타분석 문의드렸던 사람입니다 [2] 카우보이 2016.04.13
1133 접속오류 [1] secret 김승욱 2016.04.18
1132 메타분석에서 설명변수와 조절변수 차이 문의 file 딩크형 2016.04.19
1131 정규성 검정에 대해서 여쭤봅니다. [2] file R까기 2016.04.22
1130 데이타 업로드후 작업이 안됩니다. T.T [1] 유로정 2016.04.22
1129 회기분석 결과를 통해 HR 표기하기 [2] file arranger 2016.04.24
1128 csv파일 업로드 안되는 문제 [2] file 신돌석 2016.04.25
1127 예제 데이터 열 제목 편집방법 [2] 신돌석 2016.04.25
1126 Survival 분석에서 cumulative proportion과 95% CI [2] namuhanayeyo 2016.04.26
1125 R과 SPSS에서 시행한 logistic regression값은 거의 일치하는데, Web-R에서 돌린 것은 일치하지가 않습니다. [2] file namuhanayeyo 2016.04.27
1124 2 X 2 table에서 categorical variable을 비교한 P 값 [2] namuhanayeyo 2016.05.01
1123 [비교통계] 결과가 나오도록 하는 방법 [3] 신돌석 2016.05.01
1122 생존분석에 대해서 문의드립니다. [1] 유로정 2016.05.03
1121 메타분석에서 forest plot 크기 [1] file SumiHan 2016.05.04
1120 한 발 앞서 배워보는 Xamarin! cardiomoon 2016.05.09
1119 RStudio 문의 드립니다. [1] secret nipponica 2016.05.09
1118 메타분석 forest plot [2] secret SumiHan 2016.05.11
1117 ggplot2 와 web-r 의 plot 의 색 채우기 문의 [2] 화모기 2016.05.13
1116 반복측정자료의 분석 [2] file arranger 2016.05.14
1115 생존분석 질문입니다 [3] 난둥 2016.05.24