Question: Survival Analysis - No(Non-Missing) Observations
0
gravatar for moranr
7.6 years ago by
moranr270
Ireland
moranr270 wrote:

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 • 9.8k views
ADD COMMENTlink modified 7.5 years ago • written 7.6 years ago by moranr270

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 REPLYlink modified 7.6 years ago • written 7.6 years ago by zx87549.7k

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

ADD REPLYlink written 7.6 years ago by moranr270

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

ADD REPLYlink written 7.6 years ago by Devon Ryan97k
0
gravatar for moranr
7.5 years ago by
moranr270
Ireland
moranr270 wrote:

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

ADD COMMENTlink written 7.5 years ago by moranr270
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1172 users visited in the last hour