I find your package “mstate” helpful. However, I noticed a possible issue about the function “msprep”: when only one variable was specified in argument keep, the resulting kept variable in the output data frame did not seem to be correct. Attached is a simple Rout file that illustrate the issue. In brief, the kept variable (e.g., group ID) does not match the corresponding subject ID. It would be great if you could have a look. Thanks!
E-mail dd Sep 24 2020 by Xuan Zhang,
Dear Prof. Putter,
I find your package “mstate” helpful. However, I noticed a possible issue about the function “msprep”: when only one variable was specified in argument
keep
, the resulting kept variable in the output data frame did not seem to be correct. Attached is a simple Rout file that illustrate the issue. In brief, the kept variable (e.g., group ID) does not match the corresponding subject ID. It would be great if you could have a look. Thanks!Best, Xuan
Code: tg <- data.frame(id = 1:6, group_id = rep(1:3, 2), stt = rep(0, 6), sts = rep(0, 6), illt = c(1, 1, 6, 6, 8, 9), ills = c(1, 0, 1, 1, 0, 1), dt = c(5, 1, 9, 7, 8, 12), ds = c(1, 1, 1, 1, 1, 1)) tmat <- trans.illdeath()
issue occurs when only one variable was specified in
keep
(
keep
should probably be sorted byord1
in the source code)msprep(time = c(NA, "illt", "dt"), status = c(NA, "ills", "ds"), data = tg, trans = tmat, keep = "group_id")
notice that the group_id of id 1 was not correct in row 3
similarly, the group_id of id 2 was incorrect in row 5 ...