Hi all,
I want to get results for cox proportional hazards on SNP data. I'm trying
to get HRs, CI's, & p-values for each individual SNP - this is represented
by cov[,i]. When I run my code, I get the following error: subscript out of
bounds. I don't know why I am getting this error.
I have looked through the R logs, but nothing that has been previously
suggested has helped so far. What am I doing wrong?
DS3 = time variable, S3 = censor/event variable, cov = my dataset, which is
in a data.frame format:
*********************************************************
CODE:
test<-NULL
bb=names(cov)
col = dim(cov)[2]
for(i in 19:col)
{
mod=coxph(Surv(cov$DS3,cov$S3)~cov[,i]+AGE+sex,data=cov)
aa<-summary(mod)
test<-rbind(test,c(bb[i],aa$coef[1,1],aa$coef[1,3],aa$coef[1,5],aa$conf.int
[1,1],aa$conf.int[1,3],aa$conf.int
[1,4],aa$coef[2,5],aa$coef[3,5],aa$coef[4,5]))
}
write.table(test,"result.txt",quote=F)
Thanks!
-CC
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.