Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 6, 2024
1 parent 629a568 commit cb260d8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 85 deletions.
105 changes: 32 additions & 73 deletions R/find_parameters_mixed.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,11 @@ find_parameters.nlmerMod <- function(x, effects = "all", component = "all", flat
}


#' @rdname find_parameters.glmmTMB
#' @export
find_parameters.hglm <- function(x,
effects = c("all", "fixed", "random"),
component = c("all", "conditional", "dispersion"),
flatten = FALSE,
...) {
effects <- match.arg(effects)
find_parameters.hglm <- function(x, effects = "all", component = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
component <- validate_argument(component, c("all", "conditional", "dispersion"))

fe <- x$fixef
re <- x$ranef

Expand All @@ -173,13 +170,9 @@ find_parameters.hglm <- function(x,
}


#' @rdname find_parameters.glmmTMB
#' @export
find_parameters.merMod <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
effects <- match.arg(effects)
find_parameters.merMod <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))

# installed
check_if_installed("lme4")
Expand Down Expand Up @@ -207,21 +200,15 @@ find_parameters.rlmerMod <- find_parameters.merMod
find_parameters.glmmadmb <- find_parameters.merMod

#' @export
find_parameters.merModList <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
effects <- match.arg(effects)
find_parameters.merModList <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
find_parameters(x[[1]], effects = effects, flatten = flatten, ...)
}


#' @export
find_parameters.svy2lme <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
effects <- match.arg(effects)
find_parameters.svy2lme <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))

# we extract random effects only when really necessary, to save
# computational time. In particular model with large sample and
Expand All @@ -241,11 +228,8 @@ find_parameters.svy2lme <- function(x,


#' @export
find_parameters.HLfit <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
effects <- match.arg(effects)
find_parameters.HLfit <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))

# installed
check_if_installed("lme4")
Expand All @@ -269,16 +253,13 @@ find_parameters.HLfit <- function(x,


#' @export
find_parameters.sem <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
find_parameters.sem <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))

if (!.is_semLme(x)) {
return(NULL)
}

effects <- match.arg(effects)

l <- compact_list(list(
conditional = names(x$coef),
random = colnames(x$ranef)
Expand All @@ -289,15 +270,11 @@ find_parameters.sem <- function(x,


#' @export
find_parameters.cpglmm <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
find_parameters.cpglmm <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
# installed
check_if_installed("cplm")

effects <- match.arg(effects)

# we extract random effects only when really necessary, to save
# computational time. In particular model with large sample and
# many random effects groups may take some time to return random effects
Expand All @@ -316,14 +293,10 @@ find_parameters.cpglmm <- function(x,


#' @export
find_parameters.coxme <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
find_parameters.coxme <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
check_if_installed("lme4")

effects <- match.arg(effects)

if (effects == "fixed") {
l <- list(conditional = names(lme4::fixef(x)))
} else {
Expand All @@ -342,15 +315,11 @@ find_parameters.coxme <- function(x,


#' @export
find_parameters.mixed <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
find_parameters.mixed <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
# installed
check_if_installed("lme4")

effects <- match.arg(effects)

if (effects == "fixed") {
l <- list(conditional = names(lme4::fixef(x$full_model)))
} else {
Expand All @@ -365,14 +334,10 @@ find_parameters.mixed <- function(x,


#' @export
find_parameters.lme <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
find_parameters.lme <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))
check_if_installed("lme4")

effects <- match.arg(effects)

if (effects == "fixed") {
l <- list(conditional = names(lme4::fixef(x)))
} else {
Expand All @@ -394,11 +359,9 @@ find_parameters.lme <- function(x,


#' @export
find_parameters.glmm <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
effects <- match.arg(effects)
find_parameters.glmm <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))

s <- summary(x)
fe_params <- rownames(s$coefmat)
re_params <- rownames(s$nucoefmat)
Expand All @@ -413,16 +376,14 @@ find_parameters.glmm <- function(x,


#' @export
find_parameters.BBmm <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
find_parameters.BBmm <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))

l <- compact_list(list(
conditional = rownames(x$fixed.coef),
random = x$namesRand
))

effects <- match.arg(effects)
.filter_parameters(l,
effects = effects,
flatten = flatten,
Expand All @@ -432,16 +393,14 @@ find_parameters.BBmm <- function(x,


#' @export
find_parameters.glimML <- function(x,
effects = c("all", "fixed", "random"),
flatten = FALSE,
...) {
find_parameters.glimML <- function(x, effects = "all", flatten = FALSE, ...) {
effects <- validate_argument(effects, c("all", "fixed", "random"))

l <- compact_list(list(
conditional = names(x@fixed.param),
random = names(x@random.param)
))

effects <- match.arg(effects)
.filter_parameters(l,
effects = effects,
flatten = flatten,
Expand Down
12 changes: 0 additions & 12 deletions man/find_parameters.glmmTMB.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb260d8

Please sign in to comment.