Zhengdeng Lei, PhD
Zhengdeng Lei, PhD
2007 - 2009 High Throughput Computational Analyst, Memorial Sloan-Kettering Cancer Center, New York
2003 - 2007 PhD, Bioinformatics, University of Illinois at Chicago
Friday, March 22, 2013
linear regression for multiple times
setwd("E:\\Projects\\8.ComBAT\\ComBat201\\NormalMarker")
data <- read.table("ComBat201T_orderbyDIM.txt", header = T, sep = "\t", row.names=1)
attach(data)
vars <- colnames(data)
res.out <- vector()
res.out[1] <- paste("model", "r.squared", "coef.Subtype.Mes", "T.Stage", "Subtype.Meta", "Subtype.Mes:T.Stage", "T.Stage:Subtype.Meta" , "pval.Subtype.Mes", "T.Stage", "Subtype.Meta", "Subtype.Mes:T.Stage", "T.Stage:Subtype.Meta", sep=", ")
for (i in 6:26)
{
command <- paste("lm(", vars[i], " ~ Subtype.Mes*T.Stage+Subtype.Meta*T.Stage)", sep="")
lm.res <- eval(parse(text = command))
summary(lm.res)$r.squared
summary(lm.res)$coefficients[2] #regression.coef
summary(lm.res)$coefficients[3] #regression.coef
summary(lm.res)$coefficients[8] #pval
coef <- summary(lm.res)$coefficients
res.out[i-4] <- paste(command, summary(lm.res)$r.squared, coef[2],coef[3], coef[4], coef[5], coef[6], coef[20],coef[21], coef[22], coef[23],coef[24],sep=", ")
}
write.table(res.out, file="linear.model.TStage_subtype.txt", sep = "\t", quote=F, row.names=F, col.name=F)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment