Learn R Programming

mixtools (version 0.1.0)

regmixEM.mixed: EM Algorithm for Mixtures of Regressions with Random Effects

Description

Returns EM algorithm output for mixtures of multiple regressions with random effects and an option to incorporate mixed effects.

Usage

regmixEM.mixed(y, x, w = NULL, sigma = NULL, arb.sigma = TRUE,
               alpha = NULL, lambda = NULL, mu = NULL, R = NULL, 
               arb.R = TRUE, k = 2, mixed = FALSE, 
               addintercept.fixed = FALSE, 
               addintercept.random = TRUE, epsilon = 1e-08, 
               maxit = 10000, verb = FALSE)

Arguments

y
A list of N response trajectories with (possibly) varying dimensions of length $n_i$.
x
A list of N design matrices of dimensions $(n_i)\timesp$. Each trajectory in y has it's own design matrix.
w
A list of N known explanatory variables having dimensions $(n_i)\timesq$. If mixed = FALSE, then w is replaced by a list of N zeros.
sigma
A vector of standard deviations. If NULL, then 1/s$^2$ has random standard exponential entries according to a binning method done on the data.
arb.sigma
If TRUE, then sigma is k-dimensional. Else a common standard deviation is assumed.
alpha
A q-vector of unknown regression parameters for the fixed effects. If NULL and mixed = TRUE, then alpha is random from a normal distribution with mean and variance according to a binning method done on the data. If
lambda
Initial value of mixing proportions for the assumed mixture structure on the regression coefficients. Entries should sum to 1. This determines number of components. If NULL, then lambda is random from uniform Dirichlet and the number
mu
A pxk matrix of the mean for the mixture components of the random regression coefficients. If NULL, then the columns of mu are random from a multivariate normal distribution with mean and variance determined by a binning method done on
R
A list of N pxp covariance matrices for the mixture components of the random regression coefficients. If NULL, then each matrix is random from a standard Wishart distribution according to a binning method done on the data.
arb.R
If TRUE, then R is a list of N pxp covariance matrices. Else, one common covariance matrix is assumed.
k
Number of components. Ignored unless lambda is NULL.
mixed
If TRUE, then fixed effects are incorporated. If FALSE, then only random effect are incorporated.
addintercept.fixed
If TRUE, a column of ones is appended to the matrices in w.
addintercept.random
If TRUE, a column of ones is appended to the matrices in x before p is calculated.
epsilon
The convergence criterion.
maxit
The maximum number of iterations.
verb
If TRUE, then various updates are printed during each iteration of the algorithm.

Value

  • regmixEM returns a list of class mixEM with items:
  • xThe predictor values.
  • yThe response values.
  • lambdaThe final mixing proportions.
  • muThe final mean vectors.
  • RThe final covariance matrices.
  • sigmaThe final component error variances.
  • alphaThe final regression coefficients for the fixed effects.
  • loglikThe final log-likelihood.
  • posterior.zAn Nxk matrix of posterior membership probabilities.
  • posterior.betaA list of N pxk matrices giving the posterior regression coefficient values.
  • all.loglikA vector of each iteration's log-likelihood.
  • ftA character vector giving the name of the function.

References

Xu, W. and Hedeker, D. (2001) A Random-Effects Mixture Model for Classifying Treatment Response in Longitudinal Clinical Trials, Journal of Biopharmaceutical Statistics, 11(4), 253--273.

See Also

regmixEM, post.beta

Examples

Run this code
## EM output for simulated data from 2-component mixture of random effects.

data(RanEffdata)
x<-lapply(1:length(RanEffdata), function(i) 
          matrix(RanEffdata[[i]][, 2:3], ncol = 2))
x<-x[1:20]
y<-lapply(1:length(RanEffdata), function(i) 
          matrix(RanEffdata[[i]][, 1], ncol = 1))
y<-y[1:20]
lambda<-c(0.45, 0.55)
mu<-matrix(c(0, 4, 100, 12), 2, 2)
sigma<-2
R<-list(diag(1, 2), diag(1, 2))
em.out<-regmixEM.mixed(y, x, sigma = sigma, arb.sigma = FALSE,
                       lambda = lambda, mu = mu, R = R,
                       addintercept.random = FALSE,
                       epsilon = 1e-02, verb = TRUE)
em.out[3:8]

Run the code above in your browser using DataLab