raymond chiruka
2007-May-10 11:33 UTC
[R] getting the normal dist from the chisqr with 1df
l used the following code to generate a sample and then calculated then did a log rank test.can l get the normal version of the logrank eg sqrt of the chisqr(1) will give you the N~(0,1). from my sample can i use the above expression to get the normal dist from the result of the log rank test. thank s=1 while(s!=0){ n=100 m<-matrix(nrow=n,ncol=4) colnames(m)=c("treatmentgrp","strata","censoringTime","survivalTime") for(i in 1:n) m[i,]<-c(sample(c(1,2),1,replace=TRUE),sample(c(1,2),1,replace=TRUE),rexp(1,0.07),rexp(1,0.02)) m<-cbind(m,0) m[m[,3]>m[,4],5]<-1 colnames(m)[5]<-"censoring" act.surv.time<-pmin(m[,"censoringTime"],m[,"survivalTime"]) m<-cbind(m,act.surv.time) print(m) write.table(m,”clipboard”,sep=”\t”,col.names=NA) print(“.................”) print(“the logrank test”) b=data.frame(m) c= survdiff(Surv(act.surv.time,censoring)~treatmentgrp,data=b) print(c) s=s-1 print(“...............................................................”) } --------------------------------- [[alternative HTML version deleted]]