hw3sol - Homework 3 solution for STA 6934/4930 1. a) It...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Homework 3 solution for STA 6934/4930 1. a) It seems ok to use PH model. b) Fail to reject the null hypothesis, so we can use PH model. 2. a) see the attached r output b) The hazard ratio for males and females isn’t constant across race with α = 0.1. c) No significant outlines. d) No any influential points. R code and output please see the following pages 3. a) P (S (T) < t ) = P ( 1 - F (T) < t ) = 1- P (F (T) < t ) = 1 – ( 1 – t ) = t b) P (S-1 (U) > t) = P (( - log u) / r > t ) = t = P (S (T) < t ) 4. See notes qq q q qq qq q qq qq q qq qq qq q qq qq q q q q q q q q q qq q q q q q qq 0 200 400 kidney$obs 600 800 q q q q q q q q q q q q q q q q qq qq qq qq qq q qq qqq qq qq qqqq q qq qq qq qq q q q q q q q q q q q q qq q q q qq qq q qq q q qq qq qq q q q q q q qq q q 1 0 qq qq qq qq qqq qqq qq q qq qqq qqq qqqq qqqq qqqq qqqq q qq qqqq qqqqq q q q qqq q qqq qqqqq qqqqq qqqqq qqqq q q qqq q qqqq qqqq q qqqq q q qqq q q qqqqq qqqq qqqq qqq q qq qq q q q qq q q q qqq qqq qqq qqqq qqqq qqqq q qqq qqq qq q q q qq q q qqqqq qqqq q qqqqqqq q qqqqqqqq qqqqqqqq q qqqqqq qqqqq q qqqqq qqqqq qqqqq qq q qqqqqq qqqq q q qqqqqq q q qqqqq qqqq qq qq q qq qq q qqqq q qq q q q qqq qq qq q qq q q qq q qqq qqq qqq q qq qq q q qq qq q qqqq q qqq qqqq qqqq qqqq qqqq q qqqqq qqqqq q qqqqq qqqq q q q qqqq q q q qq qq qq q q q qq q q q q q q q q −1 −0.4 0.0 0.4 dev.resid 2 q mart.resid qq qq qq qq qq qqq qq q q q q q q q q 3 0.8 qq qq qq qq qqq q qqq qq q q q qq q q qq q qqq qq q qqq qqq qq qq q q qq qq qq q qq q q q q q q q q q q qq q q q q q q q q q q q q q q qq q qq q q qq qq q qq qq qqq qqqq qqqq qqqqq q qq qqqq qqqqq qq q qq qq q q qqqqqq qq q qqq qqqqq qqqqqq q qqqq qqqqqq q qqqq qqqq qqq qqqqqq q q qqqqqq q qqqq qqqqq qq qqqqqq qq qq qqqq qqqq qq qq qqqqqq qqqqqqq qqqqqq qq qq qq q qqqqqq qq q qqqqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqq q qqqqqqqqq qq qqqqqqq qqqqqq q qqqqqqqqq qqqqq qq qq q q qq qq qqqqqq qqqqqq qq qqq qq qqqqqq q q qqqq q q qqqqqq qqqqq qqqqqqq qqqqqq qqqqqqqq q qqqqqq q q qqqq q qqqqqqq qqqqqqq qqqqqqq q q q qq q qq qq qq q q q qq qq qq q q 0 200 400 kidney$obs 600 800 q qq q q 0 q q q q q qq 200 q q q q q qq qq q qq 600 800 0 200 400 800 q q q q q q q q q q q q q q 0.05 0.15 0.10 0.05 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 1.2 1.4 1.6 1.8 2.0 q q q q q q q q qq q 0.0010 q q q q q q q q qq q q q q q q q qq qq qq q q qq qq qq q q q qq qq q q qq q q qq q q qq q q q q q q q q q q q q q q q qq qq qq q q q q q q q q q qq q q qq q qq q q q q q q q q q q q q q q qq qq q q q qq qq qq qq qq qq qqq qqq qqq qq q qqq q q qqq q q qqqqqqqqqqqqq qqqqqqqqqqq q qqqqqqqqqqq q qqqqqq qq q qqqqqq qqq qq qq q q qq qq qqqqqq qqqqqqq qqq q qqqqqqqqq qq q q q q qq qq qqq q qq q qq q q q q qq qqqqqq qq q qq qq q qq qqq q q q qqqq qqqqqq qqqqqqq qqqqqqqqqqqqqqqqqqqqqq q q qq q q qqq qqqqqqq qqqqqqqqqq qqqqqqqqqqqq q q q qqqqqqqqq qqqq qqqqq qqq qqqqqqq q qqq qqqqqqq qqqqqqqqqqqqqq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqq qqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqq q qqq qqqqqq qqqqqqqqqq qqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q q q qqqq qqqq qqqqq q qqq qq qqqq qqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq q q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqq qqqqqqqq qqqq qqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqq qqqqqq qqqqq qqqqqqqqqqqqqqqqq qqqqqqq q q q q qqqq qq q q q qq q q q qq q q q q q q q qq q q q q qq qq q q qq qq q qq qq qq q 400 kidney$obs q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 1.0 1.2 1.4 1.6 kidney$race Likelihood Displacement Statistics 200 q q q q q q q −0.05 0.00 −0.05 q q q q q q q q q q q q q q q q kidney$gender 0.0000 600 kidney$obs q q q q q q q q q q q q q q q q q q q q 0 q q q qqq qqq qq qqqqqqqqqq qqqqqqqqqqqq qq qqqqqqqqqqq qq qqqqqq qqqqqqqqqq qqqqqqqqqqq qq qqqqqqqqq qqq qqq qqqqqqqqqqq qqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqq qqqqqqqqqqqqq qqqqqqqqqqqqqqqq q qq qq qqqqqqqqqqqqqqqqq qq q qqqq qqqqqq qqqqqqqqqqqqqqqq qq q qq q q q qqqqq q qq qqqqq qqq qqqq q qqqq q qqqq qqqqqqq qqq q q q qqqq qqq q qqqqqqqqqq q qq q qqq qq qqqqqqqqqqqqqqqqqqqq qqqqqqq qq qqqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqq qqqqqqqq qq qqqqqqqqqqqqqqqq qq q qq qq q qqqqqq qqqqqq q qq qq qqqqqqq q q q qqqqqqqqq q q qqq qqqqqqq q q q qqqq qqqq qqq q q qqq qqqqqq qqqqqq qqqqqqqqq qqq q qqqqqqqqq qqqqqqq qqq qqqqqqqq q qqq qqqqqqq qqqqqq q qqqqqqqqqqqq q q qq qq qq q q qq qq qq qq q q q q q q q qq qq qq q q qq qq q qq qq qq qq qq qq qq qq qq q qq qq q q q q q qq qq q q q qq q q q q qq qq qq qq q q q qq q q q q qq q q qq q qq q q q q q q q q q q q q qq qq q q qq q q q q qq q qq qq qq q q q q q q q qq q q q qq q qqqq q q qq q q q qq q q q qq q q qq q q q q q q q qqqq qq qqqqqqq q q q q q qq q qq q q q q q q q q q q q q q qq qq qq qq qq q q q q q q q kidney$obs 1.0 q q qqq q q q q 400 q q q q qq qq q q q q q q q q q q q q qqq qq qq qq qqqqqqqq qq qq qq qqqqqqqqqq qqqqqqqqqq qq qqqqqqqqqq q qqqqqqqqq qqqqqqqqq qqqqqq qqqqq qqqq qq qq qq qq qq qq qqqq qq qqqq qq qqqq qqqqq qqqqqqqqq qqqqqqqq qqqqqq qqqqqqqqqqq qq qq qqq qqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqq qqqqq q qqqqqqqqqq qqq qqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqq q qqqqqqqqq qqq qqq q q q qqqq q qqq qqq qq qqqq qqq qqq qqqq qq qq qqq qqqqqqqqq q q qqqq qq q qq qqq qqqqqqqqqq qqq qqqqqqqqqq qq qqqq qqqqqq qq qq q qq qq q qq qq q q qqq qqqqqqq qqq qqq qqq q q q qq q q qqq qqq q qqqqqq qqq qqqq q qqq qqq qqq q qq qq qqqqq q qqqq q qqqq q qqqq q q qqq q qq q q qq q qqqqq qqqqqq qqqqqq qqqqqq qq qqqq qq qq q qqq q q qqqq qqq qqq qqq qq q qq qqqqq qq qq qqqqq qq qq qqqqq qq qqqqq qq qqqqq qq qqqqq qq qq qqqqqqqq qq qqqqq q qqqqqq qqqqqq qqq qq q qqq qqq qq qq qq q qq qqq qqq q q qqq qqq qqq qqqqq q qqqqqqq qqqqqq qqqqqq qqqqqq qqqqqq q qqqqqq qqq qqq qqq qqq qq q q q q q q q q q q q q qq q q qq q q q q q q q q q qqq qq q qq q q qqqq q q qq q q q q q q qq q q qq qq q q q qq qq q q qqqq qq q qqqqqqq q q q q 0.05 q qq q q qq 0.05 0.00 −0.05 0.15 q q q q qq qq q q qq qq −0.05 0.10 qq qq qqq qq qq qq q q qq qq q qq 600 800 1.8 2.0 file:///A|/STA6934/HW3/2R_output.txt R : Copyright 2002, The R Development Core Team Version 1.4.1 (2002-01-30) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type `license()' or `licence()' for distribution details. R is a collaborative project with many contributors. Type `contributors()' for more information. Type `demo()' for some demos, `help()' for on-line help, or `help.start()' for a HTML browser interface to help. Type `q()' to quit R. > library(survival) > library(splines) > kidney<-read.table("C:\\Documents and Settings\\lzhang\\Desktop\\sta 6934\\hw3\\kidney.txt",header=T) > attach(kidney) > kid.gender.race<-coxph(Surv(dtime,dind)~gender+race) > summary.coxph(kid.gender.race) Call: coxph(formula = Surv(dtime, dind) ~ gender + race) n= 863 coef exp(coef) se(coef) z p gender -0.0935 0.91 0.174 -0.536 0.59 race 0.2200 1.25 0.211 1.040 0.30 gender race exp(coef) exp(-coef) lower .95 upper .95 0.91 1.098 0.647 1.28 1.25 0.803 0.823 1.89 Rsquare= 0.002 (max possible= 0.87 ) Likelihood ratio test= 1.35 on 2 df, p=0.51 Wald test = 1.39 on 2 df, p=0.498 Score (logrank) test = 1.4 on 2 df, p=0.497 > kid.gender.race.genderrace<-coxph(Surv(dtime,dind)~gender+race+gender*race) > summary.coxph(kid.gender.race.genderrace) Call: coxph(formula = Surv(dtime, dind) ~ gender + race + gender * race) n= 863 coef exp(coef) se(coef) z p gender -0.994 0.370 0.548 -1.81 0.070 race -0.834 0.434 0.662 -1.26 0.210 gender:race 0.745 2.107 0.427 1.75 0.081 gender race gender:race exp(coef) exp(-coef) lower .95 upper .95 0.370 2.702 0.126 1.08 0.434 2.303 0.119 1.59 2.107 0.474 0.912 4.87 Rsquare= 0.005 (max possible= Likelihood ratio test= 4.37 on Wald test = 4.64 on Score (logrank) test = 4.74 on 0.87 ) 3 df, 3 df, 3 df, p=0.224 p=0.200 p=0.192 file:///A|/STA6934/HW3/2R_output.txt (1 of 2) [10/20/2003 12:05:36 AM] file:///A|/STA6934/HW3/2R_output.txt > > > > > > > > > > > > > > > > mart.resid<-residuals(kid.gender.race,type="martingale") dev.resid<-residuals(kid.gender.race,type="deviance") par(mfrow=c(2,2)) plot(kidney$obs,mart.resid) plot(kidney$obs,dev.resid) dfbetascale.resid<-residuals(kid.gender.race,type="dfbetas") par(mfrow=c(3,2)) plot(kidney$obs,dfbetascale.resid[,1]) plot(kidney$obs,dfbetascale.resid[,2]) plot(kidney$gender,dfbetascale.resid[,1]) plot(kidney$race,dfbetascale.resid[,2]) LD.mat<-(dfbetascale.resid) %*% kid.gender.race$var %*% t(dfbetascale.resid) LD<-diag(LD.mat) plot(kidney$obs,LD,main="Likelihood Displacement Statistics") file:///A|/STA6934/HW3/2R_output.txt (2 of 2) [10/20/2003 12:05:36 AM] ...
View Full Document

Ask a homework question - tutors are online