Survival Analysis - No(Non-Missing) Observations
1
0
Entering edit mode
11.8 years ago
moranr ▴ 290

Hi,

I am having a problem with my code. I am working with 5 datasets, 4 of them work fine with my code, however one is throwing up an error.

I am trying to calculate survival on the dataset i.e. get Hazard Ratio and p- value..

heres my code:

create a matrix for survival output

genes in rows , HR and P in columns

survival_gse4573_matrix <- matrix(nrow=colNum,ncol=2)

colnames(survival_gse4573_matrix) <- c("HR","P")

rownames(survival_gse4573_matrix) <- colnames(current_study)

get survival time and censored survival time based on status binary

survival_cens <- datTraits$STATUS.0.alive..1.dead.[358:487]

survival_time <- as.numeric(datTraits$suvival..months)[358:487]

for(i in 1:dim(gse4573_di_matrix)[2]){

a <- coxph(Surv(survival_time,as.numeric(survival_cens)) ~ gse4573_di_matrix[,i])

coeffs <- coef(summary(a))

HR <- coeffs[,2]

pVal <- (coeffs[,5])

fill matrix with HR and P for each gene

survival_gse4573_matrix[i,2] <- pVal

survival_gse4573_matrix[i,1] <- HR }

and the error:

coxph(Surv(survival_time, as.numeric(survival_cens)) ~ gse4573_di_matrix[,1])

Error in coxph(Surv(survival_time,as.numeric(survival_cens)) ~ gse4573_di_matrix[, : No (non-missing) observations

In addition:

Warning message: In

max(event[who2]) : no non-missing arguments to max; returning -Inf

The survival_cens contains only "NAs" as there was no status data for this dataset, is this the problem? If so, is there a way of solving it ?

Thanks, R

r bioconductor • 27k views
ADD COMMENT
0
Entering edit mode

Is it because you are assigning it to survival_cens and survival_time, then in formula for coxph you are using survivalcens and survivaltime?

ADD REPLY
0
Entering edit mode

No that is justhow the error puts them up... Im almost sure its due to status being effectively empty

ADD REPLY
0
Entering edit mode

If survival_cens is all NAs, I'm not sure how you could hope to do the computation, the result would be unknowable.

ADD REPLY
0
Entering edit mode
11.7 years ago
moranr ▴ 290

For anyone Interested the problem was that i had to read the survival_cens using survival_cens<- (as.numeric(as.character survival_cens))

ADD COMMENT

Login before adding your answer.

Traffic: 2029 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6