The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

predictmeans predictmeans logo

Predicted (least-squares) means, standard errors, LSDs, pairwise comparisons and contrasts for linear, generalized linear and mixed models — aov, lm, glm, gls, lme, lmer, glmer, glmmTMB, gam, semiparametric semireg, ordinal and categorical models, mmrm and betareg, and other classes through emmeans — with Kenward–Roger, Satterthwaite or containment degrees of freedom, permutation and bootstrap tests, R² for mixed models and diagnostics. On CRAN since 2014.

Why predictmeans

Workflow

From a fitted model to the report: diagnostics, tests, means and contrasts, variance components, then tables and plots

Installation

install.packages("predictmeans")                       # CRAN
# remotes::install_github("dongwenluo/predictmeans")    # development version

Example

library(predictmeans)
Oats <- as.data.frame(nlme::Oats)
Oats$nitro <- factor(Oats$nitro)
fm <- lmer(yield ~ nitro * Variety + (1 | Block/Variety), data = Oats)

pm <- predictmeans(fm, "nitro:Variety", atvar = "Variety", adj = "tukey")
pm$means     # one row per mean: estimate, std.error, df, conf.low, conf.high, group, n, ...
pm$pairs     # one row per comparison: estimate, std.error, df, statistic, p.value, p.adj, ...
ggplot2::autoplot(pm)

Every predictmeans() result has three stable data frames, means, pairs and settings, with fixed column names; as.data.frame(), tidy(), coef() and vcov() work on it.

Main functions

Task Function
Means and pairwise comparisons predictmeans(), covariatemeans()
Contrasts specify_contrast(), contrast_family(), contrastmeans()
Joint tests (slices) and slopes pm_joint(), pm_slopes()
Resampling tests permmodels(), permlmer(), bootmodels()
Semiparametric models semireg(), semireg_tmb(), semipred()
R², variance components, diagnostics R2_model(), varcomp(), pm_check(), residplot(), CookD()
Reference grid / K matrix Kmatrix()

Documentation

The package website has the help pages and vignettes: getting started; contrasts, joint tests and slopes; link and response scale; permutation and bootstrap tests; smooth curves in mixed models; missing cells and non-estimable means; R² for mixed models; and migrating from version 1.x.

For AI assistants and scripted use, a compact description of the result tables, the defaults and common recipes is installed with the package: system.file("llms-context.md", package = "predictmeans") (on GitHub).

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.