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을 만들때 잘못된건지 모르겠습니다....
저의 작은 지식으로는 이해가 안됩니다.ㅠ
조언부탁드립니다ㅜㅜ 감사합니다.
Comment 0
No. | Subject | Author | Date |
---|---|---|---|
1114 | 성향점수 맞추기 [3] | alse | 2016.05.25 |
1113 | 아래에 올렸었는데요,, 5Y overall survival 구하는 법이요. [2] | 난둥 | 2016.05.26 |
1112 | 로지스틱 회귀 분석에서.. [1] | 최00 | 2016.05.27 |
1111 | 기본표를 만드는데 file이 이상하게 읽히는 것 같습니다. | 매일이5월 | 2016.06.02 |
1110 | 파일 불러오기 에러 [2] | 매일이5월 | 2016.06.02 |
1109 | 파일 불러오기 오류 [2] | 매일이5월 | 2016.06.02 |
1108 | RPubs에 있는 ROC curve analysis by cardiomoon [2] | hawk1227 | 2016.06.02 |
1107 | R 그래프 옮기기 [2] | hawk1227 | 2016.06.03 |
1106 | 생존분석 그래프 x축 시간 [3] | alse | 2016.06.07 |
1105 | 자료업로드에러 [3] | dejavu730 | 2016.06.07 |
1104 | 학생강의 project1 | cardiomoon | 2016.06.07 |
1103 | 결측치 처리에 대한 질문입니다. [2] | 매일이5월 | 2016.06.07 |
1102 | IBM의 R 컨소시엄 가입 | Ben | 2016.06.08 |
1101 | 서버 접속이 안됩니다 [2] | kim | 2016.06.08 |
1100 | binary data 군집분석 [2] | 노가리 | 2016.06.08 |
1099 | 생존 분석시 문제 [3] | selteen | 2016.06.09 |
1098 | 생존 분석을 하는데 질문이 있어 게시판에 글을 올립니다. [1] | namuhanayeyo | 2016.06.11 |
1097 | 독립(설명)변수 비정규 분포시. logistic regression 문의입니다. [1] | 매일이5월 | 2016.06.16 |
1096 | Simple linear regression 에서 설명변수의 특성 [3] | 매일이5월 | 2016.06.16 |
1095 | Rstudio 에러 문제 [2] | 화모기 | 2016.06.16 |