Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check projpred version for latent projection #1456

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ via the `hurdle_cumulative` family thanks to Stephen Wild. (#1448)
in post-processing methods that require a compiled Stan model.
* Extend control over the `point_estimate` feature in `prepare_predictions`
via the new argument `ndraws_point_estimate`.
* Add support for the latent projection available in **projpred** versions >
2.3.0.
* Add support for the latent projection available in **projpred** versions >=
2.4.0.

### Bug Fixes

Expand Down
4 changes: 3 additions & 1 deletion R/projpred.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#' \code{\link[projpred:init_refmodel]{init_refmodel}}, but leave this at
#' \code{NULL} unless \pkg{projpred} complains about it.
#' @param latent See argument \code{latent} of
#' \code{\link[projpred:extend_family]{extend_family}}.
#' \code{\link[projpred:extend_family]{extend_family}}. Setting this to
#' \code{TRUE} requires a \pkg{projpred} version >= 2.4.0.
#' @param brms_seed A seed used to infer seeds for \code{\link{kfold.brmsfit}}
#' and for sampling group-level effects for new levels (in multilevel models).
#' @param ... Further arguments passed to
Expand Down Expand Up @@ -206,6 +207,7 @@ get_refmodel.brmsfit <- function(object, newdata = NULL, resp = NULL,
)
}
} else if (latent) {
require_package("projpred", "2.4.0")
if (family$family == "cumulative") {
args$latent_ilink <- latent_ilink_cumulative(
object = object, family = family, bterms = bterms, resp = resp
Expand Down
3 changes: 2 additions & 1 deletion man/get_refmodel.brmsfit.Rd

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