## Not run:
# set.seed(7)
# ## cohort
# s<-kc.simul(4000, f=0.03, hr=5)
# summary(s)
#
# ## exclude probands
# m.coh<- kc.marginal(s$agecancer, s$cancer, factor(s$carrier), s$rel,
# knots=c(30,40,50,60,70,80,90), f=0.03)
# m.coh
#
# ## relatives only
# r.coh<- coxph(Surv(agecancer,cancer)~real.carrier, data=s)
# print(exp(coef(r.coh)))
#
# ## probands only
# p.coh<- coxph(Surv(agecancer,cancer)~carrier, data=s)
# print(exp(coef(p.coh)))
#
# ## case-control
# s.cc<- sample.caco(s)
# summary(s.cc)
#
# ## exclude probands
# m.caco<- kc.marginal(s.cc$agecancer, s.cc$cancer, factor(s.cc$carrier),
# s.cc$rel, knots=c(30,40,50,60,70,80,90), f=0.03)
# m.caco
#
# ## relatives only
# r.caco<- glm(cancer~real.carrier, family=binomial, data=s.cc, subset=(s.cc$rel!=0))
# print(exp(coef(r.caco)[2]))
#
# ## probands only
# p.caco<- glm(cancer~carrier, family=binomial, data=s.cc, subset=(s.cc$rel==0))
# print(exp(coef(p.caco)[2]))
# ## End(Not run)
Run the code above in your browser using DataLab