Displaying 2 results from an estimated 2 matches for "coxsnps".
2007 May 07
1
Predicted Cox survival curves - factor coding problems..
...g confused. It is
not smart enough to match a new data frame that contains a numeric for sitenew
to a fit that contained that variable as a factor. (Perhaps it should be smart
enough to at least die gracefully -- but it's not).
The simple solution is to not use factors.
site1 <- 1*(coxsnps$sitenew==1)
site2 <- 1*(coxsnps$sitenew==2)
test1 <- coxph(Surv(time, censor) ~ snp1 + sex + site1 + site2 + gene +
eth.self + strata(edu), data= coxsnps)
output
profile1 <- data.frame(snp1=c(0,1), site2=c(0,0), sex=c(0,0),
site1=c(0,0), site2=c(0,0), geno=c(0,0...
2007 May 04
0
Predicted Cox survival curves - factor coding problems...
...ose of the plot will be to visualise the effect of snp1,
coded 0 and 1. In my Cox model I have stratified by one variable, edu, and
so I know I will automatically get a separate curve for each strata. My
problem is how to deal with the variable sitenew, which is a 3 level
factor (coded 0,1,2).
coxsnps$edu <- as.factor(coxsnps$edu)
coxsnps$sitenew <- as.factor(coxsnps$sitenew)
test1 <- coxph(Surv(time,censor) ~ snp1 + sex + sitenew + geno + eth_self
+ strata(edu), data=coxsnps)
coef exp(coef) se(coef) z p
snp1 -0.4324 0.649...