source("c:\\documents and settings\\garreel.oncology_nt.000\\desktop\\cancerclinicaltrials\\LikelihoodSurvival\\Rfunctions.R") library(survival) ############################################################################### # h1 = 0.02, h2 = 0.02 M<-50 # number of datasets time<-24 # analysis time atime<-24 # accrual time n<-30 # number of indivs in each of two subpops h1<-0.02 # hazard rate for subpop 1 h2<-0.02 # hazard rate for subpop 2 study.time<- 60 # total study time (i.e. accrual time + min follow-up time) lmba<-seq(0.001,0.05,0.0001) # range of lambda's for estimation # generate M datasets data<-mixture.exp(n,h1,n,h2,atime,M,study.time) # likelihood estimates of data lik <- lik.result(lmba, data, time=time) # analyze data by frequentist approach freq.mat<-matrix(0,M,3) for(i in 1:M) { freq.mat[i,]<-freq.int(data[,c(2,5),i],time=time) } # estimate true survival time and plot both estimates for M datasets true<-simtrue(100,h1,h2,time, study.time) plot.both(lik,freq.mat,true) ################################################################################ # h1 = 0.02, h2 = 0.01 M<-50 # number of datasets time<-24 # analysis time atime<-24 # accrual time n<-30 # number of indivs in each of two subpops h1<-0.01 # hazard rate for subpop 1 h2<-0.02 # hazard rate for subpop 2 study.time<- 60 # total study time (i.e. accrual time + min follow-up time) lmba<-seq(0.001,0.05,0.0001) # range of lambda's for estimation # generate M datasets data<-mixture.exp(n,h1,n,h2,atime,M,study.time) # likelihood estimates of data lik <- lik.result(lmba, data, time=time) # analyze data by frequentist approach freq.mat<-matrix(0,M,3) for(i in 1:M) { freq.mat[i,]<-freq.int(data[,c(2,5),i],time=time) } # estimate true survival time and plot both estimates for M datasets true<-simtrue(100,h1,h2,time, study.time) plot.both(lik,freq.mat,true) ################################################################################ # h1 = 0.03, h2 = 0.005 M<-50 # number of datasets time<-24 # analysis time n<-30 # number of indivs in each of two subpops atime<-24 # accrual time h1<-0.03 # hazard rate for subpop 1 h2<-0.005 # hazard rate for subpop 2 study.time<- 60 # total study time (i.e. accrual time + min follow-up time) lmba<-seq(0.001,0.05,0.0001) # range of lambda's for estimation # generate M datasets data<-mixture.exp(n,h1,n,h2,atime,M,study.time) # likelihood estimates of data lik <- lik.result(lmba, data, time=time) # analyze data by frequentist approach freq.mat<-matrix(0,M,3) for(i in 1:M) { freq.mat[i,]<-freq.int(data[,c(2,5),i],time=24) } # estimate true survival time and plot both estimates for M datasets true<-simtrue(100,h1,h2,time, study.time) plot.both(lik,freq.mat,true) ################################################################################ # h1 = 0.05, h2 = 0.005 M<-50 # number of datasets time<-24 # analysis time n<-30 # number of indivs in each of two subpops atime<-24 # accrual time h1<-0.05 # hazard rate for subpop 1 h2<-0.005 # hazard rate for subpop 2 study.time<- 60 # total study time (i.e. accrual time + min follow-up time) lmba<-seq(0.001,0.05,0.0001) # range of lambda's for estimation # generate M datasets data<-mixture.exp(n,h1,n,h2,atime,M,study.time) # likelihood estimates of data lik <- lik.result(lmba, data, time=time) # analyze data by frequentist approach freq.mat<-matrix(0,M,3) for(i in 1:M) { freq.mat[i,]<-freq.int(data[,c(2,5),i],time=24) } # estimate true survival time and plot both estimates for M datasets true<-simtrue(100,h1,h2,time, study.time) plot.both(lik,freq.mat,true) ##################################################################################### ##################################################################################### # % cured: h1=0.03, n=60, pct=0.5 M<-50 # number of datasets time<-24 # analysis time atime<-24 # accrual time n<-30 # number of indivs in each of two subpops h1<-0.03 # hazard rate for subpop 1 study.time<- 60 # total study time (i.e. accrual time + min follow-up time) lmba<-seq(0.001,0.05,0.0001) # range of lambda's for estimation pct<-0.50 # generate M datasets data<-mixture.cured(pct,h1,2*n,atime,M,study.time) # likelihood estimates of data lik <- lik.result(lmba, data, time=time) # analyze data by frequentist approach freq.mat<-matrix(0,M,3) for(i in 1:M) { freq.mat[i,]<-freq.int(data[,c(2,5),i],time=24) } # estimate true survival time and plot both estimates for M datasets true<-simtrue.cured(pct,100, h1, study.time) plot.both(lik,freq.mat,true) ##################################################################################### # % cured: pct=0.3, h1=0.01, n=60 M<-50 # number of datasets time<-24 # analysis time atime<-24 # accrual time n<-30 # number of indivs in each of two subpops h1<-0.01 # hazard rate for subpop 1 study.time<- 60 # total study time (i.e. accrual time + min follow-up time) lmba<-seq(0.001,0.05,0.0001) # range of lambda's for estimation pct<-0.30 # generate M datasets data<-mixture.cured(pct,h1,2*n,atime,M,study.time) # likelihood estimates of data lik <- lik.result(lmba, data, time=time) # analyze data by frequentist approach freq.mat<-matrix(0,M,3) for(i in 1:M) { freq.mat[i,]<-freq.int(data[,c(2,5),i],time=24) } # estimate true survival time and plot both estimates for M datasets true<-simtrue.cured(pct,100, h1, study.time) plot.both(lik,freq.mat,true) ##################################################################################### # % cured: pct=0.7, h1=0.05, n=60 M<-50 # number of datasets time<-24 # analysis time atime<-24 # accrual time n<-30 # number of indivs in each of two subpops h1<-0.05 # hazard rate for subpop 1 study.time<- 60 # total study time (i.e. accrual time + min follow-up time) lmba<-seq(0.001,0.05,0.0001) # range of lambda's for estimation pct<-0.70 # generate M datasets data<-mixture.cured(pct,h1,2*n,atime,M,study.time) # likelihood estimates of data lik <- lik.result(lmba, data, time=time) # analyze data by frequentist approach freq.mat<-matrix(0,M,3) for(i in 1:M) { freq.mat[i,]<-freq.int(data[,c(2,5),i],time=24) } # estimate true survival time and plot both estimates for M datasets true<-simtrue.cured(pct,100, h1, study.time) plot.both(lik,freq.mat,true)