bnorth
2009-Dec-08 16:49 UTC
[R] "prodlim" problem with censor ticks in stratified KM plot
I am having a problem with the censor tick marks with plot and prodlim I am using the example code from ?prodlim but I have added mark.time=T to the plot command to get tick marks at censor times. The problem is the tick marks occur at exactly the same point in each of the arms. This seems wrong as the censorings do not occur at the same times in each arm. pfit.edema <- prodlim(Surv(time,status)~edema,data=pbc) summary(pfit.edema) summary(pfit.edema,intervals=TRUE) plot(pfit.edema,mark.time=T) Here is my sessionInfo R version 2.9.0 (2009-04-17) i386-pc-mingw32 locale: LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] prodlim_1.0.5 survival_2.35-7 KernSmooth_2.22-22 many many thanks to anyone who can spot my error -- View this message in context: http://n4.nabble.com/prodlim-problem-with-censor-ticks-in-stratified-KM-plot-tp955433p955433.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2009-Dec-08 17:17 UTC
[R] "prodlim" problem with censor ticks in stratified KM plot
On Dec 8, 2009, at 11:49 AM, bnorth wrote:> > I am having a problem with the censor tick marks with plot and prodlim > I am using the example code from ?prodlim but I have added > mark.time=T to > the plot command to get tick marks at censor times. > The problem is the tick marks occur at exactly the same point in > each of the > arms. > This seems wrong as the censorings do not occur at the same times in > each > arm. > > pfit.edema <- prodlim(Surv(time,status)~edema,data=pbc)I get an error here, I think because status has three values and Surv expects two but possibly because my efforts to work around the Design overlays to the survival package were not correct. I tried a few other approaches to getting the code to work, but failed. I did notice that pbc$status is numeric rather than a factor, and wondered if that three level categorical variable might be treated differently by the various functions you are using because of its R class. Perhaps if you created a factor pbc$stat2, it might work correctly? -- David> summary(pfit.edema) > summary(pfit.edema,intervals=TRUE) > plot(pfit.edema,mark.time=T) > > Here is my sessionInfo > > R version 2.9.0 (2009-04-17) > i386-pc-mingw32 > > locale: > LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United > Kingdom.1252;LC_MONETARY=English_United > Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 > > attached base packages: > [1] splines stats graphics grDevices utils datasets > methods > [8] base > > other attached packages: > [1] prodlim_1.0.5 survival_2.35-7 KernSmooth_2.22-22 > > > many many thanks to anyone who can spot my error > -- > View this message in context: http://n4.nabble.com/prodlim-problem-with-censor-ticks-in-stratified-KM-plot-tp955433p955433.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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 Heritage Laboratories West Hartford, CT
David Winsemius
2009-Dec-08 17:30 UTC
[R] "prodlim" problem with censor ticks in stratified KM plot
On Dec 8, 2009, at 12:17 PM, David Winsemius wrote:> > On Dec 8, 2009, at 11:49 AM, bnorth wrote: > >> >> I am having a problem with the censor tick marks with plot and >> prodlim >> I am using the example code from ?prodlim but I have added >> mark.time=T to >> the plot command to get tick marks at censor times. >> The problem is the tick marks occur at exactly the same point in >> each of the >> arms. >> This seems wrong as the censorings do not occur at the same times >> in each >> arm. >> >> pfit.edema <- prodlim(Surv(time,status)~edema,data=pbc) > > I get an error here, I think because status has three values and > Surv expects two but possibly because my efforts to work around the > Design overlays to the survival package were not correct. I tried a > few other approaches to getting the code to work, but failed. > > I did notice that pbc$status is numeric rather than a factor, and > wondered if that three level categorical variable might be treated > differently by the various functions you are using because of its R > class. Perhaps if you created a factor pbc$stat2, it might work > correctly? >Meant to say that pbc$edema was numeric. Got success in reproducing the problem using a Hist object instead of a Surv object and, ... no, changing edema to a factor variable does not solve the problem. How about sending an email to the author?> -- > David > >> summary(pfit.edema) >> summary(pfit.edema,intervals=TRUE) >> plot(pfit.edema,mark.time=T) >> >> Here is my sessionInfo >> >> R version 2.9.0 (2009-04-17) >> i386-pc-mingw32 >> >> locale: >> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United >> Kingdom.1252;LC_MONETARY=English_United >> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 >> >> attached base packages: >> [1] splines stats graphics grDevices utils datasets >> methods >> [8] base >> >> other attached packages: >> [1] prodlim_1.0.5 survival_2.35-7 KernSmooth_2.22-22 >> >> >> many many thanks to anyone who can spot my error >> -- >> View this message in context: http://n4.nabble.com/prodlim-problem-with-censor-ticks-in-stratified-KM-plot-tp955433p955433.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> R-help at 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 > Heritage Laboratories > West Hartford, CT > > ______________________________________________ > R-help at 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 Heritage Laboratories West Hartford, CT