advice: Advice on a Result

View source: R/advice.R

adviceR Documentation

Advice on a Result

Description

Results of predictmeans functions carry short advice when this fit and these data call for a choice or a caution the user may not know about: an unbalanced design, empty cells, a covariate aliased with a factor, a singular fit, an extrapolated mean, few degrees of freedom, many tests, too few permutations, and so on. Advice is printed at the end of the result as an "Advice:" block (! a caution: the result may mislead as it stands; i a note: a choice worth knowing). It is never generic, and no test is run that was not asked for. advice() returns it as a data frame, for code and AI assistants.

options(predictmeans.advice = FALSE) stops the printing; the advice is still stored.

Usage

advice(x)

Arguments

x

A result of predictmeans(), contrastmeans(), anova() of an lmer or semireg fit, pm_check(), permmodels(), bootmodels(), R2_model(), varcomp(), se_ranef(), semireg(), semipred(), covariatemeans() or pm_slopes().

Value

A data frame with columns id (stable, listed below), level ("caution" or "note") and text; zero rows when there is no advice.

Advice ids

id from when
nonestimable_means predictmeans some means cannot be estimated (NA)
empty_cells predictmeans means average over the observed cells only
aliased_covariate predictmeans a covariate is constant within a factor's levels
large_se predictmeans a mean's SE is over 3 times the median SE
lsd_varies predictmeans the average LSD judges some pair differently from its own test
bias_adjust predictmeans, covariatemeans back-transformed means are a typical cluster's or a median, not the mean
contrast_common_cells contrastmeans contrasts are estimated on the cells their means share
small_df predictmeans, contrastmeans degrees of freedom below 5
many_tests_unadjusted predictmeans, contrastmeans 6 or more requested tests with adj = "none"
singular_fit predictmeans, contrastmeans, R2_model, semireg a variance at zero or a correlation at +-1
anova_unbalanced_typeI, _typeII, _typeIII anova unbalanced data: what the type tests
anova_empty_cells anova empty cells: no type tests a main effect over all cells
anova_covariate_zero anova Type III with a covariate in an interaction (tests at covariate = 0)
check_<name> pm_check a check worth a look (the note of its row)
few_permutations permmodels, bootmodels fewer than 999 resamples and a p-value at the floor or near 0.05
r2_latent_scale R2_model a non-gaussian model: R2 on the link scale
variance_at_zero varcomp, se_ranef a variance estimated as zero
few_re_levels varcomp, se_ranef a random effect with fewer than 5 levels
variance_test_boundary varcomp how to test a variance against zero (test = TRUE)
ranef_conditional_fixed se_ranef conditional SEs of a random term that contains a fixed factor
smooth_linear semireg a smooth estimated as a straight line (variance 0)
extrapolation semipred, covariatemeans, pm_slopes predictions beyond the range of the data
pointwise_regions semipred, covariatemeans regions of difference read from pointwise limits
smooth_other_covariate semipred a smooth in the prediction does not involve covariate (adds a constant)
slopes_equal_by_model pm_slopes no covariate x term interaction: the slopes are equal by assumption
slopes_at_value pm_slopes a curved term or a link: the slopes depend on at

Examples

oats <- nlme::Oats
oats$nitro <- factor(oats$nitro)
fm <- lme4::lmer(log(yield) ~ nitro * Variety + (1 | Block), data = oats)
res <- predictmeans(fm, "nitro:Variety", pairwise = TRUE)
advice(res)

predictmeans documentation built on Nov. 24, 2026, 5:10 p.m.