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
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
101101check_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
155155check_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
249249check_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 )
0 commit comments