GridLMM_ML | R Documentation |
Uses the GridLMM approach to find the ML or REML solution to variance componenents of a linear mixed model.
GridLMM_ML(
formula,
data,
weights = NULL,
relmat = NULL,
normalize_relmat = TRUE,
initial_step = 0.5,
tolerance = 0.01,
ML = T,
REML = T,
V_setup = NULL,
save_V_folder = NULL,
diagonalize = T,
mc.cores = my_detectCores(),
verbose = T
)
formula |
A two-sided linear formula as used in |
data |
A data frame containing the variables named in |
weights |
An optional vector of observation-specific weights. |
relmat |
A list of matrices that are proportional to the (within) covariance structures of the group level effects.
The names of the matrices should correspond to the columns in |
normalize_relmat |
Should the relmats be normalized to mean(diag)==1? |
initial_step |
See Details. |
tolerance |
See Details. |
ML |
If TRUE, ML solutions will be found. |
REML |
If TRUE, REML solutions will be found. |
V_setup |
Optional. A list produced by a GridLMM function containing the pre-processed V decompositions for each grid vertex, or the information necessary to create this. Generally saved from a previous run of GridLMM on the same data. |
save_V_folder |
Optional. A character vector giving a folder to save pre-processed V decomposition files for future / repeated use. If null, V decompositions are stored in memory |
diagonalize |
If TRUE and the model includes only a single random effect, the "GEMMA" trick will be used to diagonalize V. This is done by calculating the SVD of K, which can be slow for large samples. |
mc.cores |
Number of cores to use for parallel evaluations. |
verbose |
Should progress be printed to the screen? |
Note: this is not a particularly efficient technique for a single model. However, the calculations for each grid vertex can be re-used in later fits (ex. GWAS). This function is used internally by other GridLMM functions to find starting values.
The function uses a hill-climbing heuristic on the grid. It starts be evaluating a grid with a step size of initial_step
h^2
units.
It then halves the step size and evaluates all grid vertices adjacent to the grid vertex with the highest ML (and/or REML) value.
If a new maximum is found, the grid vertices adjacent to the new maximum are evaluated. This is repeated until no new maximum is found.
At this point, if the step size is smaller than tolerance
, the algorithm stops. Otherwise, the step size is halved again and the algorithm repeats.
A list with two elements:
results |
A data frame with each row a ML or REML solution, and columns giving additional statistics and parameter values. |
V_setup |
The |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.