Skip to content

Commit

Permalink
don't overwrite "type"
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 29, 2024
1 parent 111fd17 commit e2cd188
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/check_predictions.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ check_predictions.stanreg <- function(object,
type <- match.arg(type, choices = c("density", "discrete_dots", "discrete_interval", "discrete_both"))

Check warning on line 151 in R/check_predictions.R

View check run for this annotation

Codecov / codecov/patch

R/check_predictions.R#L151

Added line #L151 was not covered by tests

# convert to type-argument for pp_check
type <- switch(type,
pp_type <- switch(type,
density = "dens",
"bars"

Check warning on line 156 in R/check_predictions.R

View check run for this annotation

Codecov / codecov/patch

R/check_predictions.R#L154-L156

Added lines #L154 - L156 were not covered by tests
)
Expand All @@ -161,12 +161,13 @@ check_predictions.stanreg <- function(object,
"to create posterior prediction plots for Stan models"

Check warning on line 161 in R/check_predictions.R

View check run for this annotation

Codecov / codecov/patch

R/check_predictions.R#L159-L161

Added lines #L159 - L161 were not covered by tests
)

# for plotting
resp_string <- insight::find_terms(object)$response

Check warning on line 165 in R/check_predictions.R

View check run for this annotation

Codecov / codecov/patch

R/check_predictions.R#L165

Added line #L165 was not covered by tests

if (inherits(object, "brmsfit")) {
out <- as.data.frame(bayesplot::pp_check(object, type = type, ndraws = iterations, ...)$data)
out <- as.data.frame(bayesplot::pp_check(object, type = pp_type, ndraws = iterations, ...)$data)

Check warning on line 168 in R/check_predictions.R

View check run for this annotation

Codecov / codecov/patch

R/check_predictions.R#L167-L168

Added lines #L167 - L168 were not covered by tests
} else {
out <- as.data.frame(bayesplot::pp_check(object, type = type, nreps = iterations, ...)$data)
out <- as.data.frame(bayesplot::pp_check(object, type = pp_type, nreps = iterations, ...)$data)

Check warning on line 170 in R/check_predictions.R

View check run for this annotation

Codecov / codecov/patch

R/check_predictions.R#L170

Added line #L170 was not covered by tests
}

# bring data into shape, like we have for other models with `check_predictions()`
Expand Down

0 comments on commit e2cd188

Please sign in to comment.