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. The resulting joint
marginal distribution over the data is a DP mixture.ddpgrow(y, subject, trt, time, n.random, n.fix_degree, formula, random.only,
data, dosemat, numdose, typetreat, labt, Omega, n.iter, n.burn, n.thin,
shape.dp, rate.dp, M.init, plot.out)N captures
the number of subject-time cases (repeated subject
measures). Data may reflect unequal number of measures
per subject. Missing o(1,1,1,2,2,3,3,3,...N (number of cases) indicating treatment
arm assignments for each case. May also be input as
length n vector, where n is the number of
unique subjects, indN,
capturing the time points associated to each by-subject
measure.q. 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(time, ...,
time^(n.fix_degree), trt_1,time*trt_1, ...
,time^(n.fix_degree)*trt_l, trt_L,...,
time^(nformula with the following format,
y ~ x_1 + x_2*x_3 | z_1*z_2. The bar, |,
separates fixed and random effects. If it is only
desired to enter either formula is entered without a |,
random.only defaultsdata.frame containing the variables
named in formula.n x (sum(numdose)+1)
matrix object that maps subjects to
treatment dosages. The first column should be an
intercept column (filled with 1's). If there is only a
single treatment arm, then the number typetreat.c("car","mvn","ind").typetreat) providing user names for each
treatment. The names are used in plot objects. If
NULL, then the numerical order of treatment
entries are used."car" %in%
typetreat. List element m contains an
numdose[m] x numdose[m] numeric matrix to encode
the CAR adjacency matrix, where ddpgrow will return (n.iter - n.burn)
posterior samples.n is the total number of subjects.TRUE.dpgrow object, for which many methods are
available to return and view results. Generic functions
applied to an object, res of class dpgrow,
includes:call, the
function call made to dpgrow 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 dpgrow.n.iter -
n.burn) posterior sampling iterations for every model
parameter, including fixed and random effects.dpgrowmult, dpgrowmm,
dpgrow## extract simulated dataset
library(growcurves)
data(datddpsim)
## attach(datddpsim)
## run dpgrow mixed effects model; returns object of class "ddpgrow"
shape.dp = 4
res = ddpgrow(y = dat$y, subject = dat$subject,
trt = dat$trt, time = dat$time,
typetreat = c("mvn","car","ind","car"),
numdose = dat$numdose,
labt = dat$labt, dosemat = dat$dosemat,
Omega = dat$Omega, n.random = dat$n.random,
n.fix_degree = 2, n.iter = 10000, n.burn = 2000,
n.thin = 10, shape.dp = 1)
plot.results = plot(res) ## ggplot2 plot objects, including growth curves
summary.results = summary(res) ## parameter credible intervals, fit statistics
samples.posterior = samples(res) ## posterior sampled valuesRun the code above in your browser using DataLab