Learn R Programming

CLME (version 2.0-12)

clme_em_fixed: Constrained EM algorithm for linear fixed or mixed effects models.

Description

clme_em_fixed performs a constrained EM algorithm for linear fixed effects models.

clme_em_mixed performs a constrained EM algorithm for linear mixed effects models.

clme_em is the general function, it will call the others. These Expectation-maximization (EM) algorithms estimate model parameters and compute a test statistic.

Usage

clme_em_fixed(
  Y,
  X1,
  X2 = NULL,
  U = NULL,
  Nks = dim(X1)[1],
  Qs = dim(U)[2],
  constraints,
  mq.phi = NULL,
  tsf = lrt.stat,
  tsf.ind = w.stat.ind,
  mySolver = "LS",
  em.iter = 500,
  em.eps = 1e-04,
  all_pair = FALSE,
  dvar = NULL,
  verbose = FALSE,
  ...
)

clme_em_mixed( Y, X1, X2 = NULL, U = NULL, Nks = dim(X1)[1], Qs = dim(U)[2], constraints, mq.phi = NULL, tsf = lrt.stat, tsf.ind = w.stat.ind, mySolver = "LS", em.iter = 500, em.eps = 1e-04, all_pair = FALSE, dvar = NULL, verbose = FALSE, ... )

clme_em( Y, X1, X2 = NULL, U = NULL, Nks = nrow(X1), Qs = ncol(U), constraints, mq.phi = NULL, tsf = lrt.stat, tsf.ind = w.stat.ind, mySolver = "LS", em.iter = 500, em.eps = 1e-04, all_pair = FALSE, dvar = NULL, verbose = FALSE, ... )

Arguments

Y

\(N \times 1\) vector of response data.

X1

\(N \times p_1\) design matrix.

X2

optional \(N \times p_2\) matrix of covariates.

U

optional \(N \times c\) matrix of random effects.

Nks

optional \(K \times 1\) vector of group sizes.

Qs

optional \(Q \times 1\) vector of group sizes for random effects.

constraints

list containing the constraints. See Details.

mq.phi

optional MINQUE estimates of variance parameters.

tsf

function to calculate the test statistic.

tsf.ind

function to calculate the test statistic for individual constrats. See Details for further information.

mySolver

solver to use in isotonization (passed to activeSet).

em.iter

maximum number of iterations permitted for the EM algorithm.

em.eps

criterion for convergence for the EM algorithm.

all_pair

logical, whether all pairwise comparisons should be considered (constraints will be ignored).

dvar

fixed values to replace bootstrap variance of 0.

verbose

if TRUE, function prints messages on progress of the EM algorithm.

...

space for additional arguments.

Value

The function returns a list with the elements:

  • theta coefficient estimates.

  • theta.null vector of coefficient estimates under the null hypothesis.

  • ssq estimate of residual variance term(s).

  • tsq estimate of variance components for any random effects.

  • cov.theta covariance matrix of the unconstrained coefficients.

  • ts.glb test statistic for the global hypothesis.

  • ts.ind test statistics for each of the constraints.

  • mySolver the solver used for isotonization.

Details

Argument constraints is a list including at least the elements A, B, and Anull. This argument can be generated by function create.constraints.

See Also

CLME-package clme create.constraints lrt.stat w.stat

Examples

Run this code
# NOT RUN {
data( rat.blood )

model_mats <- model_terms_clme( mcv ~ time + temp + sex + (1|id), data = rat.blood )

Y  <- model_mats$Y
X1 <- model_mats$X1
X2 <- model_mats$X2
U  <- model_mats$U

cons <- list(order = "simple", decreasing = FALSE, node = 1 )

clme.out <- clme_em(Y = Y, X1 = X1, X2 = X2, U = U, constraints = cons)

# }

Run the code above in your browser using DataLab