Learn R Programming

growcurves (version 0.2.3.8)

dpgrowmult: Bayesian semiparametric growth curve models under employment of more-than-1 multiple membership random effects (block) term.

Description

Employs a Dirichlet Process (DP) prior on the set of by-subject random effect parameters under repeated waves of measurements to allow the number of random effect parameters specified per subject, q, to be equal to the number of measurement waves, T. Random effects are grouped by subject and all q parameters receive the DP prior. Additional sets of possibly more than 1 multiple membership effect terms are included, each with a separate weight/design matrix that maps the effects back to clients. A variety of prior formulations are available for the effects in each multiple membership term.

Usage

dpgrowmult(y, subject, trt, time, n.random, n.fix_degree, formula, random.only,
  data, Omega, group, subj.aff, W.subj.aff, n.iter, n.burn, n.thin, strength.mm,
  shape.dp, rate.dp, plot.out, option, ulabs)

Arguments

y
A univariate continuous response, specified as an N x 1 matrix or vector, where N captures the number of subject-time cases (repeated subject measures). Data may reflect unequal number of measures per subject. Missing o
subject
The objects on which repeated measures are conducted that serves as the random effects grouping factor. Input as an N x 1 matrix or vector of subject-measure cases in either integer or character formt; e.g. (1,1,1,2,2,3,3,3,...
trt
An integer or character vector of length N (number of cases) indicating treatment group assignments for each case. May also be input as length P vector, where P is the number of unique subjects, indicati
time
A univariate vector of length N, capturing the time points associated to each by-subject measure. Mav leave blank if only one time point (no repeated measures).
n.random
The desired number of subject random effect terms, q. Since a DP prior is used on client effects, may be set equal to the number of measurement waves, T. The y, trt, time vectors will together be used t
n.fix_degree
The desired polynomial order in time to use for generating time-based fix effects. The fixed effects matrix will be constructed as, (time, ..., time^(n.fix_degree), trt_1,time*trt_1, ... ,time^(n.fix_degree)*trt_l, trt_L,..., time^(n
formula
Nuisance fixed and random effects may be entered in formula with the following format, y ~ x_1 + x_2*x_3 | z_1*z_2 as an object of class formula. The bar, |, separates fixed and random effec
random.only
A Boolean variable indicating whether the input formula contains random (for fixed) effects in the case that only one set are entered. If excluded and formula is entered without a |, random.only defaults
data
a data.frame containing the variables with names as specified in formula, including the response, y.
Omega
A list object of length equal to the number of multiple membership (MM) effect terms chosen with the "mmcar" option. List element i contains an S[i] x S[i] numeric matrix to encode the CAR adjacency matrix,
group
A list object of length equal to the number of MM terms chosen with prior formulation options "mmcar" or "mmigrp". List element i contains a numeric or character vector of length S[i], provi
subj.aff
A list object of length equal to the number of total MM terms. List element i contains a Paff[i] x 1 vector subset of subject composed with unique subject identifiers that are linked to the effects in te
W.subj.aff
A list object of length equal to the number of MM terms. List element i contains a P.aff[i] x S[i] numeric matrix that maps a set of random effects to affected subjects (subj.aff[[i]]). It is assumed that t
n.iter
Total number of MCMC iterations.
n.burn
Number of MCMC iterations to discard. dpgrow will return (n.iter - n.burn) posterior samples.
n.thin
Gap between successive sampling iterations to save.
strength.mm
Sets both the shape and rate parameter for a tau_{gamma} ~ G(strength.mm,strength.mm) prior on the precision parameter of either a CAR (gamma ~ CAR(tau_gamma)) or independent (gamma ~ N(0,tau_gamma^(-1)I_S) prior
shape.dp
Shape parameter under a c ~ G(shape.dp, 1) prior on the concentration parameter of the DP (prior on the set of random effects parameters, b_1, ..., b_n ~ DP(c,G_0) where n is the total number of subjects.
rate.dp
Rate parameter under a c ~ G(shape.dp, rate.dp) prior on the concentration parameter of the DP.
plot.out
A boolean variable indicating whether user wants to return plots with output results. Defaults to TRUE.
option
A character vector of length equal to the total number of multiple membership terms that supplies the prior formulation choice for each term. The elements of option are confined to choose from among c("mmcar","mmi","mmigrp"
ulabs
A vector of the same length as option containing desired labels for each multiple membership term. These label values are employed in returned plot objects. If left blank, ulabs is set to a sequential number vector

Value

  • S3 dpgrowmult object, for which many methods are available to return and view results. Generic functions applied to an object, res of class dpgrow, includes:
  • summary(res)returns call, the function call made to dpgrowmult and summary.results, which contains a list of objects that include 95% credible intervals for each set of sampled parameters, specified as (2.5%, mean, 97.5%, including fixed and random effects. Also contains model fit statistics, including DIC (and associated Dbar, Dhat, pD, pV), as well as the log pseudo marginal likelihood (LPML), a leave-one-out fit statistic. Note that DIC is constructed as DIC3 (see Celeaux et. al. 2006), where the conditional likehihood evaluated at the posterior mode is replaced by the marginal predictive density. Lastly, the random and fixed effects design matrices, X, Z, are returned that include both the user input nuisance covariates appended to the time and treatment-based covariates constructed by dpgrowmult.
  • print(summary(res))prints contents of summary to console.
  • plot(res)returns results plots, including the set of subject random effects values and credible intervals, a sample of by-subject growth curves, mean growth curves split by each treatment and control, as well as selected trace plots for number of clusters and for precision parameters for the likehilood and random effects. Lastly, a trace plot for the deviance statistic is also included.
  • samples(res)contains (n.iter - n.burn) posterior sampling iterations for every model parameter, including fixed and random effects.
  • resid(res)contains the model residuals.

References

S. M. Paddock and T. D. Savitsky (2012) Bayesian Hierarchical Semiparametric Modeling of Longitudinal Post-treatment Outcomes from Open-enrollment Therapy Groups, invited re-submission to: JRSS Series A (Statistics in Society). T. D. Savitsky and S. M. Paddock (2012) Visual Sufficient Statistics for Repeated Measures data with growcurves for R, submitted to: Journal of Statistical Software.

See Also

dpgrowmm

Examples

Run this code
## extract simulated dataset
library(growcurves)
data(datsimmult)
## Model with DP on clients effects, but now INCLUDE session random effects
## in a multiple membership construction communicated with the N x S matrix, W.subj.aff.
## Returns object, res.mm, of class "dpgrowmm".
shape.dp	= 3
res.mult	= dpgrowmult(y = datsimmult$y, subject = datsimmult$subject,
			trt = datsimmult$trt, time = datsimmult$time,
			n.random = datsimmult$n.random, Omega = datsimmult$Omega,
			group = datsimmult$group,
			subj.aff = datsimmult$subj.aff,
			W.subj.aff = datsimmult$W.subj.aff, n.iter = 10000,
			n.burn = 2000, n.thin = 10, shape.dp = shape.dp,
			option = c("mmi","mmcar"))
plot.results	= plot(res.mult) ## ggplot2 plot objects, including growth curves
summary.results = summary(res.mult) ## parameter credible intervals, fit statistics
samples.posterior = samples(res.mult) ## posterior sampled values

Run the code above in your browser using DataLab