1
multiple membership random effects (block) term.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.
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)
N
captures the number of subject-time cases (repeated subject measures). Data may reflect unequal
number of measures per subject. Missing occasions are left out as no NA
values are allowed.(1,1,1,2,2,3,3,3,...,n,n,n)
, where n
is the total
number of subjects.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, indicating subject group assignment. Multiple treatment groups
are allowed and if the vector is entered as numeric, e.g. (0,1,2,3,..)
, the lowest numbered
group is taken as baseline (captured by global fixed effects). If entered in character format,
the first treatment entry is taken as baseline. If the are no treatment (vs. control) groups,
then this vector may be excluded (set to NULL).N
, capturing the time points associated to each by-subject
measure. Mav leave blank if only one time point (no repeated measures).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 to create both fixed and random effect design matrices. The random effects matrix will be of the
the form, (1, time, ... , time^(n.random - 1))
(grouped, by subject
).
This formulation is a growth curve model that allows assessment of by-treatment effects and by-client growth curves.(time, ..., time^(n.fix_degree), trt_1,time*trt_1, ... ,time^(n.fix_degree)*trt_l, trt_L,..., time^(n.fix_degree)*trt_L)
.
This formulation is a growth curve model that allows assessment of by-treatment effects and by-client growth curves.
If is.null(n.fix_degree) | n.fix_degree == 0 & is.null(trt)
time-by-treatment fixed effects and growth curves are not generated.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 effects. If it
is only desired to enter either fixed or random effects, but not both then the |
may be omitted. Note:
the nuisance random effects are assumed to be grouped by subject. The fixed and random effects values may change with
each repeated measure; however, within subject growth curves will keep constant z
and x
values between
measurement waves. It is possible to bypass the growth curve construction by leaving y, trt, time, n.random, n.fix_degree
blank and entering only formula
, instead. The model output plots, will, however
exclude growth curves in that event. If a formula is input (which requires response, y
) then
the separate entry of y
may be omitted. If the parameter y
is input, it will be over-written by that from formula
.formula
is entered without a |
, random.only
defaults to
FALSE
.data.frame
containing the variables with names as specified in formula
, including the response, y
."mmcar"
option.
List element i
contains an S[i] x S[i] numeric matrix to encode the CAR adjacency matrix,
where S[i]
is the number of effects mapped to subjects for list component i
.
This input is required only under option = "mmcar"
."mmcar"
or "mmigrp"
.
List element i
contains a numeric or character vector of length S[i]
, providing group identifiers for each of S[i]
effects in term
i
. (e.g. (1,1,1,2,2,...)
. If there is only a single group for term [i], this element should be loaded with an S[i] x 1
vector of a single value.i
contains a
Paff[i] x 1
vector subset of subject
composed with unique subject identifiers that are linked to the effects in term i
;
e.g. one or more treatment cohorts. P.aff[i]
is the length of the unique subjects linked to the effects in MM term i
.
If all subjects are to receive the mapping of multiple membership effects then Paff[i]
should contain a list of the unique subjects in subject
.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 the row order is the same as the order of subj.aff[[i]]
. If W.subj.aff[[i]]
is a multiple membership
weight matrix, then the rows will sum to 1, though this is not required. The rows of W.subj.aff
may alternatively be formulated
with indicators for whether each of S
treatment dosages are linked to a given subject
.dpgrow
will return (n.iter - n.burn)
posterior samples.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 on the set of S
multiple membership effects. Defaults to strength.mm = 0.01
.n
is the total number of subjects.TRUE
.option
are confined to choose from among c("mmcar","mmi","mmigrp","mmdp")
.
Any element of this choice set may be selected multiple times as desired. For example, to add 3 multiple membership terms
with effects in the first term under a DP prior, the second term under a CAR prior and the third also under a CAR prior, the
entry would be, option = c("mmdp","mmcar","mmcar")
. The corresponding list entries should conform this choice for option
.
The order of sampled effect values returned conforms to this order of input in option
(and the corresponding subj.aff
and W.subj.aff
).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 starting at 1
.dpgrowmult
object, for which many methods are available to return and view results. Generic functions applied
to an object, res
of class dpgrow
, includes:
, includes: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.
dpgrowmm
## Not run:
# ## 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
# ## End(Not run)
Run the code above in your browser using DataLab