Skip to menu

matching을 하려고 합니다.

권혜미 2016.12.02 17:45 Views : 427

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
1133 logistic regression [1] qubic 2020.02.11
1132 Propensity-Score Matching에서 오류 메세지 [2] begabung 2016.09.22
1131 정회원 로그인이 안됩니다 [1] jaljary 2019.07.05
1130 R 데이터를 CSV저장시 오류에 대한 질문입니다. [2] 뽀오또 2021.04.01
1129 웹 3.0 에서 survival 분석 할때 자꾸 server 에러나는경우 [1] file 김날 2017.04.18
1128 에러가 났는데 어떻게 해야 하나요? [1] 세렌 2022.01.21
1127 0이 많은 자료에 대해 [1] file wjdEoddl 2018.02.05
1126 R studio에서 data import 관련하여 문의드립니다. Jun 2018.10.04
1125 그래프 그리기에 대한 질문입니다. [2] file 난둥 2016.03.18
1124 Wilcoxon test 정확한 p 값을 계산할 수 없습니다. 버블 2021.05.15
1123 PSM (propensity score matching) 결과 해석 관련 질문 드립니다. nsstp 2020.05.18
1122 다항 로지스틱 회귀분석 VL 2018.02.23
1121 Propensity score matching 에 대해 질문드립니다 교수님 [2] 우루루루 2018.03.25
1120 생존나무 분석 [1] 미래소년코난 2016.10.13
1119 한국행정지도(2014) 패키지 kormaps2014 문의 [5] 고대유물 2018.09.07
1118 shiny 한글 문제 문의드립니다. [3] suny 2018.06.07
1117 cox 와 kaplan 분석 시 결과해석 문의드립니다. [2] 또니 2018.04.30
1116 향후 5년간 핵심 화두가 Cognitive Business가 될 것 같아 먼저 여기에 글을 올립니다. [2] file Ben 2015.10.14
1115 질문있습니다!! 텍스트마이닝.. [1] 통계왕 2017.04.03
1114 교수님 univariate, multivariate analysis 관련하여 질문드립니다. [2] 우루루루 2018.07.03