| clme_em_fixed {CLME} | R Documentation |
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 |
|
X1 |
|
X2 |
optional |
U |
optional |
Nks |
optional |
Qs |
optional |
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 |
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 |
... |
space for additional arguments. |
Details
Argument constraints is a list including at least the elements A, B, and Anull. This argument can be generated by function create.constraints.
Value
The function returns a list with the elements:
thetacoefficient estimates.theta.nullvector of coefficient estimates under the null hypothesis.ssqestimate of residual variance term(s).tsqestimate of variance components for any random effects.cov.thetacovariance matrix of the unconstrained coefficients.ts.glbtest statistic for the global hypothesis.ts.indtest statistics for each of the constraints.mySolverthe solver used for isotonization.
Note
There are few error catches in these functions. If only the EM estimates are desired,
users are recommended to run clme setting nsim=0.
By default, homogeneous variances are assumed for the residuals and (if included)
random effects. Heterogeneity can be induced using the arguments Nks and Qs,
which refer to the vectors (n_{1}, n_{2}, \ldots, n_{k}) and
(c_{1}, c_{2}, \ldots, c_{q}) , respectively. See
CLME-package for further explanation the model and these values.
See w.stat and lrt.stat for more details on using custom
test statistics.
See Also
CLME-package
clme
create.constraints
lrt.stat
w.stat
Examples
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)