Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TDMM

TDMM: Bayesian Time-Dynamic Models with Optional Mixed Effects provides Bayesian time-dynamic models for Gaussian, Bernoulli, and Poisson outcomes. Regression coefficients vary smoothly over time. With random_intercept = TRUE (the default), subjects may have repeated observations, irregular observation times, unequal visit counts, baseline covariates, and covariates that vary by visit. With random_intercept = FALSE, the model omits the subject-specific random intercept for independent observations; time may represent age, time since an event, or time relative to an event.

The default spline uses eight cubic B-spline basis functions (polynomial degree 3, spline order 4) with a second-order coefficient-difference penalty. JAGS performs posterior sampling.

Install

Install JAGS first, then install TDMM in R:

install.packages("remotes")
remotes::install_github("esrakurum/Bayesian-TDMM")
library(TDMM)

Fit a model

Supply one row per observation. The example below uses repeated observations; here baseline is constant within subject and changing varies by visit:

fit <- tdmm(long_data, family = "gaussian",
            subject.var = "id", time.var = "time", y.var = "y",
            x.var = c("baseline", "changing"), n_basis = 8,
            random_intercept = TRUE,
            control = tdmm_control(chains = 3, seed = 123))
summary(fit)
plot(fit)
plot.trace.tdmm(fit, c("sigma.b", "sigma2.e", "tau.alpha[1]"))

Use family = "bernoulli" for binary outcomes or family = "poisson" for counts. See Getting Started for data layout, interpretation, and diagnostics. The Gaussian, Bernoulli, Poisson, and PBC2 examples give fuller workflows. The vignette source and example scripts are also available in the repository.

Citation

Use citation("TDMM") or the repository's citation metadata.

The v0.3.0 release is archived at Zenodo DOI 10.5281/zenodo.23742177. Earlier releases are archived as v0.2.0 and v0.1.0.

TDMM is released under the MIT license.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages