基因表达量高低分组的cox和连续变量cox回归计算的HR值差异太大?
号外:绝大部分生信技能树粉丝都没有机会加我微信,已经多次满了5000好友,所以我开通了一个微信好友,前100名添加我,仅需150元即可,3折优惠期机会不容错过哈。我的微信小号二维码在:0元,10小时教学视频直播《跟着百度李彦宏学习肿瘤基因组测序数据分析》
集思广益-生存分析可以随心所欲根据表达量分组吗 生存分析时间点问题 寻找生存分析的最佳基因表达分组阈值 apply家族函数和for循环还是有区别的(批量生存分析出图bug) TCGA数据库生存分析的网页工具哪家强
HR = 1: No effect HR < 1: Reduction in the hazard HR > 1: Increase in Hazard
A covariate with hazard ratio > 1 (i.e.: b > 0) is called bad prognostic factor A covariate with hazard ratio < 1 (i.e.: b < 0) is called good prognostic factor
mySurv=with(phe,Surv(time, event))
log_rank_p <- apply(exprSet,1,function(gene){
# gene=exprSet[1,]
phe$group=ifelse(gene>median(gene),'high','low')
data.survdiff=survdiff(mySurv~group,data=phe)
p.val = 1 - pchisq(data.survdiff$chisq, length(data.survdiff$n) - 1)
return(p.val)
})
log_rank_p=sort(log_rank_p)
head(log_rank_p)
boxplot(log_rank_p)
table(log_rank_p<0.05)
p <- log_rank_p[log_rank_p<0.05]
mySurv=with(phe,Surv(time, event))
identical(substring(colnames(exprSet),1,12), phe$ID)
cox_results <-apply(exprSet , 1 , function(gene){
# gene= exprSet[1,]
group=ifelse(gene>median(gene),'high','low')
survival_dat <- data.frame(group=group,
stringsAsFactors = F)
m=coxph(mySurv ~ group, data = survival_dat)
beta <- coef(m)
se <- sqrt(diag(vcov(m)))
HR <- exp(beta)
HRse <- HR * se
#summary(m)
tmp <- round(cbind(coef = beta, se = se, z = beta/se, p = 1 - pchisq((beta/se)^2, 1),
HR = HR, HRse = HRse,
HRz = (HR - 1) / HRse, HRp = 1 - pchisq(((HR - 1)/HRse)^2, 1),
HRCILL = exp(beta - qnorm(.975, 0, 1) * se),
HRCIUL = exp(beta + qnorm(.975, 0, 1) * se)), 3)
return(tmp['grouplow',])
})
cox_results=t(cox_results)
identical(substring(colnames(exprSet),1,12), phe$ID)
cox_2 <-apply(exprSet , 1 , function(gene){
# gene= as.numeric(exprSet[1,])
x=coxph(mySurv ~ log(gene+1) )
x <- summary(x)
p.value<-signif(x$wald["pvalue"], digits=2)
wald.test<-signif(x$wald["test"], digits=2)
beta<-signif(x$coef[1], digits=2);#coeficient beta
HR <-signif(x$coef[2], digits=2);#exp(beta)
HR.confint.lower <- signif(x$conf.int[,"lower .95"], 2)
HR.confint.upper <- signif(x$conf.int[,"upper .95"],2)
HRm <- paste0(HR, " (",
HR.confint.lower, "-", HR.confint.upper, ")")
res<-c(beta, HR,HR.confint.lower,HR.confint.upper, wald.test, p.value)
names(res)<-c("beta",'HR','HR.confint.lower','HR.confint.upper', "wald.test",
"p.value")
res
})
cox_2=t(cox_2)
colnames(cox_2)
plot(cox_results[,5],cox_2[,2])
cor(cox_results[,5],cox_2[,2])
文末友情宣传
生信爆款入门-全球听(买一得五)(第5期)(可能是最后一期)你的生物信息学入门课 (必看!)数据挖掘第3期(两天变三周,实力加量),医学生/临床医师首选技能提高课 生信技能树的2019年终总结 ,你的生物信息学成长宝藏 2020学习主旋律,B站74小时免费教学视频为你领路,还等什么,看啊!!!
赞 (0)