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
834 회귀모형 자동해석 cardiomoon 2020.03.08
833 샤이니 앱에서 SQL 명령어 사용 방법 [2] 김브링이 2015.05.06
832 설명 변수 고르기에 대해서.. [2] 짱이야 2018.05.25
831 ROC 커브에 대한 다른 질문입니다. [1] file Victo 2016.01.15
830 ROC 커브 분석에 대하여 문의 드립니다. [1] DOC 2020.10.23
829 케이스 선택에 관하여 질문이 있습니다.. [1] selteen 2017.05.02
828 교수님, 메타분석에 대한 질문 몇가지 올립니다. SOL 2017.10.26
827 Web으로 하는 R meta 서비스는 더 이상 안하는 건가요? [1] 묵사마 2020.04.09
826 Box plot 그래프를 그리고 싶은데요. [2] file 알은어려워 2018.12.25
825 SEM에서 path analysis후 moderation effect보는 과정에 대해 여쭙습니다. [2] fascinate23 2018.01.26
824 안녕하세요 교수님. PSM 2:1 matching 방법 질문드립니다.. [7] 깔끔한성격 2020.09.23
823 교수님, 맥에서 R studio 설치해서 엑셀을 불러오는데 어려움이 있습니다. [1] hslee0511 2022.01.12
822 heatmap [2] zkbi 2020.05.26
821 PSM의 matching 방법 기술에 대한 질문입니다. [1] ng2o321 2020.12.01
820 성향점수분석에서 caliper 설정 [1] alse 2017.06.20
819 ROC curve 수정 관련해서 문의드립니다. [2] file hamdgogo 2020.05.01
818 생존분석에서 생존표... [2] 파랑파랑하늘 2016.08.02
817 데이타 업로드후 작업이 안됩니다. T.T [1] 유로정 2016.04.22
816 mytable(), mytable2()관련 질문이 드립니다. [1] file 닉네임은별명 2021.08.03
815 knit PDF 및 ztable에서 표 출력에 대하여 질문드립니다. [5] file zepiros15 2018.12.22