Kaplan-Meier plot

classic Classic list List threaded Threaded
3 messages Options
New
Reply | Threaded
Open this post in threaded view
|

Kaplan-Meier plot

New
According to the guidelines (if I'm not mistaken), the code below is
sufficient (without any specification) to give Kaplan-Meier curves with
censored data markings on Kaplan-Meier curves. But in my case censored data
don't appears on the curves?!

library(survival)
mydata<-read.csv (file="C:/mydata/mydata.csv", header=TRUE, sep=";" )
# Sic! The separator in my csv file is ";"

dput (mydata, "dputmydata.r")
#attached

Y <- Surv (mydata$time, mydata$status == 2)
# 2 -- encodes event

km <- survfit (Y~mydata$stage)

plot (km)
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Kaplan-Meier plot

Bert Gunter-2
Have you consulted ?plot.survfit ? There are examples for KM plots there.

Also, obvious question: Have you specfied the censoring properly in your
data and fit?


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Jan 17, 2019 at 11:39 AM Medic <[hidden email]> wrote:

> According to the guidelines (if I'm not mistaken), the code below is
> sufficient (without any specification) to give Kaplan-Meier curves with
> censored data markings on Kaplan-Meier curves. But in my case censored data
> don't appears on the curves?!
>
> library(survival)
> mydata<-read.csv (file="C:/mydata/mydata.csv", header=TRUE, sep=";" )
> # Sic! The separator in my csv file is ";"
>
> dput (mydata, "dputmydata.r")
> #attached
>
> Y <- Surv (mydata$time, mydata$status == 2)
> # 2 -- encodes event
>
> km <- survfit (Y~mydata$stage)
>
> plot (km)
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Kaplan-Meier plot

R help mailing list-2
Hi,

Just to emphasize Bert's e-mail with a hint, the 'mark.time' argument for plot.survfit() is FALSE by default.

Regards,

Marc Schwartz


> On Jan 17, 2019, at 2:45 PM, Bert Gunter <[hidden email]> wrote:
>
> Have you consulted ?plot.survfit ? There are examples for KM plots there.
>
> Also, obvious question: Have you specfied the censoring properly in your
> data and fit?
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Thu, Jan 17, 2019 at 11:39 AM Medic <[hidden email]> wrote:
>
>> According to the guidelines (if I'm not mistaken), the code below is
>> sufficient (without any specification) to give Kaplan-Meier curves with
>> censored data markings on Kaplan-Meier curves. But in my case censored data
>> don't appears on the curves?!
>>
>> library(survival)
>> mydata<-read.csv (file="C:/mydata/mydata.csv", header=TRUE, sep=";" )
>> # Sic! The separator in my csv file is ";"
>>
>> dput (mydata, "dputmydata.r")
>> #attached
>>
>> Y <- Surv (mydata$time, mydata$status == 2)
>> # 2 -- encodes event
>>
>> km <- survfit (Y~mydata$stage)
>>
>> plot (km)

______________________________________________
[hidden email] 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.