[R] help with formula for clogit

1Rnwb sbpurohit at gmail.com
Mon Nov 7 16:19:51 CET 2011


I would like to know if clogit function can be used as below
clogit(group~., data=dataframe)

When I try to use in above format it takes a long time, I would appreciate
some pointers to get multiple combinations tested.

set.seed(100)
 d=data.frame(x=rnorm(20)+5,
 x1=rnorm(20)+5,
 x2=rnorm(20)+5,
 x3=rnorm(20)+5,
 x4=rnorm(20)+5,
 x5=rnorm(20)+5,
 x6=rnorm(20)+5,
 x7=rnorm(20)+5,
 x8=rnorm(20)+5,
group=rep(c(1,2),10), Age=rnorm(20)+35,strata=c(rep(1,10), rep(2,10))) 

nam=names(d)[1:9]
results <- c("Protein", "OR", "p-val")
pc3=combinations(n=length(nam),r=2)

for (len in 1:dim(pc3)[2])
 {
  prs=pc3[len,]
  mols=nam[prs]
  d2=d[,c(mols,'group','Age','strata')]
  log.reg<-clogit(group~.,data=d2)
  a = summary(log.reg)$conf.int
  z= summary(log.reg)$coefficients[1,4]  #ncol in coefficients is 3 * number
of parameters
  pval  = 2*pnorm(-abs(z))
  res2 = c(paste('IL8+',molecule,sep=''), paste (round(a[1,1],2), " ("  ,
round(a[1,3],2), " - " , round(a[1,4],2), ")" , sep=""), pval)
  results  = rbind (results ,res2 )
}

Thanks
Sharad

--
View this message in context: http://r.789695.n4.nabble.com/help-with-formula-for-clogit-tp3998967p3998967.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list