DODamen represents the dissolved oxygen values and is a valid predictor. I'm not sure how the with(test1, table(Depart, DODamen)) helps. It does show that the DODamen column is populated and in use since it lists out a table of relation between the Depart and DODamen columns.
Thanks for the help so far guys. I guess it shows that I am completely out of my depth here. Rasika -----Original Message----- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Tuesday, July 26, 2011 9:01 AM To: Rasika Gawde Cc: r-help@r-project.org R; Terry Therneau Subject: Re: [R] error in survival analysis On Jul 26, 2011, at 8:43 AM, Terry Therneau wrote: > There is something very odd about your data to give se values that are > so very large. Usually, this means that the data is deterministic: > some > combination of predictors is able to separate a subset with no events > from all the others. This leads to a problem where the log-likelihood > is maximum at infinity. > I expect that both the warning messages you see are completely > correct. > > Terry Therneau You might also consider investigating with a tablular examination of your data: The variable "DODamen" looks suspiciously like a date-of-death variable, unless it is a Department of Defense variable, and as such would not be expected to be on the RHS of a survival formula. If that guess is wrong on my part, and DODamen is a legitimate predictor, then since it is NA'ed, you should look at: with(test1, table(Depart, DODamen) ) And then also look at: with(test1, table(Depart, DOLoomis, DOI55) ) -- David. > > ---- begin included message --- > This is a simple R program that I have been trying to run. I keep > running into the "singular matrix" error. I end up with no sensible > results. Can anyone suggest any changes or a way around this? > > I am a total rookie when working with R. > > Thanks, > Rasika > >> library(survival) > Loading required package: splines >> args(coxph) > function (formula, data, weights, subset, na.action, init, control, > method = c("efron", "breslow", "exact"), singular.ok = TRUE, > robust = FALSE, model = FALSE, x = FALSE, y = TRUE, tt, ...) > NULL >> > test1<-read.table("S:/FISHDO/03_Phase_I_Field_Work/Data_6_28_2011/ > Working Folder/R_files/4SondesJuly24.csv", header=T, sep=",") >> sondes<-coxph(Surv(Start, Stop, Depart)~DOLoomis + DOI55 + DODamen, > data=test1) > Warning messages: > 1: In fitter(X, Y, strats, offset, init, control, weights = > weights, : > Loglik converged before variable 1,2 ; beta may be infinite. > 2: In coxph(Surv(Start, Stop, + DODamen, : > X matrix deemed to be singular; variable 3 >> summary(sondes) > Call: > coxph(formula = Surv(Start, Stop, Depart) ~ DOLoomis + DOI55 + > DODamen, data = test1) > > n= 1737, number of events= 58 > (1 observation deleted due to missingness) > > coef exp(coef) se(coef) z Pr(>|z|) > DOLoomis -2.152e+00 1.163e-01 1.161e+05 0 1 > DOI55 4.560e-01 1.578e+00 3.755e+04 0 1 > DODamen NA NA 0.000e+00 NA NA > > exp(coef) exp(-coef) lower .95 upper .95 > DOLoomis 0.1163 8.5995 0 Inf > DOI55 1.5777 0.6338 0 Inf > DODamen NA NA NA NA > > Concordance= 0.5 (se = 0 ) > Rsquare= 0 (max possible= 0.01 ) > Likelihood ratio test= 0 on 2 df, p=1 > Wald test = 0 on 2 df, p=1 > Score (logrank) test = 0 on 2 df, p=1 > > ______________________________________________ > R-help@r-project.org mailing list > 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. David Winsemius, MD West Hartford, CT ______________________________________________ R-help@r-project.org mailing list 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.