Implements robust median-based Bayesian linear growth curve models for complete data and for data with Missing Completely at Random (MCAR), Missing At Random (MAR), or Missing Not At Random (MNAR) mechanisms. Models are fitted using 'rjags' through 'JAGS' and posterior summaries are computed with 'coda'. The main function allows users to specify outcome variables, auxiliary variables for MNAR missingness models, prior hyperparameters, and initial values directly through function arguments.
Romeb fits robust median-based Bayesian linear growth curve models for complete longitudinal data and for data with MCAR, MAR, or MNAR missingness mechanisms. Models are fitted through rjags, using JAGS, and posterior summaries are computed with coda.
Install the released version from CRAN:
install.packages("Romeb")
JAGS must be installed separately before fitting models with rjags.
library(Romeb)
set.seed(123)
dat <- data.frame(
y0 = rnorm(100),
y1 = rnorm(100),
y2 = rnorm(100),
aux1 = rnorm(100)
)
fit <- Romeb(
Missing_Type = "no missing",
data = dat,
time = c(0, 1, 2),
seed = 123,
outcome_vars = c("y0", "y1", "y2"),
Niter = 6000,
burnIn = 3000,
n_adapt = 1000
)
print(fit)
Earlier versions used the legacy K argument, where the first K columns of data were treated as auxiliary variables and the following columns were treated as outcomes. The preferred interface is now explicit variable selection:
fit_mnar <- Romeb(
Missing_Type = "MNAR",
data = dat,
time = c(0, 1, 2),
seed = 123,
outcome_vars = c("y0", "y1", "y2"),
auxiliary_vars = "aux1",
Niter = 6000,
burnIn = 3000,
n_adapt = 1000
)
auxiliary_vars is currently supported only for Missing_Type = "MNAR", where auxiliary variables enter the missingness model. The growth model itself remains a linear growth model without covariates.
The default priors match the original weakly informative implementation. Users may override supported hyperparameters with a named priors list:
fit_prior <- Romeb(
Missing_Type = "no missing",
data = dat,
time = c(0, 1, 2),
seed = 123,
outcome_vars = c("y0", "y1", "y2"),
priors = list(
muLS_mean = c(0, 0),
muLS_prec = c(0.001, 0.001),
sigma_shape = 0.001,
sigma_rate = 0.001,
wishart_R = diag(2),
wishart_df = 3
)
)
Supported prior names are:
muLS_meanmuLS_precsigma_shapesigma_ratewishart_Rwishart_dfmissing_coef_meanmissing_coef_precaux_coef_meanaux_coef_precNormal priors in JAGS are parameterized by precision rather than variance.
Users may provide initial values through inits. For one chain, use a named list. For multiple chains, use a list of named lists with length equal to chain, or provide a function accepted by rjags::jags.model().
fit_init <- Romeb(
Missing_Type = "no missing",
data = dat,
time = c(0, 1, 2),
seed = 123,
outcome_vars = c("y0", "y1", "y2"),
inits = list(muLS = c(0, 0))
)
If inits is omitted, Romeb generates chain-specific RNG initial values internally.
n_adapt controls JAGS adaptation. These iterations are not saved and are not included in posterior summaries. burnIn controls how many saved posterior draws are discarded during post-processing. Therefore, n_adapt and burnIn serve different purposes.