Package {Romeb}


Type: Package
Title: Robust Median-Based Bayesian Growth Curve Modeling
Version: 0.2.0
Date: 2026-07-01
Description: 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.
License: GPL-3
URL: https://github.com/DandanTang0/Romeb
BugReports: https://github.com/DandanTang0/Romeb/issues
Depends: R (≥ 4.2.0)
Imports: coda, rjags, stats, utils
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
SystemRequirements: JAGS
Encoding: UTF-8
Language: en-US
LazyData: true
LazyDataCompression: xz
RoxygenNote: 7.3.3
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-07-03 02:22:13 UTC; lynn
Author: Dandan Tang ORCID iD [aut, cre], Xin Tong [aut]
Maintainer: Dandan Tang <tangdd20@gmail.com>
Repository: CRAN
Date/Publication: 2026-07-11 20:40:02 UTC

Romeb: Robust Median-Based Bayesian Linear Growth Modeling

Description

Implements a focused robust median-based Bayesian linear growth-curve model without covariates in the growth model. The package supports complete-data, MCAR/MAR, MNAR, and MNAR-with-auxiliary-variable missing-data analyses. Auxiliary variables, when used, enter the missingness model rather than the growth model. Models are fitted via rjags/JAGS and summarized with coda.

Fits a robust median-based Bayesian linear growth curve model under complete data, MCAR/MAR, MNAR, or MNAR-with-auxiliary-variable assumptions. The current implementation fits a linear growth model without covariates in the growth model. Auxiliary variables, if supplied, are included only in the MNAR missingness model.

Usage

Romeb(
  Missing_Type,
  data,
  time,
  seed,
  K = 0,
  outcome_vars = NULL,
  auxiliary_vars = NULL,
  priors = list(),
  inits = NULL,
  chain = 1,
  Niter = 6000,
  burnIn = 3000,
  n_adapt = 1000
)

Arguments

Missing_Type

Character; one of "MNAR", "MAR", "MCAR", or "no missing".

data

Matrix or data frame containing outcome columns and, optionally, auxiliary variables.

time

Numeric vector of measurement times, e.g., c(0, 1, 2, 3).

seed

Integer-valued numeric scalar used for reproducibility.

K

Integer; legacy argument giving the number of auxiliary variables in the first K columns of data. Prefer outcome_vars and auxiliary_vars for new analyses.

outcome_vars

Optional column names or column indices identifying the outcome variables. If omitted, the function uses the legacy layout implied by K.

auxiliary_vars

Optional column names or column indices identifying auxiliary variables. These variables are used only for MNAR models.

priors

Optional named list of prior hyperparameters. See Details.

inits

Optional initial values passed to rjags::jags.model. If omitted, chain-specific RNG initial values are generated internally.

chain

Integer; number of MCMC chains. Default is 1.

Niter

Integer; iterations per chain. Default is 6000.

burnIn

Integer; burn-in iterations discarded before posterior summaries are computed. Default is 3000. Must be smaller than Niter.

n_adapt

Integer; number of JAGS adaptation iterations run before posterior sampling. These iterations are not saved and are not included in posterior summaries. Default is 1000. Setting this to 0 is allowed but is generally not recommended for complex models.

Details

The default priors match the original weakly informative implementation: muLS[j] ~ dnorm(0, 0.001), pre_sigma ~ dgamma(0.001, 0.001), Inv_cov ~ dwish(diag(2), 3), and, for MNAR models, r0, r1, r2, and auxiliary coefficients follow dnorm(0, 0.001) priors. Users can override these defaults with a named priors list. Unknown prior names trigger an error to avoid silently ignoring misspecified user inputs. Supported elements are muLS_mean, muLS_prec, sigma_shape, sigma_rate, wishart_R, wishart_df, missing_coef_mean, missing_coef_prec, aux_coef_mean, and aux_coef_prec. In JAGS, normal priors are parameterized by precision, not variance. The n_adapt argument controls JAGS adaptation only; it is separate from burnIn, which discards saved posterior samples during post-processing. For Missing_Type = "no missing", the selected outcome variables must contain no missing values. MCAR and MAR use the same observed-data outcome model; no explicit missingness model is fitted unless Missing_Type = "MNAR".

Value

An object of class RomebResult. The returned object is a list with the following components:

quantiles

Posterior means, standard deviations, and quantiles with descriptive parameter labels.

geweke

Geweke z-scores.

credible_intervals

Equal-tail 95 percent credible intervals.

hpd_intervals

Highest posterior density intervals.

samps_full

The full coda::mcmc.list object, relabeled with descriptive parameter names.

parameter_map

A data frame mapping descriptive parameter names to the corresponding model parameters.

model_info

A list containing the model type, selected outcome variables, selected auxiliary variables, prior settings, and MCMC settings.

Author(s)

Maintainer: Dandan Tang tangdd20@gmail.com (ORCID)

Authors:

See Also

Useful links:

Examples

set.seed(123)
dat <- data.frame(
  age0 = rnorm(30),
  age1 = rnorm(30),
  age2 = rnorm(30),
  aux1 = rnorm(30)
)

time <- c(0, 1, 2)
outcome_vars <- c("age0", "age1", "age2")

head(dat)

## Not run: 
fit <- Romeb(
  Missing_Type = "no missing",
  data = dat,
  time = time,
  seed = 123,
  outcome_vars = outcome_vars,
  chain = 1,
  Niter = 1000,
  burnIn = 500,
  n_adapt = 500
)
print(fit)

## End(Not run)

Youth Attitudes toward Deviance (NYS, 1976–1980)

Description

A real data set from the 1976–1980 National Youth Survey of U.S. youth.

Usage

NYS

Format

A data frame with 1,725 rows and 7 variables:

age

Participant age (years)

gender

Gender (0 = female, 1 = male)

Atd1

Attitude toward social deviance, wave 1

Atd2

Attitude toward social deviance, wave 2

Atd3

Attitude toward social deviance, wave 3

Atd4

Attitude toward social deviance, wave 4

Atd5

Attitude toward social deviance, wave 5

Source

National Youth Survey, waves 1976–1980 (downloadable at https://www.icpsr.umich.edu/icpsrweb/ICPSR/series/88)


Bayesian Linear Growth Model for Complete Data, MCAR, and MAR

Description

JAGS model definition for the robust median-based Bayesian linear growth model used for complete data, MCAR, and MAR analyses. Prior hyperparameters are supplied through the data list by Romeb().

Usage

model

Format

A character string.


Bayesian Linear Growth Model for MNAR Missingness

Description

JAGS model definition for the robust median-based Bayesian linear growth model with an MNAR selection model. Prior hyperparameters are supplied through the data list by Romeb().

Usage

model_MNAR

Format

A character string.


Bayesian Linear Growth Model for MNAR Missingness with Auxiliary Variables

Description

JAGS model definition for the robust median-based Bayesian linear growth model with an MNAR selection model that includes auxiliary variables. Prior hyperparameters are supplied through the data list by Romeb().

Usage

model_MNAR_k

Format

A character string.