pglmmObj-class {glmmPen} | R Documentation |
Class pglmmObj
of Fitted Penalized Generalized Mixed-Effects Models for
package glmmPen
Description
The functions glmm
, glmmPen
,
glmm_FA
, and glmmPen_FA
from the package glmmPen
output the reference class object of type pglmmObj
.
Usage
## S3 method for class 'pglmmObj'
fixef(object, ...)
## S3 method for class 'pglmmObj'
ranef(object, ...)
## S3 method for class 'pglmmObj'
sigma(object, ...)
## S3 method for class 'pglmmObj'
coef(object, ...)
## S3 method for class 'pglmmObj'
family(object, ...)
## S3 method for class 'pglmmObj'
nobs(object, ...)
## S3 method for class 'pglmmObj'
ngrps(object, ...)
## S3 method for class 'pglmmObj'
formula(x, fixed.only = FALSE, random.only = FALSE, ...)
## S3 method for class 'pglmmObj'
model.frame(formula, fixed.only = FALSE, ...)
## S3 method for class 'pglmmObj'
model.matrix(object, type = c("fixed", "random"), ...)
## S3 method for class 'pglmmObj'
fitted(object, fixed.only = TRUE, ...)
## S3 method for class 'pglmmObj'
predict(
object,
newdata = NULL,
type = c("link", "response"),
fixed.only = TRUE,
...
)
## S3 method for class 'pglmmObj'
residuals(object, type = c("deviance", "pearson", "response", "working"), ...)
## S3 method for class 'pglmmObj'
print(x, digits = c(fef = 4, ref = 4), ...)
## S3 method for class 'pglmmObj'
summary(
object,
digits = c(fef = 4, ref = 4),
resid_type = switch(object$family$family, gaussian = "pearson", "deviance"),
...
)
## S3 method for class 'pglmmObj'
logLik(object, ...)
## S3 method for class 'pglmmObj'
BIC(object, ...)
## S3 method for class 'pglmmObj'
plot(x, fixed.only = FALSE, type = NULL, ...)
Arguments
object |
pglmmObj object output from |
... |
potentially further arguments passed from other methods |
x |
an R object of class |
fixed.only |
logical value; default |
random.only |
logical value used in |
formula |
in the case of model.frame, a |
type |
See details of |
newdata |
optional new data.frame containing the same variables used in the model fit procedure |
digits |
number of significant digits for printing; default of 4 |
resid_type |
type of residuals to summarize in output. See |
Value
The pglmmObj object returns the following items:
fixef |
vector of fixed effects coefficients |
ranef |
matrix of random effects coefficients for each explanatory variable for each level of the grouping factor |
sigma |
random effects covariance matrix |
scale |
if family is Gaussian, returns the residual error variance |
posterior_samples |
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. |
sampling |
character string for type of sampling used to calculate the posterior samples in the E-step of the algorithm |
results_all |
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 |
results_optim |
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 |
Family |
penalty_info |
list of penalty information |
call |
arguments plugged into |
formula |
formula |
fixed_vars |
names of fixed effects variables |
data |
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 |
optinfo |
Information about the optimization of the 'best' model |
control_info |
optimization parameters used for the model fit |
Estep_init |
materials that can be used to initialize another E-step, if desired |
Gibbs_info |
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)) |
r_estimation |
list of output related to estimation of number of latent common
factors, r. Only relevant for the output of functions |
showClass("pglmmObj") methods(class = "pglmmObj")
Functions
-
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 functionpredict
can predict either the linear predictor of the model or the expected mean of the response, as specified by thetype
argument. Argumenttype
: 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. Argumenttype
: 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 argumentBIC_option
was set to "BICq" inselectControl
(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. Argumenttype
: 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