R draw survival curve and calculate P-value with end time specified
up vote
0
down vote
favorite
I am trying to figure out how to generate a survival curve and P-value of a specific time window and not of the entire dataframe.
i can't simply cut-off all records which have survival times longer than x days, as below. Then all survival probability drops to 0% since there simply isnt anybody alive beyond x days anymore.
#dat <- dat[dat$diff_in_days <= 730, ]
In the survfit
function I can specify start.time and it only plots the records that have a greater time than specified.
dat_survfit <- survfit(dat_surv ~ Schedule, data = dat, start.time = 100)
All i would like is to be able to specify an end.time
. It would stop plotting from there on and generate the P-value
from start.time
till end.time
. (I checked documentation, survfit
doesnt have such parameter)
I don't mind how elegant it is anymore, i'm now bound by a deadline and can't figure it out.
How can I specify an end.time
for survfit
or split my dataframe so, that it only draws a survival curve starting from x days
and ending at x days
and calculates the p-value
between these number of days.
r dataframe survival-analysis
add a comment |
up vote
0
down vote
favorite
I am trying to figure out how to generate a survival curve and P-value of a specific time window and not of the entire dataframe.
i can't simply cut-off all records which have survival times longer than x days, as below. Then all survival probability drops to 0% since there simply isnt anybody alive beyond x days anymore.
#dat <- dat[dat$diff_in_days <= 730, ]
In the survfit
function I can specify start.time and it only plots the records that have a greater time than specified.
dat_survfit <- survfit(dat_surv ~ Schedule, data = dat, start.time = 100)
All i would like is to be able to specify an end.time
. It would stop plotting from there on and generate the P-value
from start.time
till end.time
. (I checked documentation, survfit
doesnt have such parameter)
I don't mind how elegant it is anymore, i'm now bound by a deadline and can't figure it out.
How can I specify an end.time
for survfit
or split my dataframe so, that it only draws a survival curve starting from x days
and ending at x days
and calculates the p-value
between these number of days.
r dataframe survival-analysis
1
Could you please provide a minimal reproducible example?
– Mr_Z
18 hours ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to figure out how to generate a survival curve and P-value of a specific time window and not of the entire dataframe.
i can't simply cut-off all records which have survival times longer than x days, as below. Then all survival probability drops to 0% since there simply isnt anybody alive beyond x days anymore.
#dat <- dat[dat$diff_in_days <= 730, ]
In the survfit
function I can specify start.time and it only plots the records that have a greater time than specified.
dat_survfit <- survfit(dat_surv ~ Schedule, data = dat, start.time = 100)
All i would like is to be able to specify an end.time
. It would stop plotting from there on and generate the P-value
from start.time
till end.time
. (I checked documentation, survfit
doesnt have such parameter)
I don't mind how elegant it is anymore, i'm now bound by a deadline and can't figure it out.
How can I specify an end.time
for survfit
or split my dataframe so, that it only draws a survival curve starting from x days
and ending at x days
and calculates the p-value
between these number of days.
r dataframe survival-analysis
I am trying to figure out how to generate a survival curve and P-value of a specific time window and not of the entire dataframe.
i can't simply cut-off all records which have survival times longer than x days, as below. Then all survival probability drops to 0% since there simply isnt anybody alive beyond x days anymore.
#dat <- dat[dat$diff_in_days <= 730, ]
In the survfit
function I can specify start.time and it only plots the records that have a greater time than specified.
dat_survfit <- survfit(dat_surv ~ Schedule, data = dat, start.time = 100)
All i would like is to be able to specify an end.time
. It would stop plotting from there on and generate the P-value
from start.time
till end.time
. (I checked documentation, survfit
doesnt have such parameter)
I don't mind how elegant it is anymore, i'm now bound by a deadline and can't figure it out.
How can I specify an end.time
for survfit
or split my dataframe so, that it only draws a survival curve starting from x days
and ending at x days
and calculates the p-value
between these number of days.
r dataframe survival-analysis
r dataframe survival-analysis
edited 19 hours ago
asked 19 hours ago
Krijn van der Burg
1831222
1831222
1
Could you please provide a minimal reproducible example?
– Mr_Z
18 hours ago
add a comment |
1
Could you please provide a minimal reproducible example?
– Mr_Z
18 hours ago
1
1
Could you please provide a minimal reproducible example?
– Mr_Z
18 hours ago
Could you please provide a minimal reproducible example?
– Mr_Z
18 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222122%2fr-draw-survival-curve-and-calculate-p-value-with-end-time-specified%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Could you please provide a minimal reproducible example?
– Mr_Z
18 hours ago