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
1093 Box plot 그리프 설정에 관해 문의합니다. papahong 2022.06.20
1092 cluster data 의 risk difference 에 대해 여쭙고자 합니다. lagrima 2022.06.19
1091 Pair plot을 할 경우 [1] PipeDragoN 2022.06.13
1090 PSM에서 matching 버튼 위치 문의 통계어려워 2022.06.13
1089 PSM (4그룹) 관련 문의드립니다. emksh77 2022.06.08
1088 정회원후원하였습니다. [1] secret rosemary 2022.06.08
1087 PSM 문의 [2] secret sfumatoi 2022.06.07
1086 multipleROC 패키지에서 multivariable의 cutoff 구하기 file 찬쓰 2022.06.07
1085 survival analysis관련 문의 드립니다 [1] cebukim 2022.06.04
1084 autoReg 설치 관련 오류 [5] 닥터강 2022.05.24
1083 survival tree (RPA) 분석 관련 문의 드립니다. [2] 곰곰11 2022.05.23
1082 통계 질문입니다. [1] file 봄봄봄 2022.05.23
1081 데이터 불러오기 문제 [3] strat 2022.04.25
1080 r프로그래밍 문자는 factor로 읽을 수 없나요? [1] file 채채채추ㅐㅊ채야채 2022.04.21
1079 R 코드와 관련하여 문의 드려도 될까요..? [5] file 꾸이뭉 2022.04.19
1078 R 업데이트 후 mytable 함수 에러가 있습니다. [1] 카이토르 2022.04.18
1077 Survival curve 에서 cumulative incidence % 로 표현 가능할까요 [1] nyknicks 2022.04.16
1076 multiple logistic regression test에서 설명변수 선택에 대해 여쭙습니다. [2] file kms9057 2022.04.16
1075 PSM 문의 드립니다 [1] caesar 2022.04.07
1074 Survival regression에서 Survival probability 그래프에서 회색음영이 무엇인지요? [2] file 케로스 2022.03.24