glmmRefit | R Documentation |
Based on a 'GlmmSeq' or 'lmmSeq' class result object, this function attempts
to refit an identical model for a specific gene based on the data and fitting
parameters stored in the results object and refitting using either
lme4::glmer()
for GlmmSeq
objects or lmer()
for lmmSeq
objects. The
fitted model can then be passed on to other packages such as emmeans
to
look at estimated marginal means for the model.
glmmRefit(object, gene, ...) ## S3 method for class 'lmmSeq' glmmRefit(object, gene, formula = object@formula, ...) ## S3 method for class 'GlmmSeq' glmmRefit( object, gene, formula = object@formula, control = object@info$control, family = NULL, ... )
object |
A fitted results object of class |
gene |
A character value specifying a single gene to extract a fitted model for |
... |
Optional arguments passed to either |
formula |
Optional formula to use when refitting model |
control |
Optional control parameters, see |
family |
Optional GLM family when refitting GLMM using |
Fitted model of class lmerMod
in the case of LMM, or glmerMod
or
glmmTMB
for a GLMM dependent on the original method.
data(PEAC_minimal_load) disp <- apply(tpm, 1, function(x) { (var(x, na.rm = TRUE)-mean(x, na.rm = TRUE))/(mean(x, na.rm = TRUE)**2) }) glmmtest <- glmmSeq(~ Timepoint * EULAR_6m + (1 | PATID), countdata = tpm[1:2, ], metadata = metadata, dispersion = disp, verbose = FALSE) # show summary for single gene summary(glmmtest, "MS4A1") # refit a single model using lme4::glmer() fit <- glmmRefit(glmmtest, "MS4A1") # refit model with reduced formula fit2 <- glmmRefit(glmmtest, "MS4A1", formula = count ~ Timepoint + EULAR_6m + (1 | PATID)) # LRT anova(fit, fit2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.