| clme {CLME} | R Documentation |
Constrained Inference for Linear Mixed Effects Models
Description
Constrained inference for linear fixed or mixed effects models using distribution-free bootstrap methodology
Usage
clme(
formula,
data = NULL,
gfix = NULL,
constraints = list(),
tsf = lrt.stat,
tsf.ind = w.stat.ind,
mySolver = "LS",
all_pair = FALSE,
verbose = c(FALSE, FALSE, FALSE),
...
)
Arguments
formula |
a formula expression. The constrained effect must come before any unconstrained covariates on the right-hand side of the expression. The constrained effect should be an ordered factor. |
data |
data frame containing the variables in the model. |
gfix |
optional vector of group levels for residual variances. Data should be sorted by this value. |
constraints |
optional list containing the constraints. See Details for further information. |
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 |
all_pair |
logical, whether all pairwise comparisons should be considered (constraints will be ignored). |
verbose |
optional. Vector of 3 logicals. The first causes printing of iteration step, the second two are passed as the |
... |
space for additional arguments. |
Details
If any random effects are included, the function computes MINQUE estimates of variance components. After,
clme_em is run to obtain the observed values. If nsim>0, a bootstrap test is performed
using resid_boot.
For the argument levels the first list element should be the column index (in data) of the
constrained effect. The second element should be the true order of the levels.
Value
The output of clme is an object of the class clme, which is list with elements:
thetaestimates of\thetacoefficientsthetaestimates of\theta_0coefficients under the null hypothesisssqestimate of residual variance(s),\sigma^{2}_{i}.tsqestimate of random effects variance component(s),\tau^{2}_{i}.cov.thetathe unconstrained covariance matrix of\thetats.glbtest statistic for the global hypothesis.ts.indtest statistics for each of the constraints.mySolverthe solver used for isotonization.constraintslist containing the constraints (A) and the contrast for the global test (B).dframedata frame containing the variables in the model.residualsmatrix containing residuals. For mixed models three types of residuals are given.random.effectsestimates of random effects.gfixgroup sample sizes for residual variances.grangroup sizes for random effect variance components.gfix_groupgroup names for residual variances.formulathe formula used in the model.callthe function call.orderlist describing the specified or estimated constraints.P1the number of constrained parameters.nsimthe number of bootstrap simulations used for inference.
Note
The argument constraints is a list containing the order restrictions. The elements are
order, node, decreasing, A, and B, though not all are necessary.
The function can calculate the last two for default orders (simple, umbrella, or simple tree). For
default orders, constraints should be a list containing any subset of order,
node, and descending. See Figure 1 from Jelsema \& Peddada (2016); the
pictured node of the simple tree orders (middle column) is 1, and the node for the
umbrella orders (right column) is 3. These may be vectors (e.g. order=('simple','umbrella') ).
If any of these three are missing, the function will test for all possible values of the missing
element(s), excluding simple tree.
For non-default orders, the elements A and B should be provided. A is an
r \times2 matrix (where r is the number of linear constraints, 0 < r.
Each row should contain two indices, the first element is the index of the lesser coefficient, the
second element is the index of the greater coefficient. So a row of (1,2) corresponds
to the constraint \theta_1 \leq \theta_2, and a row (4,3)
corresponds to the constraint \theta_4 \leq \theta_3, etc. Element B
should hold similar contrasts, specifically those needed for calculating the Williams' type test
statistic (B is only needed if tsf=w.stat)
The argument tsf is a function to calculate the desired test statistic. The default function
calculates likelihood ratio type test statistic. A Williams type test statistic, which is the maximum
of the test statistic over the constraints in constraints\$B, is also available, and custom
functions may be defined. See w.stat for details.
By default, homogeneity of variances is assumed for residuals (e.g., gfix does not define groups)
and for each random effect.
Some values can be passed to clme that are not used in this function. For instance,
seed and nsim can each be passed as an argument here, and summary.clme will
use these values.
References
Jelsema, C. M. and Peddada, S. D. (2016). CLME: An R Package for Linear Mixed Effects Models under Inequality Constraints. Journal of Statistical Software, 75(1), 1-32. doi:10.18637/jss.v075.i01
Examples
data( rat.blood )
cons <- list(order="simple", decreasing=FALSE, node=1 )
clme.out <- clme(mcv ~ time + temp + sex + (1|id), data=rat.blood ,
constraints=cons, seed=42, nsim=10 )