Analyzing twin survival data with 'mets'

  1. Load the menarche data.
    library(mets)
    data("mena")
    
  2. Estimate the mean age at menarche in each cohort treating the censored observations as uncensored. Are there seemingly any significant effect of cohort?
  3. Estimate parameters from the Tobit regression model (linear normal regression with right censoring):
    s <- survreg(Surv(agemena,status) ~ 1+factor(cohort)+cluster(id),
                 dist="gaussian", data=mena)
    

    Interpret the output from the model.

  4. Calculate the Kaplan-Meier estimator for each cohort. Plot and interpret the results. What is the approximate age at median survival time?
    km1 <- survfit(Surv(agemena,status) ~ factor(cohort), data=mena)
    palette(c("darkblue","darkred","orange","olivedrab"))
    plot(km1,mark.time=FALSE,col=1:4)
    
  5. Add the survival curve from the Tobit regression to the plot (for the youngest cohort). Use the pnorm function and extract the mean and standard deviation (scale) from the survreg model.
    tt <- seq(0,16,length.out=100)
    ss <- 1-pnorm(tt,mean=coef(s)[1],sd=s$scale)
    lines(tt,ss,lty=2)
    
  6. Estimate a Cox regression model using the cox.aalen function from the timereg package.
    ca <- cox.aalen(Surv(agemena,status)~+1+prop(cohort)+cluster(id),
                    data=mena,max.clust=NULL,n.sim=0,robust=0)
    
  7. Calculate the two-stage Clayton-Oakes-Glidden estimate
    vardesign <- model.matrix(~-1+factor(zyg),mena)
    e <- two.stage(ca,data=mena,theta.des=vardesign)
    

    Interpret the results. Refit the model with a new variance regression design, vardesign, that makes it possible to assess the statistical significance of zygosity.

  8. Plot paired menarche times
    library(lava.tobit)
    menaw <- fast.reshape(mena,id="id")
    status <- menaw$status1+menaw$status2+1
    plot(agemena2~agemena1,data=menaw,pch=c(2,6,16)[status],col=Col(c(4,2,1)[status],0.6))
    
  9. Estimate parameters from ACE model
    s0 <- twinlm(agemena~1,zyg="zyg",DZ="DZ",id="id",data=mena)
    s0
    mena$S <- with(mena, Surv(agemena,status))
    s <- twinlm(S~1,zyg="zyg",DZ="DZ",id="id",data=mena,control=list(trace=1,start=coef(s0)))
    s
    

Created: 2013-05-15 Wed 07:30