DPMolmm {DPpackage} | R Documentation |
This function generates a posterior density sample for a semiparametric ordinal linear mixed model using a Dirichlet Process Mixture of Normals prior for the distribution of the random effects.
DPMolmm(fixed,random,prior,mcmc,state,status,data=sys.frame(sys.parent()), na.action=na.fail)
fixed |
a two-sided linear formula object describing the
fixed-effects part of the model, with the response on the
left of a ~ operator and the terms, separated by +
operators, on the right. |
random |
a one-sided formula of the form ~z1+...+zn | g , with
z1+...+zn specifying the model for the random effects and
g the grouping variable. The random effects formula will be
repeated for all levels of grouping. |
prior |
a list giving the prior information. The list include the following
parameter: a0 and b0 giving the hyperparameters for
prior distribution of the precision parameter of the Dirichlet process
prior, alpha giving the value of the precision parameter (it
must be specified if a0 and b0 are missing, see details
below), nu0 and Tinv giving the hyperparameters of the
inverted Wishart prior distribution for the scale matrix of the normal
kernel, mb and Sb giving the hyperparameters
of the normal prior distribution for the mean of the normal
baseline distribution,nub and Tbinv giving the hyperparameters of the
inverted Wishart prior distribution for the scale matrix of the normal
baseline distribution, and beta0 and Sbeta0 giving the
hyperparameters of the normal prior distribution for the fixed effects
(must be specified only if fixed effects are considered in the model). |
mcmc |
a list giving the MCMC parameters. The list must include
the following integers: nburn giving the number of burn-in
scans, nskip giving the thinning interval, nsave giving
the total number of scans to be saved, and ndisplay giving
the number of saved scans to be displayed on screen (the function reports
on the screen when every ndisplay iterations have been carried
out). |
state |
a list giving the current value of the parameters. This list is used if the current analysis is the continuation of a previous analysis. |
status |
a logical variable indicating whether this run is new (TRUE ) or the
continuation of a previous analysis (FALSE ). In the latter case
the current value of the parameters must be specified in the
object state . |
data |
data frame. |
na.action |
a function that indicates what should happen when the data
contain NA s. The default action (na.fail ) causes
DPMolmm to print an error message and terminate if there are any
incomplete observations. |
This generic function fits an ordinal linear mixed-effects model with a probit link (see, e.g., Molenberghs and Verbeke, 2005):
Yij = k, if gammak-1 <= Wij < gammak, k=1,...,K
Wij | betaF, betaR , bi ~ N(Xij betaF + Zij betaR + Zij bi, 1), i=1,...,N, j=1,...,ni
thetai | G, Sigma ~ int N(m,Sigma)G(dm)
G | alpha, mub, Sigmab ~ DP(alpha N(mub, Sigmab))
where, thetai = betaR + bi, beta = betaF, and G0=N(theta| mu, Sigma). To complete the model specification, independent hyperpriors are assumed,
beta | beta0, Sbeta0 ~ N(beta0,Sbeta0)
Sigma | nu0, T ~ IW(nu0,T)
alpha | a0, b0 ~ Gamma(a0,b0)
mub | mb, Sb ~ N(mb,Sb)
Sigma | nub, Tb ~ IW(nub,Tb)
A uniform prior is used for the cutoff points. Note that the inverted-Wishart prior is parametrized such that E(Sigma)= T^{-1}/(nu0-q-1).
The precision or total mass parameter, α, of the DP
prior
can be considered as random, having a gamma
distribution, Gamma(a0,b0),
or fixed at some particular value. When alpha is random the method described by
Escobar and West (1995) is used. To let alpha to be fixed at a particular
value, set a0 to NULL in the prior specification.
The computational implementation of the model is based on the marginalization of
the DP
and on the use of MCMC methods for conjugate priors
for a collapsed state of MacEachern (1998).
The betaR parameters are sampled using the epsilon-DP approximation proposed by Muliere and Tardella (1998), with epsilon=0.01.
An object of class DPMolmm
representing the linear
mixed-effects model fit. Generic functions such as print
, plot
,
summary
, and anova
have methods to show the results of the fit.
The results include betaR
, betaF
, mu
, the elements of
Sigma
, mub
, the elements of Sigmab
,
the cutoff points, \alpha
, and the number of clusters.
The function DPMrandom
can be used to extract the posterior mean of the
random effects.
The list state
in the output object contains the current value of the parameters
necessary to restart the analysis. If you want to specify different starting values
to run multiple chains set status=TRUE
and create the list state based on
this starting values. In this case the list state
must include the following objects:
ncluster |
an integer giving the number of clusters. |
alpha |
giving the value of the precision parameter |
b |
a matrix of dimension (nsubjects)*(nrandom effects) giving the value of the random effects for each subject. |
cutoff |
a real vector defining the cutoff points. Note that the first cutoff must be fixed to 0 in this function. |
mu |
a matrix of dimension (nsubjects)*(nrandom effects) giving the value of the means
of the normal kernel for each cluster (only the first ncluster are considered to start the chain). |
ss |
an interger vector defining to which of the ncluster clusters each subject belongs. |
beta |
giving the value of the fixed effects. |
sigma |
giving the variance matrix of the normal kernel. |
mub |
giving the mean of the normal baseline distributions. |
sigmab |
giving the variance matrix of the normal baseline distributions. |
Alejandro Jara <ajarav@udec.cl>
Escobar, M.D. and West, M. (1995) Bayesian Density Estimation and Inference Using Mixtures. Journal of the American Statistical Association, 90: 577-588.
MacEachern, S.N. (1998) Computational Methods for Mixture of Dirichlet Process Models, in Practical Nonparametric and Semiparametric Bayesian Statistics, eds: D. Dey, P. Muller, D. Sinha, New York: Springer-Verlag, pp. 1-22.
Molenberghs, G. and Verbeke, G. (2005). Models for discrete longitudinal data, New York: Springer-Verlag.
Muliere, P. and Tardella, L. (1998) Approximating distributions of random functionals of Ferguson-Dirichlet priors. The Canadian Journal of Statistics, 26(2): 283-297.
DPMrandom
,
DPMglmm
, DPMlmm
,
DPlmm
, DPglmm
, DPolmm
,
PTlmm
, PTglmm
, PTolmm
## Not run: # Schizophrenia Data data(psychiatric) attach(psychiatric) # MCMC parameters nburn<-5000 nsave<-10000 nskip<-10 ndisplay<-100 mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,ndisplay=ndisplay) # Initial state state <- NULL # Prior information prior<-list(alpha=1, tau1=0.01,tau2=0.01, nu0=4.01, tinv=diag(10,1), nub=4.01, tbinv=diag(10,1), mb=rep(0,1), Sb=diag(1000,1)) # Fitting the model fit1<-DPMolmm(fixed=imps79o~sweek+tx+sweek*tx,random=~1|id,prior=prior, mcmc=mcmc,state=state,status=TRUE) fit1 # Summary with HPD and Credibility intervals summary(fit1) summary(fit1,hpd=FALSE) # Plot model parameters plot(fit1) # Plot an specific model parameter plot(fit1,ask=FALSE,nfigr=1,nfigc=2,param="sigma-(Intercept)") plot(fit1,ask=FALSE,nfigr=1,nfigc=2,param="ncluster") # Extract random effects DPMrandom(fit1) DPMrandom(fit1,centered=TRUE) # Extract predictive information of random effects pred <- DPMrandom(fit1,predictive=TRUE) plot(pred) ## End(Not run)