I have generated some some survival times and censoring indicators. Thus I have an ordered pair for each observation. How do I sample these ordered paris? I only know how to sample from a vector? I would appreciate any help I could get. Thanks Matt
I couldn't help but respond to this one, it's not often I see my own
name.
Using data from the survival library:
library(survival)
lung[1:10, c('time', 'status')]
Surv(lung$time, lung$status)[1:10]
--Matt
Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Matthew Austin
Sent: Wednesday, June 07, 2006 6:57 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Help with sample function
I have generated some some survival times and censoring indicators.
Thus I have an ordered pair for each observation. How do I sample these
ordered paris? I only know how to sample from a vector? I would
appreciate any help I could get.
Thanks
Matt
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
try something like:
surv.data <- data.frame(times = rexp(100, 1/10), events = rbinom(100,
1, 0.7))
surv.data[sample(nrow(surv.data), replace = TRUE), ]
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Matthew Austin" <maustin at hsph.harvard.edu>
To: <r-help at stat.math.ethz.ch>
Sent: Wednesday, June 07, 2006 3:57 PM
Subject: [R] Help with sample function
>I have generated some some survival times and censoring indicators.
> Thus I have an ordered pair for each observation. How do I sample
> these
> ordered paris? I only know how to sample from a vector? I would
> appreciate any help I could get.
>
> Thanks
> Matt
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm