Suppose I have a dataset contain three variants, looks like > head(dta) Sex tumorsize Histology time status 0 1.5 2 12.1000 0 1 1.8 1 38.4000 0 .....................
Sex: 1 for male; 0 for female., two levels Histology: 1 for SqCC; 2 for High risk AC; 3 for low risk AC, three levels Now I need to get a Time-dependent coefficients cox fit: library(survival) for(i in c(1,3) dta[,i] <- factor(dta[,i]) fit <- coxph( Surv(time, status) ~ Sex + tumorsize + Histology + tt(Histology), data = dta, tt = function(x, t, ...) x * log(t) ) But I keep gettting this error says: Error in if (any(infs)) warning(paste("Loglik converged before variable ", : missing value where TRUE/FALSE needed In addition: Warning message: In Ops.factor(x, log(t)) : ‘*’ not meaningful for factors. How can I fix it? I know that the "Sex" and "Histology" are both categorical variants. I want to have a model that have two β(t) = a + blog(t) for each histology level. Thank you! ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.