r - Multi state models in R2BayesX -
i trying fit multi-state model using r package r2bayesx. how can correctly? there no example in manual. here attempt.
- activity 1/0 ie states
- time time
- patient id random effect 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), :
error occurred during runtime of bayesx, please check bayesx logfile!
i'm not sure kind of model want specify tried provide artificial non-sensical data set make 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, provide improved example. , can run code:
library("r2bayesx") f <- activity ~ sx(time, bs = "baseline") + sx(id, bs = "re") b <- bayesx(f, family = "multistate", method = "mcmc", data = df)
this leads warning above , can inspect bayesx's logfile via:
bayesx_logfile(b)
which tells (among other information):
error: family multistate not allowed method regress
so here reml estimation appears supported, but:
b <- bayesx(f, family = "multistate", method = "reml", data = df)
also results in error, logfile says:
error: variable state has specified global option!
so state has provided in different way. guess tried binary response seems response should time variable (as in survival models) , additional state indicator needs provided somehow. couldn't find example in bayesx manuals, though. recommend contact bayesx mailing list and/or r2bayesx package maintainer more specific question , reproducible example.
Comments
Post a Comment