fit_lmx | R Documentation |
Fit lm, lme, or lmer
fit_lmx(
object,
fit,
formula = as.formula("~ subgroup"),
drop = varlevels_dont_clash(object, all.vars(formula)),
codingfun = contr.treatment.explicit,
coefs = model_coefs(object, formula = formula, drop = drop, codingfun = codingfun),
block = NULL,
opt = "optim",
weightvar = if ("weights" %in% assayNames(object)) "weights" else NULL,
statvars = c("effect", "p", "se", "t")[1:2],
ftest = if (is.null(coefs)) TRUE else FALSE,
sep = FITSEP,
suffix = paste0(sep, fit),
verbose = TRUE,
plot = FALSE
)
fit_lm(
object,
formula = as.formula("~ subgroup"),
drop = varlevels_dont_clash(object, all.vars(formula)),
codingfun = contr.treatment.explicit,
design = NULL,
block = NULL,
weightvar = if ("weights" %in% assayNames(object)) "weights" else NULL,
statvars = c("effect", "p", "se", "t")[1:2],
sep = FITSEP,
suffix = paste0(sep, "lm"),
coefs = model_coefs(object, formula = formula, drop = drop, codingfun = codingfun),
contrasts = NULL,
ftest = if (is.null(coefs)) TRUE else FALSE,
verbose = TRUE,
plot = FALSE
)
fit_lme(
object,
formula = as.formula("~ subgroup"),
drop = varlevels_dont_clash(object, all.vars(formula)),
codingfun = contr.treatment.explicit,
design = NULL,
block = NULL,
weightvar = if ("weights" %in% assayNames(object)) "weights" else NULL,
opt = "optim",
statvars = c("effect", "p", "se", "t")[1:2],
sep = FITSEP,
suffix = paste0(sep, "lme"),
coefs = model_coefs(object, formula = formula, drop = drop, codingfun = codingfun),
contrasts = NULL,
ftest = if (is.null(coefs)) TRUE else FALSE,
verbose = TRUE,
plot = FALSE
)
fit_lmer(
object,
formula = as.formula("~ subgroup"),
drop = varlevels_dont_clash(object, all.vars(formula)),
codingfun = contr.treatment.explicit,
design = NULL,
block = NULL,
weightvar = if ("weights" %in% assayNames(object)) "weights" else NULL,
statvars = c("effect", "p", "se", "t")[1:2],
sep = FITSEP,
suffix = paste0(sep, "lmer"),
coefs = model_coefs(object, formula = formula, drop = drop, codingfun = codingfun),
contrasts = NULL,
ftest = if (is.null(coefs)) TRUE else FALSE,
verbose = TRUE,
plot = FALSE
)
object |
SummarizedExpriment |
fit |
'lm', 'lme', or 'lmer' |
formula |
formula |
drop |
TRUE or FALSE |
codingfun |
coding function |
coefs |
NULL or stringvector |
block |
NULL or svar |
opt |
optimizer used in fit_lme: 'optim' (more robust) or 'nlminb' |
weightvar |
NULL or svar |
statvars |
character vector: subset of c('effect', 'p', 'fdr', 't') |
ftest |
TRUE or FALSE |
sep |
string |
suffix |
string: pvar suffix ("lm" in "p~t2~lm") |
verbose |
TRUE or FALSE |
plot |
TRUE or FALSE |
design |
NULL |
contrasts |
unused. only to allow generic get(fitfun)(contrasts) |
SummarizedExperiment
file <- system.file('extdata/atkin.metabolon.xlsx', package = 'autonomics')
object <- read_metabolon(file)
fit_lm( object, formula = ~subgroup)
fit_limma( object, formula = ~subgroup)
fit_limma( object, formula = ~subgroup, block = 'Subject' )
fit_lme( object, formula = ~subgroup, block = 'Subject' )
fit_lmer( object, formula = ~subgroup, block = 'Subject' )
# fit_lme( object, formula = ~subgroup, block = ~1|Subject) # needs fine-tuning
# fit_lmer( object, formula = ~subgroup + (1|Subject)) # needs fine-tuning
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.