Skip to content
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
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Imports:
MASS,
ordinal,
nnet,
mclogit
mclogit,
reformulas,
Suggests:
ggrepel,
ggfortify,
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If you read this from a place other than <https://mc-stan.org/projpred/news/inde
* Added support for censored observations when using the latent projection (with response-scale analyses). This makes it possible, e.g., to use the latent projection for time-to-event models (also known as models for survival analysis). Due to this new feature, the function passed to argument `latent_ll_oscale` of `extend_family()` now needs to have an argument `cens`. See `?extend_family` (section "Latent projection") as well as the latent-projection vignette (section ["Censored observations (survival analysis)"](https://mc-stan.org/projpred/articles/latent.html#cens)) for more information and examples. Note that only the performance statistics `"elpd"`, `"mlpd"`, and `"gmpd"` take censoring into account (on response scale). (GitHub: #528)

## Minor changes

* Use `reformulas` package directly for formula processing functions. This package is already a dependency of `lme4` >= v1.1-38.

## Bug fixes

Expand Down
6 changes: 3 additions & 3 deletions R/divergence_minimizers.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ divmin <- function(
sdivmin <- fit_glmer_callback
if (getOption("projpred.PQL", FALSE)) {
# Split up the formula into a fixed and a random part (note: we could also
# use lme4::nobars() and lme4::findbars() here):
# use reformulas::nobars() and reformulas::findbars() here):
formula_random <- split_formula_random_gamm4(formula)
projpred_formulas_no_random <- validate_response_formula(
formula_random$formula
Expand Down Expand Up @@ -1342,11 +1342,11 @@ empty_intersection <- function(x, el_nm = "new") {
# "GPL (>=2)" (see <https://CRAN.R-project.org/package=lme4>).
mkNewReTrms_man <- function(re.form, newdata, xlevels, re, D = NULL) {
stopifnot(!is.null(newdata))
tt <- terms(lme4::subbars(re.form))
tt <- terms(reformulas::subbars(re.form))
rfd <- suppressWarnings(
model.frame(tt, newdata, na.action = na.pass, xlev = xlevels)
)
ReTrms <- lme4::mkReTrms(lme4::findbars(re.form[[2]]), rfd)
ReTrms <- reformulas::mkReTrms(reformulas::findbars(re.form[[2]]), rfd)
ns.re <- names(re)
nRnms <- names(Rcnms <- ReTrms$cnms)
if (!all(nRnms %in% ns.re)) {
Expand Down
15 changes: 6 additions & 9 deletions tests/testthat/test_refmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,17 @@ test_that(paste(

# Without `ynew`:
expect_warning(
predref_resp <- withCallingHandlers(
predict(refmods[[tstsetup]], dat,
weightsnew = wobs_crr,
offsetnew = offs_crr,
type = "response"),
withCallingHandlers(
predref_resp <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr,
offsetnew = offs_crr, type = "response"),
warning = function(w) {
if (grepl("nobars.*reformulas", conditionMessage(w))) {
if (grepl("(nobars|subbars|findbars|mkReTrms).*reformulas", conditionMessage(w))) {
invokeRestart("muffleWarning")
}
}
),
get_warn_wrhs_orhs(tstsetup,
weightsnew = wobs_crr,
offsetnew = offs_crr),
get_warn_wrhs_orhs(tstsetup, weightsnew = wobs_crr,
offsetnew = offs_crr),
info = tstsetup
)

Expand Down
Loading