pglmmObj
of Fitted Penalized Generalized Mixed-Effects Models for
package glmmPen
The functions glmm
, glmmPen
,
glmm_FA
, and glmmPen_FA
from the package glmmPen
output the reference class object of type pglmmObj
.
# S3 method for pglmmObj
fixef(object, ...)# S3 method for pglmmObj
ranef(object, ...)
# S3 method for pglmmObj
sigma(object, ...)
# S3 method for pglmmObj
coef(object, ...)
# S3 method for pglmmObj
family(object, ...)
# S3 method for pglmmObj
nobs(object, ...)
# S3 method for pglmmObj
ngrps(object, ...)
# S3 method for pglmmObj
formula(x, fixed.only = FALSE, random.only = FALSE, ...)
# S3 method for pglmmObj
model.frame(formula, fixed.only = FALSE, ...)
# S3 method for pglmmObj
model.matrix(object, type = c("fixed", "random"), ...)
# S3 method for pglmmObj
fitted(object, fixed.only = TRUE, ...)
# S3 method for pglmmObj
predict(
object,
newdata = NULL,
type = c("link", "response"),
fixed.only = TRUE,
...
)
# S3 method for pglmmObj
residuals(object, type = c("deviance", "pearson", "response", "working"), ...)
# S3 method for pglmmObj
print(x, digits = c(fef = 4, ref = 4), ...)
# S3 method for pglmmObj
summary(
object,
digits = c(fef = 4, ref = 4),
resid_type = switch(object$family$family, gaussian = "pearson", "deviance"),
...
)
# S3 method for pglmmObj
logLik(object, ...)
# S3 method for pglmmObj
BIC(object, ...)
# S3 method for pglmmObj
plot(x, fixed.only = FALSE, type = NULL, ...)
The pglmmObj object returns the following items:
vector of fixed effects coefficients
matrix of random effects coefficients for each explanatory variable for each level of the grouping factor
random effects covariance matrix
if family is Gaussian, returns the residual error variance
Samples from the posterior distribution of the random effects, taken at the end of the model fit (after convergence or after maximum iterations allowed). Can be used for diagnositics purposes. Note: These posterior samples are from a single chain.
character string for type of sampling used to calculate the posterior samples in the E-step of the algorithm
matrix of results from all model fits during variable selection (if selection
performed). Output for each model includes: penalty parameters for fixed (lambda0) and random
(lambda1) effects, BIC-derived quantities and the log-likelihood
(note: the arguments BIC_option
and logLik_calc
in selectControl
determine which of these quantities are calculated for each model),
the number of non-zero fixed and random effects (includes intercept),
number of EM iterations used for model fit, whether or not the
model converged (0 for no vs 1 for yes), and the fixed and random effects coefficients
results from the 'best' model fit; see results_all for details. BICh, BIC, BICNgrp, and LogLik computed for this best model if not previously calculated.
Family
list of penalty information
arguments plugged into glmm
, glmmPen
, glmm_FA
, or
glmmPen_FA
formula
names of fixed effects variables
list of data used in model fit, including the response y, the fixed effects covariates matrix X, the random effects model matrix Z (which is composed of values from the standardized fixed effects model matrix), the grouping factor, offset, model frame, and standarization information used to standardize the fixed effects covariates
Information about the optimization of the 'best' model
optimization parameters used for the model fit
materials that can be used to initialize another E-step, if desired
list of materials to perform diagnositics on the Metropolis-within-Gibbs sample chains, including the Gibbs acceptance rates (included for both the independence and adaptive random walk samplers) and the final proposal standard deviations (included for the adaptive random walk sampler only))
list of output related to estimation of number of latent common
factors, r. Only relevant for the output of functions glmm_FA
and
glmmPen_FA
, which are currently in development and are not yet ready for
general use.
showClass("pglmmObj") methods(class = "pglmmObj")
pglmmObj object output from glmm
, glmmPen
, or glmmPen_FineSearch
potentially further arguments passed from other methods
an R object of class pglmmObj
logical value; default TRUE
indicates that only the
fixed effects
should be used in the fitted value/prediction, while FALSE
indicates that both the fixed and
random effects posterior modes should be used in the fitted value/prediction
logical value used in formula
; TRUE
indicates that
only the formula elements relating to the random effects should be returned
in the case of model.frame, a pglmmObj
object
See details of type
options for each function under "Functions" section.
optional new data.frame containing the same variables used in the model fit procedure
number of significant digits for printing; default of 4
type of residuals to summarize in output. See predict.pglmmObj
for residual options available.
fixef.pglmmObj
: Provides the fixed effects coefficients
ranef.pglmmObj
: Provides the random effects posterior modes for each explanatory variable
for each level of the grouping factor
sigma.pglmmObj
: Provides the random effect covariance matrix. If family is Gaussian,
also returns the standard deviation of the residual error.
coef.pglmmObj
: Computes the sum of the fixed effects
coefficients and the random effect posterior modes
for each explanatory variable for each level of each grouping factor.
family.pglmmObj
: Family of the fitted GLMM
nobs.pglmmObj
: Number of observations used in the model fit
ngrps.pglmmObj
: Number of levels in the grouping factor
formula.pglmmObj
: Formula used for the model fit. Can return the full
formula, or just the formula elements relating to the fixed effects
(fixed.only = TRUE) or random effects (random.only = TRUE)
model.frame.pglmmObj
: Returns the model frame
model.matrix.pglmmObj
: Returns the model matrix of either the fixed (type = "fixed") or
random effects (type = "random")
fitted.pglmmObj
: Fitted values, i.e., the linear predictor of the model.
predict.pglmmObj
: Predictions for the model corresponding to
the pglmmObj output object from the glmmPen package functions. The function
predict
can predict either the linear predictor of the model or the
expected mean of the response, as specified by the type
argument.
Argument type
: character string for type of predictors: "link" (default),
which generates the linear predictor,
and "response", which generates the expected mean values of the response.
residuals.pglmmObj
: Residuals for the pglmmObj output object from the glmmPen package functions.
Argument type
: character string for type of residuals to report. Options include "deviance" (default),
"pearson", "response", and "working", which specify the deviance residuals, Pearson residuals,
the difference between the actual response y and the expected mean response (y - mu), and the
working residuals (y - mu) / mu
print.pglmmObj
: Prints a selection of summary information of fitted model
summary.pglmmObj
: Returns a list of summary statistics of the fitted model.
logLik.pglmmObj
: Returns the log-likelihood using the Corrected Arithmetic Mean estimator
with importance sampling weights developed by Pajor (2017). Degrees of freedom
give the sum of the non-zero fixed and random effects coefficients.
Citation: Pajor, A. (2017). Estimating the marginal likelihood using the arithmetic mean identity.
Bayesian Analysis, 12(1), 261-287.
BIC.pglmmObj
: Returns BIC, BICh (hybrid BIC developed by Delattre et al., citation:
Delattre, M., Lavielle, M., & Poursat, M. A. (2014). A note on BIC in mixed-effects models.
Electronic journal of statistics, 8(1), 456-475.), BICNgrps (BIC using N = number of groups
in the penalty term), and possibly BIC-ICQ (labeled as "BICq") if the argument BIC_option
was set to "BICq" in selectControl
(citation for BIC-ICQ:
Ibrahim, J. G., Zhu, H., Garcia, R. I., & Guo, R. (2011).
Fixed and random effects selection in mixed effects models. Biometrics, 67(2), 495-503.)
plot.pglmmObj
: Plot residuals for the pglmmObj output object from the glmmPen package.
Argument type
: character string for type of residuals to report. Options include "deviance"
(default for non-Gaussian family), "pearson" (default for Gaussian family),
"response", and "working", which specify the deviance residuals, Pearson residuals,
the difference between the actual response y and the expected mean response (y - mu), and the
working residuals (y - mu) / mu