On Jan 12, 2017, at 4:49 PM, Robert Sherry <rsherry8 at comcast.net> wrote:
I only see one for loop in your code. I am wondering if you want a second for loop based upon the length of newdata.
I would also think that you do not need the second call to set.seed.
Bob
On 1/12/2017 4:44 PM, Jennifer Sheng wrote:
Dear friends, I am working on a double loop using for. One level of loop
is to predict N times for each subject, and the second level is to predict
M times for the every subject, one subject after one subject. Please note
every subject have different N or M rows of data. Any advice? Thank you
so much!
Below is the current code:
set.seed (123) ## for consistent result;
ND <- S004Cmin[S004Cmin$ID %in% c(1:10),] # define the first 10 subjects
predSurv <- vector("list", nrow(ND))
for (i in 1:nrow(ND)) {
set.seed(123)
predSurv[[i]] <- survfitJM(fitJOINT.NULL, newdata = ND[1:i, ],
idVar="USUBJID")
}
Thank you very much!
Jenny
[[alternative HTML version deleted]]