diff --git a/R/anova.ccabyterm.R b/R/anova.ccabyterm.R index 459ae835d..27a132c98 100644 --- a/R/anova.ccabyterm.R +++ b/R/anova.ccabyterm.R @@ -60,8 +60,10 @@ trms <- scope else trms <- drop.scope(object) - trmlab <- trms[trms %in% attr(terms(object$terminfo), - "term.labels")] + ## Condition() not considered marginal + alltrms <- intersect(attr(terms(object$terminfo), "term.labels"), + attr(terms(object), "term.labels")) + trmlab <- intersect(alltrms, trms) if (length(trmlab) == 0) stop("the scope was empty: no available marginal terms") ## baseline: all terms @@ -87,7 +89,7 @@ if (is.null(ass)) stop("old style result object: update() your model") ## analyse only terms of 'ass' thar are in scope - scopeterms <- which(attr(terms(object$terminfo), "term.labels") %in% trms) + scopeterms <- which(alltrms %in% trmlab) mods <- lapply(scopeterms, function(i, ...) permutest(ordConstrained(Y, X[, ass != i, drop=FALSE], Z, "pass"), permutations, ...), ...)