Skip to content

Commit 5bc1a7e

Browse files
committed
rename arg
1 parent b09e878 commit 5bc1a7e

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

R/check_convergence.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' @description `check_convergence()` provides an alternative convergence
55
#' test for `merMod`-objects.
66
#'
7-
#' @param x A `merMod` or `glmmTMB`-object.
7+
#' @param model A `merMod` or `glmmTMB`-object.
88
#' @param tolerance Indicates up to which value the convergence result is
99
#' accepted. The smaller `tolerance` is, the stricter the test will be.
1010
#' @param ... Currently not used.
@@ -50,8 +50,8 @@
5050
#' check_convergence(model)
5151
#' }
5252
#' @export
53-
check_convergence <- function(x, tolerance = 0.001, ...) {
54-
out <- .safe(insight::is_converged(x, tolerance = tolerance, ...))
53+
check_convergence <- function(model, tolerance = 0.001, ...) {
54+
out <- .safe(insight::is_converged(model, tolerance = tolerance, ...))
5555
if (is.null(out)) {
5656
insight::format_alert("Could not compute convergence information.")
5757
out <- NA

R/check_predictions.R

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#' If `check_predictions()` doesn't work as expected, try setting
1515
#' `verbose = TRUE` to get hints about possible problems.
1616
#'
17-
#' @param object A statistical model.
17+
#' @param model A statistical model.
1818
#' @param iterations The number of draws to simulate/bootstrap.
1919
#' @param check_range Logical, if `TRUE`, includes a plot with the minimum
2020
#' value of the original response against the minimum values of the replicated
@@ -92,14 +92,14 @@
9292
#' check_predictions(model, type = "discrete_both")
9393
#'
9494
#' @export
95-
check_predictions <- function(object, ...) {
95+
check_predictions <- function(model, ...) {
9696
UseMethod("check_predictions")
9797
}
9898

9999
#' @rdname check_predictions
100100
#' @export
101101
check_predictions.default <- function(
102-
object,
102+
model,
103103
iterations = 50,
104104
check_range = FALSE,
105105
re_formula = NULL,
@@ -108,18 +108,18 @@ check_predictions.default <- function(
108108
verbose = TRUE,
109109
...
110110
) {
111-
.is_model_valid(object)
111+
.is_model_valid(model)
112112
# check_predictions() can't handle exotic formula notation
113113
if (verbose) {
114114
insight::formula_ok(
115-
object,
115+
model,
116116
action = "error",
117117
prefix_msg = "Posterior predictive checks failed due to an incompatible model formula." # nolint
118118
)
119119
}
120120

121121
# retrieve model information
122-
minfo <- insight::model_info(object, verbose = FALSE)
122+
minfo <- insight::model_info(model, verbose = FALSE)
123123

124124
# try to find sensible default for "type" argument
125125
suggest_dots <- (minfo$is_bernoulli ||
@@ -138,7 +138,7 @@ check_predictions.default <- function(
138138
)
139139

140140
pp_check.lm(
141-
object,
141+
model,
142142
iterations = iterations,
143143
check_range = check_range,
144144
re_formula = re_formula,
@@ -153,7 +153,7 @@ check_predictions.default <- function(
153153

154154
#' @export
155155
check_predictions.stanreg <- function(
156-
object,
156+
model,
157157
iterations = 50,
158158
check_range = FALSE,
159159
re_formula = NULL,
@@ -163,7 +163,7 @@ check_predictions.stanreg <- function(
163163
...
164164
) {
165165
# retrieve model information
166-
minfo <- insight::model_info(object, verbose = FALSE)
166+
minfo <- insight::model_info(model, verbose = FALSE)
167167

168168
# try to find sensible default for "type" argument
169169
suggest_dots <- (minfo$is_bernoulli ||
@@ -190,15 +190,15 @@ check_predictions.stanreg <- function(
190190
)
191191

192192
# for plotting
193-
resp_string <- insight::find_terms(object)$response
193+
resp_string <- insight::find_terms(model)$response
194194

195-
if (inherits(object, "brmsfit")) {
195+
if (inherits(model, "brmsfit")) {
196196
out <- as.data.frame(
197-
bayesplot::pp_check(object, type = pp_type, ndraws = iterations, ...)$data
197+
bayesplot::pp_check(model, type = pp_type, ndraws = iterations, ...)$data
198198
)
199199
} else {
200200
out <- as.data.frame(
201-
bayesplot::pp_check(object, plotfun = pp_type, nreps = iterations, ...)$data
201+
bayesplot::pp_check(model, plotfun = pp_type, nreps = iterations, ...)$data
202202
)
203203
}
204204

@@ -247,15 +247,15 @@ check_predictions.brmsfit <- check_predictions.stanreg
247247

248248
#' @export
249249
check_predictions.BFBayesFactor <- function(
250-
object,
250+
model,
251251
iterations = 50,
252252
check_range = FALSE,
253253
re_formula = NULL,
254254
bandwidth = "nrd",
255255
verbose = TRUE,
256256
...
257257
) {
258-
everything_we_need <- .get_bfbf_predictions(object, iterations = iterations)
258+
everything_we_need <- .get_bfbf_predictions(model, iterations = iterations)
259259

260260
y <- everything_we_need[["y"]]
261261
sig <- everything_we_need[["sigma"]]
@@ -284,7 +284,7 @@ pp_check.BFBayesFactor <- check_predictions.BFBayesFactor
284284

285285

286286
#' @export
287-
check_predictions.lme <- function(object, ...) {
287+
check_predictions.lme <- function(model, ...) {
288288
insight::format_error(
289289
"`check_predictions()` does currently not work for models of class `lme`."
290290
)

man/check_convergence.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/check_predictions.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)