Skip to content

Commit 8ac43e0

Browse files
committed
fix
1 parent 1191650 commit 8ac43e0

18 files changed

+96
-271
lines changed

R/1_model_parameters.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#' **psych**, `sem`, ...
2929
#' - [Zero-inflated and hurdle][model_parameters.zcpglm()]: **cplm**, **mhurdle**,
3030
#' **pscl**, ...
31-
#' - [Other models][model_parameters.averaging()]: **aod**, **bbmle**, **betareg**,
31+
#' - [Other models][model_parameters.glimML()]: **aod**, **bbmle**, **betareg**,
3232
#' **emmeans**, **epiR**, **ggeffects**, **glmx**, **ivfixed**, **ivprobit**,
3333
#' **JRM**, **lmodel2**, **logitsf**, **marginaleffects**, **margins**, **maxLik**,
3434
#' **mediation**, **mfx**, **multcomp**, **mvord**, **plm**, **PMCMRplus**,

R/bootstrap_model.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ bootstrap_model.default <- function(model,
7575

7676
insight::check_if_installed("boot")
7777

78-
type <- insight::validate_argument(type, c("ordinary", "parametric", "balanced", "permutation", "antithetic"))
78+
type <- insight::validate_argument(
79+
type,
80+
c("ordinary", "parametric", "balanced", "permutation", "antithetic")
81+
)
7982
parallel <- match.arg(parallel)
8083

8184
model_data <- data <- insight::get_data(model, verbose = FALSE) # nolint
@@ -228,7 +231,10 @@ bootstrap_model.nestedLogit <- function(model,
228231
...) {
229232
insight::check_if_installed("boot")
230233

231-
type <- insight::validate_argument(type, c("ordinary", "balanced", "permutation", "antithetic"))
234+
type <- insight::validate_argument(
235+
type,
236+
c("ordinary", "balanced", "permutation", "antithetic")
237+
)
232238
parallel <- match.arg(parallel)
233239

234240
model_data <- data <- insight::get_data(model, verbose = FALSE) # nolint

R/extract_random_variances.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@
4545
ci_random = NULL,
4646
verbose = FALSE,
4747
...) {
48-
component <- insight::validate_argument(component, c("all", "conditional", "zero_inflated", "zi", "dispersion"))
48+
component <- insight::validate_argument(
49+
component,
50+
c("all", "conditional", "zero_inflated", "zi", "dispersion")
51+
)
4952

5053
out <- suppressWarnings(
5154
.extract_random_variances_helper(

R/methods_aod.R

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,43 @@
66

77
#################### .glimML ------
88

9-
10-
#' @rdname model_parameters.averaging
9+
#' Parameters from special models
10+
#'
11+
#' Parameters from special regression models not listed under one of the previous categories yet.
12+
#'
13+
#' @param component Model component for which parameters should be shown. May be
14+
#' one of `"conditional"`, `"precision"` (**betareg**),
15+
#' `"scale"` (**ordinal**), `"extra"` (**glmx**),
16+
#' `"marginal"` (**mfx**), `"conditional"` or `"full"` (for
17+
#' `MuMIn::model.avg()`) or `"all"`.
18+
#' @param include_studies Logical, if `TRUE` (default), includes parameters
19+
#' for all studies. Else, only parameters for overall-effects are shown.
20+
#' @inheritParams model_parameters.default
21+
#' @inheritParams model_parameters.stanreg
22+
#' @inheritParams simulate_model
23+
#'
24+
#' @seealso [insight::standardize_names()] to rename
25+
#' columns into a consistent, standardized naming scheme.
26+
#'
27+
#' @examples
28+
#' library(parameters)
29+
#' if (require("brglm2", quietly = TRUE)) {
30+
#' data("stemcell")
31+
#' model <- bracl(
32+
#' research ~ as.numeric(religion) + gender,
33+
#' weights = frequency,
34+
#' data = stemcell,
35+
#' type = "ML"
36+
#' )
37+
#' model_parameters(model)
38+
#' }
39+
#' @return A data frame of indices related to the model's parameters.
1140
#' @export
1241
model_parameters.glimML <- function(model,
1342
ci = 0.95,
1443
bootstrap = FALSE,
1544
iterations = 1000,
16-
component = c("conditional", "random", "dispersion", "all"),
45+
component = "conditional",
1746
standardize = NULL,
1847
exponentiate = FALSE,
1948
p_adjust = NULL,
@@ -23,7 +52,10 @@ model_parameters.glimML <- function(model,
2352
drop = NULL,
2453
verbose = TRUE,
2554
...) {
26-
component <- match.arg(component)
55+
component <- insight::validate_argument(
56+
component,
57+
c("conditional", "random", "dispersion", "all")
58+
)
2759
if (component == "all") {
2860
merge_by <- c("Parameter", "Component")
2961
} else {

R/methods_averaging.R

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,6 @@
22

33
#################### .averaging
44

5-
6-
#' Parameters from special models
7-
#'
8-
#' Parameters from special regression models not listed under one of the previous categories yet.
9-
#'
10-
#' @param component Model component for which parameters should be shown. May be
11-
#' one of `"conditional"`, `"precision"` (**betareg**),
12-
#' `"scale"` (**ordinal**), `"extra"` (**glmx**),
13-
#' `"marginal"` (**mfx**), `"conditional"` or `"full"` (for
14-
#' `MuMIn::model.avg()`) or `"all"`.
15-
#' @param include_studies Logical, if `TRUE` (default), includes parameters
16-
#' for all studies. Else, only parameters for overall-effects are shown.
17-
#' @inheritParams model_parameters.default
18-
#' @inheritParams model_parameters.stanreg
19-
#' @inheritParams simulate_model
20-
#'
21-
#' @seealso [insight::standardize_names()] to rename
22-
#' columns into a consistent, standardized naming scheme.
23-
#'
24-
#' @examples
25-
#' library(parameters)
26-
#' if (require("brglm2", quietly = TRUE)) {
27-
#' data("stemcell")
28-
#' model <- bracl(
29-
#' research ~ as.numeric(religion) + gender,
30-
#' weights = frequency,
31-
#' data = stemcell,
32-
#' type = "ML"
33-
#' )
34-
#' model_parameters(model)
35-
#' }
36-
#' @return A data frame of indices related to the model's parameters.
375
#' @export
386
model_parameters.averaging <- function(model,
397
ci = 0.95,

R/methods_betareg.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
## TODO add ci_method later?
22

3-
#' @rdname model_parameters.averaging
43
#' @export
54
model_parameters.betareg <- function(model,
65
ci = 0.95,
76
bootstrap = FALSE,
87
iterations = 1000,
9-
component = c("conditional", "precision", "all"),
8+
component = "conditional",
109
standardize = NULL,
1110
exponentiate = FALSE,
1211
p_adjust = NULL,
@@ -30,7 +29,7 @@ model_parameters.betareg <- function(model,
3029
include_info <- summary
3130
}
3231

33-
component <- match.arg(component)
32+
component <- insight::validate_argument(component, c("conditional", "precision", "all"))
3433
if (component == "all") {
3534
merge_by <- c("Parameter", "Component")
3635
} else {

R/methods_emmeans.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ model_parameters.emmGrid <- function(model,
142142
}
143143

144144

145-
#' @rdname model_parameters.averaging
146145
#' @export
147146
model_parameters.emm_list <- function(model,
148147
ci = 0.95,

R/methods_glmmTMB.R

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,14 @@ model_parameters.glmmTMB <- function(model,
198198
ci_method <- .check_df_method(ci_method)
199199

200200
# which components to return?
201-
effects <- insight::validate_argument(effects, c("fixed", "random", "all"))
202-
component <- insight::validate_argument(component, c("all", "conditional", "zi", "zero_inflated", "dispersion"))
201+
effects <- insight::validate_argument(
202+
effects,
203+
c("fixed", "random", "all")
204+
)
205+
component <- insight::validate_argument(
206+
component,
207+
c("all", "conditional", "zi", "zero_inflated", "dispersion")
208+
)
203209

204210
# standardize only works for fixed effects...
205211
if (!is.null(standardize) && standardize != "refit") {
@@ -419,8 +425,14 @@ ci.glmmTMB <- function(x,
419425
verbose = TRUE,
420426
...) {
421427
method <- tolower(method)
422-
method <- insight::validate_argument(method, c("wald", "normal", "ml1", "betwithin", "profile", "uniroot", "robust"))
423-
component <- insight::validate_argument(component, c("all", "conditional", "zi", "zero_inflated", "dispersion"))
428+
method <- insight::validate_argument(
429+
method,
430+
c("wald", "normal", "ml1", "betwithin", "profile", "uniroot", "robust")
431+
)
432+
component <- insight::validate_argument(
433+
component,
434+
c("all", "conditional", "zi", "zero_inflated", "dispersion")
435+
)
424436

425437
if (is.null(.check_component(x, component, verbose = verbose))) {
426438
return(NULL)
@@ -466,7 +478,10 @@ standard_error.glmmTMB <- function(model,
466478
component = "all",
467479
verbose = TRUE,
468480
...) {
469-
component <- insight::validate_argument(component, c("all", "conditional", "zi", "zero_inflated", "dispersion"))
481+
component <- insight::validate_argument(
482+
component,
483+
c("all", "conditional", "zi", "zero_inflated", "dispersion")
484+
)
470485
effects <- insight::validate_argument(effects, c("fixed", "random"))
471486

472487
dot_args <- .check_dots(
@@ -528,7 +543,10 @@ simulate_model.glmmTMB <- function(model,
528543
component = "all",
529544
verbose = FALSE,
530545
...) {
531-
component <- insight::validate_argument(component, c("all", "conditional", "zi", "zero_inflated", "dispersion"))
546+
component <- insight::validate_argument(
547+
component,
548+
c("all", "conditional", "zi", "zero_inflated", "dispersion")
549+
)
532550
info <- insight::model_info(model, verbose = FALSE)
533551

534552
## TODO remove is.list() when insight 0.8.3 on CRAN

R/methods_glmx.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
#' @rdname model_parameters.averaging
21
#' @export
32
model_parameters.glmx <- function(model,
43
ci = 0.95,
54
bootstrap = FALSE,
65
iterations = 1000,
7-
component = c("all", "conditional", "extra"),
6+
component = "all",
87
standardize = NULL,
98
exponentiate = FALSE,
109
p_adjust = NULL,
1110
keep = NULL,
1211
drop = NULL,
1312
verbose = TRUE,
1413
...) {
15-
component <- match.arg(component)
14+
component <- insight::validate_argument(component, c("all", "conditional", "extra"))
1615
if (component == "all") {
1716
merge_by <- c("Parameter", "Component")
1817
} else {

R/methods_marginaleffects.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
# model_parameters ----------------
55

6-
#' @rdname model_parameters.averaging
76
#' @export
87
model_parameters.marginaleffects <- function(model,
98
ci = 0.95,

0 commit comments

Comments
 (0)