Multi state models in R2BayesX

谁说我不能喝 提交于 2019-12-27 05:08:43

问题


I am trying to fit a multi-state model using R package R2BayesX. How can I do so correctly? There is no example in the manual. Here is my attempt.

  • activity is 1/0 ie the states
  • time is time
  • patient id is the random effect I want
f <- activity ~ sx(time,bs="baseline")+sx(PatientId, bs="re")
b <- bayesx(f, family = "multistate", method = "MCMC", data=df)

Note: created new output directory

Warning message:

In run.bayesx(file.path(res$bayesx.prg$file.dir, prg.name = res$bayesx.prg$prg.name), :
an error occurred during runtime of BayesX, please check the BayesX logfile!


回答1:


I'm not sure what kind of model exactly you want to specify but I tried to provide an artificial non-sensical data set to make the error above reproducible:

set.seed(1)
df <- data.frame(
  activity = rbinom(1000, prob = 0.5, size = 1),
  time = rep(1:50, 20),
  id = rep(1:20, each = 50)
)

Possibly, you could provide an improved example. And then I can run your code:

library("R2BayesX")
f <- activity ~ sx(time, bs = "baseline") + sx(id, bs = "re")
b <- bayesx(f, family = "multistate", method = "MCMC", data = df)

This leads to the warning above and you can inspect BayesX's logfile via:

bayesx_logfile(b)

which tells you (among other information):

ERROR: family multistate is not allowed for method regress

So here only REML estimation appears to be supported, but:

b <- bayesx(f, family = "multistate", method = "REML", data = df)

also results in an error, the logfile says:

ERROR: Variable state has to be specified as a global option!

So the state has to be provided in a different way. I guess that you tried to do so by the binary response but it seems that the response should be the time variable (as in survival models) and then an additional state indicator needs to be provided somehow. I couldn't find an example for this in the BayesX manuals, though. I recommend that you contact the BayesX mailing list and/or the R2BayesX package maintainer with a more specific question and a reproducible example.



来源:https://stackoverflow.com/questions/29862790/multi-state-models-in-r2bayesx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!