Bayesian Semi and Nonparametric Growth Curve Models that Additionally Include Multiple Membership Random Effects

Employs a non-parametric formulation for by-subject random effect parameters to borrow strength over a constrained number of repeated measurement waves in a fashion that permits multiple effects per subject. One class of models employs a Dirichlet process (DP) prior for the subject random effects and includes an additional set of random effects that utilize a different grouping factor and are mapped back to clients through a multiple membership weight matrix; e.g. treatment(s) exposure or dosage. A second class of models employs a dependent DP (DDP) prior for the subject random effects that directly incorporates the multiple membership pattern.




  • updated release on CRAN.

  • performs Bayesian mixed effects modeling on repeated measures data.

  • allows a DP prior on a set of subject random effects to borrow strength across subjects for estimation.

  • simultaneously supports definition of random effects under other than subject groupings with one or more multiple membership (MM) terms.

  • the dpgrow function performs mixed effects modeling without an MM term (but with a DP prior on the set of subject random effects).

  • the dpgrowmm function extends dpgrow by allowing for a single MM term under one of three prior formulation options = c("mmi","mmigrp","mmcar").

  • the dpgrowmult function extends dpgrowmm by allowing for any number of MM terms, each under one of four prior formulation options = c("mmi","mmigrp","mmcar","mmdp").

  • a new ddpgrow function extends dpgrowmm and dpgrowmult by absorbing the MM term inside the subject effects such that each subject parameters their own MM effects.
    -- prior formulation options = c("car","mvn","ind").

  • there are also 3 accompanying graphical accessor functions for the 3 sampling functions to promote easy analysis:

  • the growplot function produces and plots by-subject growth curves under any user defined grouping.

  • the trtplot function compares the distribution for the difference in fixed effects means between any two treatment arms.

  • the effectsplot function compares the mean effect values for an MM term under different prior and model formulations.



  • Fixed errors in effectsplot and ddpEffectsplot functions that render MM random effects plots when user elects option to order by effect size within each plot cell.


  • Added additional return object, phat, the n x n matrix of pairwise clustering probabilities obtained from sampled clusters. This object may be employed in a deterministic
  • clustering scheme as an alternative to using the optimal clustering, BigSmin, returned from the least squares clustering algorithm of Dahl (2006).


  • updated all multivariate normal sampling functions to avoid inverse computation of precision matrix. Now directly draws samples from cholesky decomposition of precision matrix.
  • updated multiple membership (MM) .cpp models for more efficient posterior sampling of MM random effects
  • fixed an error that inadvertantly sorted subj.aff (post numerical re-labeling for internal use) such that the labels no longer corresponded with the rows of W.subj.aff


  • updated all engine functions to pre-compute quadratic products of data matrices and their slices for more efficient computation.


  • fixed an error when checking user input under function dpgrowmult that accounts for the user not selecting option "mmcar" for any groups.
  • fixed error in checking for duplicate columns between Z.n and Z.c for generation of random effects design matrix, Z.
  • fixed an error to reorder "time" variable to be consistent with contiguous by-subject order for growth curve plotting.


  • fixed an error in ddp.cpp to eliminate use of pow(&int,int), which is not allowed.


  • fixed an error in ddp_quantiles.R to select the correct index when computing the mean covariance matrix, P_mvn[[countmvn]], (for each treatment under "mvn")
  • fixed an error in dpgrowmm under "multi=TRUE" to create "" matrix from Omega
  • fixed an error in dpgrowmm under option "multi=TRUE" and "option = "mmcar" for computation of the posterior mean of conditionally sampled nv x 1 session effects
  • fixed a potential error in dpgrowmm where W.subj is set equal to W.subj.aff under all subjects receiving treatment. Coerced W.subj to matrix in the case the user
  • inputs W.subj.aff as a data.frame object. W.subj is subsequently used in growthCurves function to differentiate a dpgrowmm object (matrix) from a dpgrowmult object (list).


  • change deprecated method to pull elements of a vector for Armadillo 4.000
  • and the companion RcppArmadillo 0.4.000.
  • in particular, update method of pulling scalar views of vectors to no longer use
  • ".row" or ".column", which are now constrained to return matrix objects, not scalars
  • Instead of creating a subview like so:
  • ustarj = ustar.row(s(j));
  • use this:
  • ustarj = ustar(s(j));


  • Updated references, in particular for the upcoming paper in Journal of Statistical Software.


  • Fixed error in growplot() that prevented plots when user leaves compare.objects blank.
    -- Reported by Travis Porco.


  • NAMESPACE suggests, rather than imports ggplot2 and testthat.


  • Under C++11/14, Armadillo uses 64-bit integer (long long) definitions for initiating uword and sword typedefs used for uvec and ivec, respectively. The long long type is forbidden in R, so check if_defined(ARMA_32BIT_WORD) and, if so, un_def ARMA_64BIT_WORD.
  • add roxygen2 @export tag to default methods for dpgrow, dpgrowmm, dpgrowmult, ddpgrow to fix a bug on methods dispatch.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("growcurves") by Terrance Savitsky, 2 years ago

Browse source code at

Authors: Terrance Savitsky

Documentation:   PDF Manual  

Task views: Bayesian Inference

GPL (>= 2) license

Imports reshape2, Formula, ggplot2

Depends on Rcpp

Suggests testthat

Linking to Rcpp, RcppArmadillo

See at CRAN