glmmPen | R Documentation |
glmmPen
is used to fit penalized generalized mixed models via Monte Carlo Expectation
Conditional Minimization (MCECM). The purpose of the function is to perform
variable selection on both the fixed and random effects simultaneously for the
generalized linear mixed model. glmmPen
selects the best model using
BIC-type selection criteria (see selectControl
documentation for
further details). To improve the speed of the algorithm, consider setting
var_restrictions
= "fixef" within the optimControl
options.
glmmPen(
formula,
data = NULL,
family = "binomial",
covar = NULL,
offset = NULL,
fixef_noPen = NULL,
penalty = c("MCP", "SCAD", "lasso"),
alpha = 1,
gamma_penalty = switch(penalty[1], SCAD = 4, 3),
optim_options = optimControl(),
adapt_RW_options = adaptControl(),
trace = 0,
tuning_options = selectControl(),
BICq_posterior = NULL,
progress = TRUE,
...
)
formula |
a two-sided linear formula object describing both the fixed effects and
random effects part of the model, with the response on the left of a ~ operator and the terms,
separated by + operators, on the right. Random-effects terms are distinguished by vertical bars
("|") separating expression for design matrices from the grouping factor. |
data |
an optional data frame containing the variables named in |
family |
a description of the error distribution and link function to be used in the model.
Currently, the |
covar |
character string specifying whether the covariance matrix should be unstructured
("unstructured") or diagonal with no covariances between variables ("independent").
Default is set to |
offset |
This can be used to specify an a priori known component to be included in the
linear predictor during fitting. Default set to |
fixef_noPen |
Optional vector of 0's and 1's of the same length as the number of fixed effects covariates used in the model. Value 0 indicates the variable should not have its fixed effect coefficient penalized, 1 indicates that it can be penalized. Order should correspond to the same order of the fixed effects given in the formula. |
penalty |
character describing the type of penalty to use in the variable selection procedure. Options include 'MCP', 'SCAD', and 'lasso'. Default is MCP penalty. If the random effect covariance matrix is "unstructured", then a group MCP, group SCAD, or group LASSO penalty is used on the random effects coefficients. See Breheny and Huang (2011) <doi:10.1214/10-AOAS388> and Breheny and Huang (2015) <doi:10.1007/s11222-013-9424-2> for details of these penalties. |
alpha |
Tuning parameter for the Mnet estimator which controls the relative contributions
from the MCP/SCAD/LASSO penalty and the ridge, or L2, penalty. |
gamma_penalty |
The scaling factor of the MCP and SCAD penalties. Not used by LASSO penalty. Default is 4.0 for SCAD and 3.0 for MCP. See Breheny and Huang (2011) <doi:10.1214/10-AOAS388> and Breheny and Huang (2015) <doi:10.1007/s11222-013-9424-2> for further details. |
optim_options |
a structure of class "optimControl" created
from function |
adapt_RW_options |
a list of class "adaptControl" from function |
trace |
an integer specifying print output to include as function runs. Default value is 0. See Details for more information about output provided when trace = 0, 1, or 2. |
tuning_options |
a list of class "selectControl" or "lambdaControl" resulting from
|
BICq_posterior |
an optional character string expressing the path and file
basename of a file combination that
will file-back or currently file-backs a |
progress |
a logical value indicating if additional output should be given showing the
progress of the fit procedure. If |
... |
additional arguments that could be passed into |
Argument BICq_posterior
details: If the BIC_option
in selectControl
(tuning_options
) is specified
to be 'BICq', this requests the calculation of the BIC-ICQ criterion during the selection
process. For the BIC-ICQ criterion to be calculated, a minimal penalty model assuming a small valued
lambda penalty needs to be fit, and the posterior samples from this minimal penalty model need to be used.
In order to avoid repetitive calculations of
this minimal penalty model (i.e. if the user wants to re-run glmmPen
with a different
set of penalty parameters), a big.matrix
of these
posterior samples will be file-backed as two files: a backing file with extension '.bin' and a
descriptor file with extension '.desc'. The BICq_posterior
argument should contain a
path and a filename of the form "./path/filename" such that the backingfile and
the descriptor file would then be saved as "./path/filename.bin" and "./path/filename.desc", respectively.
If BICq_posterior
is set to NULL
, then by default, the backingfile and descriptor
file are saved in the working directory as "BICq_Posterior_Draws.bin" and "BICq_Posterior_Draws.desc".
If the big matrix of posterior samples is already file-backed, BICq_posterior
should
specify the path and basename of the appropriate files (again of form "./path/filename");
the minimal penalty model
will not be fit again and the big.matrix of
posterior samples will be read using the attach.big.matrix
function of the
bigmemory
package and used in the BIC-ICQ
calculations. If the appropriate files do not exist or BICq_posterior
is specified as NULL
, the minimal penalty model will be fit and the minimal penalty model posterior
samples will be saved as specified above. The algorithm will save 10^4 posterior samples automatically.
Trace details: The value of 0 (default) does not output any extra information. The value of 1 additionally outputs the updated coefficients, updated covariance matrix values, and the number of coordinate descent iterations used for the M step for each EM iteration. When pre-screening procedure is used and/or if the BIC-ICQ criterion is requested, trace = 1 gives additional information about the penalties used for the 'minimal penalty model' fit procedure. If Stan is not used as the E-step sampling mechanism, the value of 2 outputs all of the above plus gibbs acceptance rate information for the adaptive random walk and independence samplers and the updated proposal standard deviation for the adaptive random walk.
A reference class object of class pglmmObj
for which many methods are
available (e.g. methods(class = "pglmmObj")
, see ?pglmmObj for additional documentation)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.