diff --git a/R/edit.setup.R b/R/edit.setup.R index 60e08e877..7bd7dc966 100644 --- a/R/edit.setup.R +++ b/R/edit.setup.R @@ -85,7 +85,7 @@ edit.setup <- function(data, setup, } } - if (all(pred == 0L)) { + if (all(pred == 0L) && didlog) { stop("`mice` detected constant and/or collinear variables. No predictors were left after their removal.") } diff --git a/R/sampler.R b/R/sampler.R index a6b5ea4d2..595b9c110 100644 --- a/R/sampler.R +++ b/R/sampler.R @@ -186,7 +186,7 @@ sampler.univ <- function(data, r, where, pred, formula, method, yname, k, if (calltype == "pred") { vars <- colnames(data)[pred != 0] xnames <- setdiff(vars, j) - if (length(pred) > 0L) { + if (length(xnames) > 0L) { formula <- reformulate(xnames, response = j) formula <- update(formula, ". ~ . ") } else {