1library(survey) 2library(survival) 3 4pbc2<-rbind(pbc,pbc) 5pbc2$id<-rep(1:418,2) 6 7dpbc1<-svydesign(id=~1, data=pbc) 8dpbc2<-svydesign(id=~id, data=pbc2) 9 10s1<-svykm(Surv(time,status>0)~1, subset(dpbc1, bili>6), se=TRUE) 11s2<-svykm(Surv(time,status>0)~1, subset(dpbc2, bili>6), se=TRUE) 12 13(c1<-confint(s1,(1:5)*365)) 14(c2<-confint(s2,(1:5)*365)) 15all.equal(c1, c2) 16 17m1<-svycoxph(Surv(time,status>0)~log(bili), design=dpbc1) 18m2<-svycoxph(Surv(time,status>0)~log(bili), design=dpbc2) 19 20d<-data.frame(bili=c(5,10)) 21p1<-predict(m1, se=TRUE, newdata=d,type="curve") 22p2<-predict(m2, se=TRUE, newdata=d,type="curve") 23 24(pc1<-confint(p1[[1]],(1:5)*365)) 25(pc2<-confint(p2[[1]],(1:5)*365)) 26all.equal(pc1, pc2) 27 28(q1<-quantile(p1[[2]])) 29(q2<-quantile(p2[[2]])) 30all.equal(q1,q2) 31