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.
Changes since 2.0.0 (CRAN, 2026-11-24).
gam fits of non-gaussian families (binomial,
Poisson, …): means, curves and comparisons now use the covariance
corrected for the estimated smoothing parameters,
vcov(fit, unconditional = TRUE), as semipred()
does for semireg() fits; standard errors are a few percent
larger. vcov = vcov(fit) or
options(predictmeans.semi_unconditional = FALSE) gives the
earlier ones. Gaussian, bam() and multi-predictor
(e.g. gaulss) fits are unchanged.
semireg(): smooths written alike (two
bs = "user" bases on the same covariates,
s(x) + s(x, k = 5)) were merged into one random-effect
block, so the fit silently held one smooth; each now has its own block
and a tagged label ("s(u,v)[b1]", the basis function’s
name, else "s(x)[2]"), equal to gam() with the
same bases. sm_term picks them by label, block or term as
written. The smooth table shows each block’s label.
semireg() fits user bases with dependent columns or
with more columns than observations, e.g. the five PSANOVA blocks of
SpATS or LVIS on a field grid with missing plots (before: refused).
Checked against Genstat 24 on a 150-plot grid: REML, treatment means and
SEs equal to 1e-6. Bases defined only at the data’s points (a grid
lookup) fit quietly; semipred(deriv = ) says why slopes are
not available.
semireg() runs lme4’s convergence check (as
lmer() and glmer() do; it was skipped), stores
it in the fit (read by pm_check()), and a failed check
gives an advice line (not_converged). Generalized fits now
use the bobyqa optimizer unless control is
given: with nloptwrap they often failed the check (one test
fit stopped 6e-6 short in logLik). GLMM results move slightly (about
1e-4 in the means). The check counts parameters as glmer()
does, and control = glmerControl() is accepted (it stopped
with an error before). The advice names a remedy that fits the engine
(glmmTMBControl() for semireg_tmb(), rescaling
for lme4’s “nearly unidentifiable”), and says nothing for a glmmTMB
Hessian warning that comes from a variance at zero.
semireg() and semireg_tmb() keep the
formula’s environment, as lm() and gam() do: a
basis function or knots defined inside the function that made the
formula were not found (“object not found”).
A gaussian semireg() fit saved with
saveRDS() and read back failed in varcomp(),
semipred(unconditional = TRUE) and Satterthwaite df (“NULL
value passed as symbol address”): the stored deviance function does not
survive saving. It is now rebuilt from the fit’s data when needed; the
results equal those before saving.
semipred() settings said “unconditional” when the
smoothing-parameter correction was asked for but not available for the
fit (the conditional covariance was used). They now record what was
used, and an advice line (inference_fallback) says what
fell back, also when Satterthwaite df could not be computed at some
points (normal limits there; also named in
df_method).
update() of a gaussian semireg() fit’s
$semer (a new random part, as
lmerTest::ranova(); also used by
varcomp(test = TRUE) on fit$semer) refitted
without the prior weights and offset, and ignored . in the
new formula. It now keeps both and the fit’s control, and
~ . - (1 | h) works. A new response or fixed part, which
update() cannot change, stops with a message instead of
being ignored.
Refits of semireg() and semireg_tmb()
fits with an offset() term in the formula (smooth tests of
anova(), varcomp(test = TRUE),
update()) counted that offset twice, so their
likelihood-ratio tests were wrong. The offset is now counted
once.
Smooths on coordinates in small units (order 1e-5) lost a term of
their fixed part (the x:w of a surface), a different model than the same
data in other units; the check is now relative to each column.
semireg() also stops with a plain message for a smooth of a
covariate with one value, a smooth block that is zero at every
observation or has one coefficient, and coordinates far from 0 for their
range (centre them). The penalties of
lvis/pspline2d are stored sparse (0.1 MB
instead of 69 MB on a 30 x 40 grid).
bias_adjust = TRUE with a wide random variation
(e.g. a logit with sigma = 5) could give probabilities
below 0: when two quadrature rules disagreed, the second-order formula
was used with a warning. The mean is now found by adaptive integration
(equal to integrate() to 1e-10, also for a log with a wide
SD), and it stops when no mean exists: the back-transformation has a
pole (a reciprocal, however far from the mean) or leaves its domain
within 38 SDs. The second-order formula is used only with
bias_adjust = "taylor". This affects
predictmeans(), covariatemeans() and
semipred().
semireg(subset = ) with a smooth stopped with an
internal error, because the smooth was built on all rows. The rows are
now chosen once (subset, then complete cases), and the smooths, weights
and offset are built from them. A weights or offset vector given outside
the data follows the same rows.
semireg(): a user basis with
xt = list(null = "constant") also got the covariate’s slope
as a fixed term (the line spans the constant). The smallest fixed part
is now tried first, so it gets the constant only.
semipred(at = ): named columns were ignored, so
cbind(v = .2, u = .8) predicted at u = .2, v = .8. Named
columns are now matched to covariate by name, a data frame
is accepted, and missing, extra or repeated names stop with a message.
An unnamed matrix is still taken in the order of
covariate.
semipred(boundary = ): the points outside the
boundary were hidden from the tables but still entered the test of equal
surfaces (contr) and pred_df, so the test
could be driven by points not shown. They are now left out before
anything is computed, so the bands, df, test and tables use the same
points.
anova(<lmer fit>, type = "I") now uses
Kenward-Roger df and F, like Types II and III, and
ddf = "Satterthwaite" gives the previous table; both equal
SAS PROC MIXED HTYPE=1. Type III tests a nested term
(A + A:B) within each level of the outer factor, as SAS (it
had 0 df), and the “empty cells” note no longer appears for nested
factors or for factors that only have main effects.
anova() of lmer fits:
type1_basis = "fitted" builds Type I hypotheses from the
fitted model (X’V^-1X), as Genstat, instead of X’X (SAS, lmerTest; the
default); ddf = "KR-average" gives Genstat’s d.d.f. with an
unadjusted F. Together they reproduce Genstat’s Wald and F statistics;
Genstat prints each term’s Type II d.d.f., here each test has the d.d.f.
of its own hypothesis.
Inner-outer df of aggregated binomial GLMMs
(cbind(y, m - y), weights = trials) and of
clmm with case weights count the cases in the residual
stratum, so aggregated data and one row per case get the same df
(settings$df_cases; weights that are not whole numbers
count rows). Counting rows rejected 0-2.6% of true null hypotheses at 5%
in simulations, counting trials 3.7-4.3%;
options(predictmeans.inner_outer_count = "rows") counts
rows, as SAS GLIMMIX does (DDFM=CONTAIN; checked by a SAS run). Trials
assume binomial variation within clusters (with overdispersion the model
leaves out they gave 9.25%, rows 3.5%): the advice
overdispersion_trials (a caution when the fit’s Pearson
test gives p < 0.05, a note when p < 0.2) says to add an
observation-level random effect or to count rows.
Ordinal models: MASS::polr() and
ordinal::clm() fits (location effects). Means on the latent
scale (as emmeans’ mode = "latent"), pairs as log odds
ratios of a higher class, z tests; mean_type = "prob" adds
the class probabilities at each mean and
mean_type = "mean_class" the expected class, with
delta-method SEs (over other factors: each cell’s probabilities
averaged, as emmeans; advice ordinal_cell_average says so).
Also ordinal::clmm() fits, for a typical subject (random
effects at 0), with the inner-outer df of GLMMs (z tests rejected 11% of
true nulls at 5% with 6 clusters). Checked against emmeans. Summaries
say “z tests” when the df are infinite. VGAM::vglm() fits
of the ordinal families cumulative, propodds,
acat, cratio and sratio with
parallel = TRUE: the same latent means, oriented so that a
positive difference means higher classes, whatever the family and
reverse (SEs from VGAM’s expected information). vglm fits
of other families (e.g. poissonff), which gave link-scale
means with t tests before, now stop with a message.
nnet::multinom(), VGAM::vglm() with
multinomial() and ordinal vglm fits with non-parallel
slopes: the class is a factor of the means, pairs within each class.
mean_type = "prob" (default): class probabilities on the
logit scale, back-transformed with limits inside 0-1, pairs as log odds
ratios (with two classes the same as a binomial glm);
"prob_diff": differences of probabilities (as emmeans’
mode = "prob"); "link": the model’s linear
predictors; "mean_class" for ordinal families.
Probabilities averaged over other factors on the probability scale;
delta-method SEs, z tests; advice on separation (a class absent at some
levels). Checked against emmeans; other functions stop for these fits.
Where the cumulative curves of a non-parallel fit cross (negative
probabilities), the means that use those points are NA with a
caution.
ordinal::clm() fits with nominal or scale effects
(nominal =, scale =), refused before: class
probabilities as for non-parallel vglm fits ("link" only
without scale effects); equal to predict.clm() with its SEs
(logit, probit, cloglog, loglog links).
ordinal::clmm(): bias_adjust = TRUE
with mean_type = "prob" or "mean_class" gives
population-average class probabilities (integrated over the random
intercepts by adaptive numerical integration), with delta-method SEs
that include the random-effect variances; checked against numerical
integration and the probit closed form. Random slopes stop.
bootmodels() and permmodels() take
ordinal::clmm() fits (tests with few clusters): a
parametric bootstrap of the Type II Wald tests under the global null
(random intercepts), whose permlist gives bootstrap
p-values of the latent pairs in predictmeans(); and
re-randomisation of each variable applied to whole clusters, within
strata (fixed blocks, other cluster-level variables, coarser random
effects), exact (all allocations enumerated) when there are at most
nperm, with a note on the smallest attainable p-value (6
clusters split 3/3: 20 allocations, p at least 0.1). In simulations with
6-12 clusters the default inner-outer t tests (3.4-5.4% at 5%) and the
bootstrap (3.7-5.1%) held the level, z tests did not (9-11%); the
permutation was valid but weak.
weights = "proportional" (and "outer",
"cells", "flat") count cases instead of rows
where a row holds several: binomial and quasibinomial responses of any
class (trials) and class responses (multinom, polr, clm, clmm, vglm with
case weights). Aggregated data and one row per case then weight the
factor combinations alike (as emmeans); covariates are still set from
the rows. settings$weights_by says which. semireg means
stop for weights other than "equal" (they were
ignored).
New article “Ordinal and categorical responses”: latent means of cumulative link models, class probabilities of multinomial and non-parallel fits, the scales and the checks.
New corAR1xAR1(): the separable AR1 x AR1
correlation of row x column field trials (as Genstat’s
VSTRUCTURE AR,AR and ASReml’s
ar1(row):ar1(col)), with an optional nugget, for
nlme::gls() and lme(); every predictmeans tool
works with it (Kenward-Roger df, means, SEDs,
residvariogram()). On Genstat’s Slate Hall trial phi and
the variances agree to Genstat’s printed digits, the 25 means and all
300 SEDs within 5e-6, and the variety test’s d.d.f. with
df_method = "KR-average". Kenward-Roger and Satterthwaite
df for gls and lme now leave out variance components (and a nugget)
estimated at 0, and a failed Kenward-Roger falls back to Satterthwaite;
na.exclude fits no longer break them.
residvariogram() advice now points to it (or to a smooth
t2(row, col) trend). New article “Spatial analysis of a
field trial” (Slate Hall: variogram, AR1 x AR1 with and without a
nugget, the t2() trend).
predictmeans() of gaussian semireg()
fits: pairs (fixed-effect contrasts) get Kenward-Roger adjusted SEs and
df, the same as the fit’s mixed model ($semer) gives
(coverage of 95% limits in simulations 94.9%, unadjusted 94.2-94.5%);
the means keep Satterthwaite df; vcov_adjust = FALSE for
the unadjusted results. summary() of these results works
(it failed: no estimable column); means of cells without
data are NA with a message (they were NaN). contrastmeans()
of semireg fits stops with a pointer to predictmeans(fit, )
or contrastmeans(fit$semer, ) (it gave unadjusted SEs with
df Inf labelled “residual”).
corAR1xAR1(by_group = TRUE) with
form = ~ row + col | trial: a phi pair (and nugget) for
each trial; with trial / variety and
varIdent(~ 1 | trial) each trial gets the estimates, SEDs
and Kenward-Roger df of its own fit (checked against separate
fits).
semireg_tmb() fits with a propto() term
(for example a spline plus an AR1 x AR1 plot effect with supplied
correlations): predictmeans() gives Satterthwaite df (they
were Inf, checked against lmerTest on the same model),
varcomp() reports and tests the multiplier of the supplied
matrix (it stopped), and the fit’s convergence caution is carried into
predictmeans() and semipred().
varcomp(fit$semer, test = TRUE) on a
semireg_tmb() fit stops with a pointer to
varcomp(fit, test = TRUE) (its refits were another
model).
lme fits with pdBlocked random effects
(e.g. rows and columns within replicates in one field-wide group, with
corAR1xAR1()): Kenward-Roger and se_ranef()
work (they failed: the joined formula dropped a level); equal to
lmer on the same model. No more “contrast will be ignored”
warnings for such fits.
plot() of covariatemeans() and
semipred() results draws their autoplot() (it
failed).
The article “Spatial analysis of a field trial” compares blocking
and spatial models by AIC on a common fixed part (AR1 x AR1, SpATS,
LVIS, thin-plate spline, with and without blocking, after Williams’ VSNi
blog), draws the best model’s surface in 2-D and 3-D, and checks the
models on a simulated trial with a known truth. The same models in
Genstat 24 (dev/genstat/spatial-slatehall.gen) give the
same deviances and SEDs (LVIS, SpATS, AR1 x AR1, blocks).
residplot(), pm_check() and
residvariogram() of gls and lme
fits with a grouped correlation: the normalized residuals were misplaced
when the data were not sorted by the groups (nlme’s
residuals(type = "normalized"), off by up to 2 standard
deviations); they are now whitened group by group. For
corAR1xAR1() fits the plots are taken in row and column
order, so the residuals do not depend on the order of the data.
heritability(): line-mean (entry-mean) heritability
from an lmer fit with random genotypes, in the standard
form and the mixed-model forms of Cullis et al. (2006), Piepho and
Möhring (2007) and Oakey et al. (2006), for unbalanced trials;
method = "all" shows them side by side.
method = "family" gives the narrow-sense heritability of a
single plant from half-sib or full-sib families
(relationship), and "repeatability" that of
single records; "reliability" (mean reliability) and
"simulated" (Piepho and Möhring’s simulated r2). Plot
means: within_variance, within_n give the
single-plant variance. SEs: delta method, or a parametric bootstrap
(nboot). Works with weights, several genotype x environment
terms, genotypes nested in a fixed factor (with a note) and boundary
fits (genotypic variance 0). Reproduces every value of Schmidt et
al. (2019, Figure 1) for the oats alpha design.R2_model() of 0/1 binomial models with a link other
than logit, probit or cloglog (e.g. cauchit) uses the working variance;
it reported a residual variance of 0 (R2 100%).covariatemeans() has a vcov argument,
as predictmeans() and pm_slopes(): e.g.
vcov = vcov(fit, unconditional = TRUE) for a
gam fit, corrected for the estimated smoothing
parameters.
s(x, bs = "user", xt = list(basis = f, penalty = S))
in semireg()/semireg_tmb(): a basis from any
package with a penalty of your own, e.g. a P-spline from a B-spline
basis and a difference penalty (the same fit as
mgcv::gam()’s bs = "ps"). The penalty’s null
space (e.g. the straight line) becomes the fixed part. Without
penalty the coefficients stay iid, as before.
An expression with an empty index in the formula
(e.g. cbind(...)[, -1] in a user basis) no longer stops
semireg() with “argument”a” is missing”.
Satterthwaite df of gaussian semireg() and
lmer fits with one variance per random term use exact
derivatives of the REML deviance instead of numerical ones where that is
faster (smooth bases, crossed random effects): the same df (within
1e-6), a 20 x 25 spatial grid 3.7 s -> 0.1 s.
semipred() help: the smoothing-parameter correction
is first-order (mgcv also adds a second-order term), and a simultaneous
band holds over the predicted points only; their number is in
settings$band_points.
bias_adjust = TRUE now averages over random slopes
and random curves (glmer, glmmTMB,
semireg()): each mean or curve point gets the variance of
its own random part, z’ Sigma z (before: a stop asking for
sigma), also for slopes on scale(x),
poly(x, 2) or ns(x) (the fit’s centring,
coefficients and knots). The SD used is in
settings$bias_adjust of predictmeans(),
covariatemeans() and semipred() (one per mean
when it differs; then an advice line says the pairs’ ratio is a typical
cluster’s). Checked against closed forms, integrate() and
lme4’s own random-effect design.
predict() for semireg() and
semireg_tmb() fits: population predictions at new data
(fixed effects and smooths, other random effects at zero), on the link
or response scale, with SEs (the smoothing-parameter correction as in
semipred()), or the prediction matrix
(type = "lpmatrix"). Equal to semipred() at
its points; for a gaussian fit equal to mgcv::predict.gam()
of the same model.
New spatial spline bases for semireg()
(?spatial_splines): s(col, row, bs = "lvis")
(linear variance with interaction splines: linear B-splines, first
differences) and s(col, row, bs = "pspline2d") (cubic
P-splines, second differences; product interaction as Genstat’s
TENSORSPLINE, or xt$interaction = "sum" as SpATS’s
PSANOVA). They have one variance per component or grouped
(xt$penalty), and a declared field grid
(xt$grid) keeps the knot spacing over missing plots.
lvis (three variances or one) and pspline2d
with the sum interaction match Genstat 24 fits of the same bases (REML,
treatment means, SEs and the surface to about 1e-6). The product
interaction is Genstat’s TENSORSPLINE with
xt$center = FALSE (raw coordinates; checked against Genstat
24.2); the default centres the coordinates, so the fit does not depend
on their origin. Each component is its own block, named by it
(s_col_row_smooth_col, …). Slopes
(semipred(deriv = )) are one-sided at the ends of the grid;
lvis has none (piecewise linear).
semireg() stops for two smooths of the same
covariates and by (s(u) + s(u, k = 5)), whose
variances are not identified (mgcv only warns); user bases are exempt.
It also stops for a smooth block with one independent column per
observation (its variance is the residual’s), and keeps lme4’s checks of
the model’s own random terms next to bases wider than the data.
subset takes negative indices and row names, as
lm().
anova() of semireg() fits with tests of
smooth variances, and joint tests of all blocks of a smooth (a
t2() term, lvis/pspline2d
components, the levels of s(x, by = f);
joint = for own sets). Their p-values are conservative
(simulation in ?anova.semireg); near your level use
joint_method = "bootstrap". predictmeans() on
semireg() fits.
Fits print a short account of the smooth terms (a
te() term is fitted as t2(); both are shown,
and kept in attr(tidy(fit), "requested"));
coef(), vcov(), fitted() and
other methods work.
theme_bw(), and the
1.x dashed red reference line, now thicker, on every line of no
difference.autoplot(type = "bar")) cut confidence and
comparison intervals at the bars’ base 0 when all bars of a panel have
the same sign; the caption says so, and the means table keeps the full
limits.plot() works on every result autoplot()
draws: also Bayesian means, survmeans(),
residvariogram() and residplot() results.residvariogram(): the sample variogram of a model’s
residuals over a row x column field layout or coordinates (also
latitude/longitude, by direction), one per trial with by,
with a global envelope from data simulated from the fitted model and a
test of spatial pattern; advice suggests a spatial model when
neighbouring plots are more alike than the model allows. The estimator
reproduces Genstat’s FVARIOGRAM (Brooms Barn example).
pm_check(row = , col = ) adds the check. Rows or columns
numbered within blocks stop with a message.pm_coef() of an aov fit keeps its aliased
coefficients as NA, as for lm and
glm; every front end now reads a fit’s coefficients and
covariance only through pm_coef() and
pm_vcov().?pm_coef says what a new model class gets: means and
pairs need coef(), vcov() and
terms(); residplot() and
pm_check() also fitted() and
residuals() (else they stop and say so); the other
functions list the classes they handle.mmrm fits (repeated measures) are supported: mmrm’s own
df for every mean and pair (df_1d()) and joint tests
(df_md(), with the scaled Kenward-Roger F). They equal SAS
PROC MIXED for an unstructured covariance and AR(1) with missing values
(Satterthwaite; Kenward-Roger with
vcov = "Kenward-Roger-Linear"); advice
mmrm_kr_parametrisation when mmrm’s default Kenward-Roger
covariance is used.betareg fits (proportions): the mean model with z
tests, means back-transformed to proportions; equal to emmeans.
MASS::glm.nb is tested against emmeans too.semireg_tmb() fits with a propto() term
whose glmmTMB Hessian is not positive definite gave an error in
predictmeans() (“infinite or missing values”); they now get
z tests, labelled “Satterthwaite not available”.bias_adjust = TRUE stops for models without random
effects on a link scale (glm, betareg, …): the
inverse link already gives the mean. Before, sigma was
applied and the result was labelled a bias-adjusted mean.survival::coxph (with strata,
cluster = robust SEs and frailty() terms),
coxme::coxme and survival::survreg, with Wald
z tests; equal to SAS PROC PHREG and LIFEREG on the same data. The
results say what the numbers are (log hazards relative to the data’s
average linear predictor, the same for any coding of the factors, and
hazard ratios; median, mean or characteristic survival time for
survreg); terms that give no mean (tt(),
pspline(), ridge(), interactions with
strata()) stop by name; an advice line says whether hazard
ratios are conditional (frailty, random effect) or population-averaged
(robust SEs). Before, survreg went through emmeans with t
tests on the residual df.survmeans(): survival curves S(t) of each level of a
term at a stated covariate pattern (stratified Cox models: the baseline
of each stratum; no values past the last follow-up time), with pointwise
limits and the median survival time (Cox: survfit();
survreg: analytic with the delta method; checked against
survfit(), predict() and
psurvreg()), drawn by autoplot().autoplot(type = "pairs"): a forest plot of the pairwise
comparisons for any model, with simultaneous limits when adjusted;
ratios (hazard, time, odds ratios, ratios of means) on a log axis. Pairs
of Cox models gain hazard.ratio columns, of
survreg time.ratio.residplot() and pm_check() of survival
fits check what applies: deviance residuals, proportional hazards
(cox.zph(), a test per term and global, scaled Schoenfeld
plots) for Cox models, a Cox-Snell plot for survreg;
before, they tested Cox residuals for normality.brmsfit, stanreg):
predictmeans() and contrastmeans() summarise
the posterior draws of every mean, difference and contrast through the
same K matrix (posterior median, posterior SD, equal-tailed credible
interval, probability of direction; no df, no p-values).
Back-transformation per draw; bias_adjust = TRUE averages
over the random effects of each draw. With adj,
simultaneous bands (Besag et al. 1995) and letters;
equivalence gives the posterior probability within the
margins. varcomp(), R2_model() (Nakagawa, per
draw), pm_check() (Rhat, ESS, divergences) and
residplot() (trace and density by chain) work on them;
autoplot(type = "draws") draws the posterior of each mean
or difference; covariatemeans() (curves and their
differences) and pm_slopes() work on them too;
pm_joint() gives the joint posterior region through 0
(contour probability (b + 1) / (S + 1)). brms cox(),
cumulative() (class probabilities with
mean_type = "prob"), zero-inflated and hurdle families
(overall means with mean_type = "overall": the response
averaged over the cells, as brms’ posterior_epred(), and
their ratios); random slopes in bias_adjust,
R2_model() and marginal survival curves. brms Weibull,
log-normal and exponential models: time and hazard ratios per draw, and
survmeans() curves (marginal = TRUE: averaged
over the random effects). brms categorical(): class
probabilities as for multinom fits (with
bias_adjust = TRUE, averaged over the random effects);
mixture(): the overall mean, and the means of ordered
components. MCMCglmm: us() and idh() random
structures, and ordinal fits (class probabilities of an observation).
pm_draws() is the adapter generic for other Bayesian
classes. Checked against emmeans’ draws, bayestestR, brms,
survreg() and SAS’s Bayesian LIFEREG, PHREG and MCMC fits;
new article.coxme(),
accelerated failure time models with Cox-Snell plots, a Bayesian Weibull
frailty model, and the comparison with SAS PROC PHREG and LIFEREG.pm_slopes() of vglm fits when VGAM is not
attached, covariatemeans() of coxme fits, and
permmodels() of an unsupported class now says which classes
it handles.rq,
gee) work in predictmeans(),
contrastmeans(), covariatemeans(),
pm_slopes(), pm_joint() and
Kmatrix() through emmeans’ linear basis (with its df), else
through the derivatives of marginaleffects’ link-scale predictions when
they are exactly linear. Means equal emmeans’ for the same grid (offsets
left out); settings$source and advice
foreign_basis say which was used.gam fits with several linear predictors
(gaulss, gammals, twlss,
ziplss, multinom, mvn, …) gave
wrong means: the other predictors (scale, shape, zero part) were added
in. The means are now those of the first (location) predictor, as
predict.gam()[, 1], with a note saying so.
Response-scale means of gam fits with
twlss and gammals (the mean of the response,
as predict(type = "response")), and of ziplss
(hurdle Poisson) with mean_type = "overall": the mean p
lambda / (1 - exp(-lambda)), with delta-method SEs from both linear
predictors, and ratios of these means.
covariatemeans(mean_type = "overall") gives their curves.
mean_type = "lp2", "lp3", … gives the means of
another linear predictor (e.g. the standard deviation of
gaulss, on mgcv’s “logb” scale) on its own scale.
predictmeans() of a semireg() or
semireg_tmb() fit ignored trans,
bias_adjust and sigma without a word. They are
now used, as in semipred();
average = "response" stops (not yet available for these
fits).
predictmeans() of a semireg() or
semireg_tmb() fit ignored cov_reduce
(covariates were always at their means). It is now used for the fixed
and smooth parts alike; with splines the mean at the mean covariate and
the average of the curve over the data differ.
A term whose basis is recomputed from the rows it is given
(e.g. a function wrapping ns() or poly()
without makepredictcall()) now stops with advice: its means
and curves were silently wrong (as is predict() for such
fits). Spline bases written in the formula (bs(),
ns(), splines2) are checked against
predict().
Estimability checks (means, their pairs, empty-cell contrasts, slopes) no longer depend on the units of a covariate: with a site mean in large units an aliased slope was reported as 0 with SE 0.
anova() of lmer fits: a factor nested
in another only in the data (y ~ G + T) is tested within it
in Type III, as with G/T, with a caution to write
G/T; balanced nested designs are no longer called
unbalanced; ML fits get Satterthwaite df with a message instead of a
Kenward-Roger label; a failed Kenward-Roger adjustment in Types II and
III falls back to Satterthwaite.
pm_slopes() gives no pairs when the slopes are equal
by the model (no covariate x term interaction).
covariatemeans() drew curves that the data do not
identify (a covariate constant within the levels of a factor in the
model, as a site mean with site; or a function of other factors). It now
stops with a message pointing to contr = and
pm_slopes(), which estimate the differences between curves;
single points that cannot be estimated are NA, with advice.
pm_slopes() gave a slope of 0 with SE 0 when the
covariate is aliased with a factor (a site mean with site in the model).
Such slopes are now NA, with advice; their differences are kept. The
slopes table has an estimable column, as the means
table.
Tests now check predictmeans() and
covariatemeans() of mgcv::gam() fits against
predict.gam() for the common smooth types (thin-plate,
cubic, cyclic, P-, B-, Duchon, adaptive, Gaussian-process, tensor,
factor by, random-effect and factor smooths), and
semireg() with shrinkage and cyclic smooths
(bs = "ts", "cc", "cp") against
mgcv::gam(). The ti() error of
semireg() now says why and points to
mgcv::gam().
vignette("smooth"): which spline to use with which
model, and a basis with a penalty of your own.
vignette("predictmeans") and the README say when to
use predictmeans and when emmeans or marginaleffects.
Examples are kept in one place each, with links from elsewhere: the R² vignette is a short start that links to the Piepho (2023) article; the overview article is a short tour with a table of where each task is shown, and its five semiparametric examples moved to a new article “Semiparametric regression: worked examples”.
Vignettes reordered so each starts with what a reader needs
first: vignette("predictmeans") goes from the example to
the comparison with emmeans and marginaleffects (now near the end, and
no longer saying Bayesian fits are not handled);
vignette("resampling") starts with the table of which test
to use; vignette("missing-cells") defines a cell before the
first example. Worked examples of contrasts, permutation tests and
survival models each have one home (vignette("contrasts"),
vignette("resampling"), the survival article); other pages
link to it.
New data sets yates_missing,
harvey_lsmeans and john_alpha (copied from
agridat, MIT licence, so no new dependency), each analysed in a vignette
and checked against a SAS PROC MIXED DDFM=KR run:
vignette("missing-cells") has Yates’ NPK trial with 9
missing plots, vignette("sas") Harvey’s LS-means example,
and vignette("checking") an alpha lattice.
Article “Other model classes”: mmrm (Satterthwaite and Kenward-Roger df, joint tests, the SAS check), betareg, quantile regression through emmeans, survreg and coxph, and what stops and why.
predictmeans 2.0.0 is a major release. Defaults changed where
simulations or the literature showed a more reliable method; each such
change names the argument that gives the 1.x result. Results are checked
in the tests against SAS PROC MIXED and Genstat runs, pbkrtest, nlme and
emmeans. Every removed argument or function stops with its 2.0 spelling,
the value given filled in; nothing is silently ignored.
vignette("migrating") shows 1.1.1 and 2.0 code side by
side.
| Removed | Use instead |
|---|---|
smZ(), smoothZ = |
smooths in the formula of semireg() /
semireg_tmb(), e.g. s(x, bs = "os") |
permglmer(), permglmmTMB() |
permlmer() (they were the same function) |
permanova.lmer() |
permmodels(model, type = ) (Freedman-Lane; other
p-values) |
R2_glmm() |
R2_model(model) (same values, as numbers) |
ci_mcp() |
predictmeans(..., letter_ci = TRUE) |
conf.level ->
conf_level, letterCI ->
letter_ci, as.is -> as_is,
test.statistic -> test_statistic,
max.degree -> max_degree,
drop.unused.levels -> drop_unused_levels.
Result columns keep the broom names (conf.low,
std.error, p.value).level (a significance level) ->
conf_level = 1 - level in predictmeans(),
contrastmeans(), covariatemeans(),
pm_slopes(), semipred(),
permstats(), PMplot(). In
varcomp() level was a confidence level
already: conf_level with the same value.Df -> df_method = <number>;
df_term(type = ) ->
df_term(df_method = ).covariateV -> at in
covariatemeans(), semipred(),
Kmatrix().semipred(semireg = ) ->
semipred(model = ); simultaneous = TRUE ->
band = "simultaneous".permlmer(lmer0, lmer1) ->
permlmer(model0, model1).residplot(level = ) -> re_level;
CookD(idn = ) -> id.semireg(ngbinomial = TRUE) ->
semireg_tmb(family = glmmTMB::nbinom2).transOff (put the offset inside
trans, e.g. trans = function(x) exp(x) - 1);
count (Poisson and negative binomial means are detected);
responsen (read from the model).prtnum, ndecimal,
prt. Nothing is printed during a call; use
print(x) or print(x, digits = ).predictmeans() plot arguments: plot,
plot_args, which.plots, mplot,
barplot, pplot, bkplot,
prtplt, plotord, lineplot,
lsd_bar, jitterv, plottitle,
plotxlab, plotylab, basesz.
plot = FALSE is still accepted.covariatemeans() (trellis,
plotord, mtitle, ci,
point, jitterv) and semipred()
(trellis, scales, plotord,
ci, point, jitterv,
threeD): use autoplot() on the result;
plot_args = list(...) still works (superseded).newwd (predictmeans(),
covariatemeans(), residplot(),
CookD(), PMplot()),
residplot(ask), PMplot(margin, legendx):
ggplot2 draws in the current device.semireg(): ncenter, nscale,
resp_scale (variables are used as they are);
predict_info in semireg() and
semireg_tmb() (always kept).permmodels(fo = ): the formula is read from the
model.predictmeans() draws no plots. Use
autoplot(pm) or plot(pm) with
type = "means", "bar", "ci" (the
1.x back-transformed plot) or "pvalue". The result has no
predictmeansPlot or predictmeansBarPlot.covariatemeans() and semipred() draw only
when asked: plot = TRUE, autoplot(), or
options(predictmeans.plot = TRUE).pairwise defaults to NULL: comparisons are
made when adj, atvar, permlist,
letter_ci or pairwise = TRUE asks for them.
pairwise only sets what is printed.pairs$lsd.covariatemeans()$pltdf is now $pred_df (as
in semipred()); $pltdf still works with a
message.semipred(threeD) / autoplot(type = "3d")
gives one plotly widget, not a list.contrastmeans() returns class
"contrastmeans" with
adj.conf.low/adj.conf.high columns;
pm_slopes() column slope is now
estimate.se_ranef() returns a data frame (class
pm_ranef); as.list() gives the 1.x list of SE
matrices.summary() of a semireg() /
semireg_tmb() fit returns a list with the mixed-model
summary in $model.fit$knots_lst, range_lst,
type_lst and smoothZ_call are gone; refit
models saved with smZ().library(predictmeans) attaches lme4 and nlme only.
glmmTMB moved to Imports and lmerTest to Suggests: call
library(glmmTMB) or library(lmerTest) when
needed.ncore defaults to 1 (was 3) in
predictmeans(), permlmer() and
permmodels().residplot(id) defaults to 3: the three largest
residuals are labelled.lmer fits use Kenward-Roger adjusted standard
errors in predictmeans(), contrastmeans() and
covariatemeans(), as SAS DDFM=KR and emmeans.
Unbalanced designs change slightly. 1.x:
vcov_adjust = FALSE.df_method = "KR-expected".df_method = "auto"): Kenward-Roger for REML
lmer, lme and gls; Satterthwaite
for ML fits; inner-outer df for GLMMs; z tests for Poisson, binomial and
negative binomial glm. Simulations showed the old df
rejected too often (or too rarely for glm). 1.x:
df_method = "residual" (or "containment" for
lme/gls).permmodels() uses Freedman-Lane permutations
(method = "auto"), so other terms keep their effects. 1.x:
method = "raw".perms
holds a complete enumeration.permlmer() with different fixed effects refits both
models by ML, so the permuted statistic is the printed likelihood
ratio.se_ranef() defaults to the prediction error SE
(type = "prediction", SAS “Std Err Pred”), larger than 1.x.
1.x: type = "conditional".NA, with
a message; estimable differences are shown.aov() with Error() is analysed by strata,
as Genstat, with missing values estimated as Genstat’s ANOVA. It was
refitted as lmer. 1.x: fit the mixed model yourself.log(y),
log(y + c), sqrt(y), …) is back-transformed by
default. trans = I keeps the model scale. A given
trans is now used also for models with a link.bias_adjust = TRUE gives the mean exactly by
quadrature. The 1.x-style second-order formula:
bias_adjust = "taylor".covariatemeans() with a log link or
trans = exp draws the back-transformed fitted value; 1.x
added half the SE.atvar it uses the pairs within each level.
adj = "none" is unchanged.letter_ci = TRUE reads letters from comparison
intervals at the comparisons’ level; drop a 1.x
level = 0.166.semipred() limits are two-sided at the stated level
(1.x defaults gave 90%). Gaussian semireg() fits get t
limits with Satterthwaite df; generalized fits include
smoothing-parameter uncertainty (unconditional).semireg() uses the nloptwrap optimizer.
1.x: control = lmerControl(optimizer = "bobyqa").semireg_tmb() fits are REML, as documented
(they were ML).glmer Poisson back-transformed means are counts, as for
glm and glmmTMB.means, pairs and
settings with fixed column names; tidy(),
glance(), as.data.frame(), coef()
and vcov() methods. The 1.x elements are kept.weights = "equal", "proportional" (SAS
OM), "outer", "cells",
"flat" for averaging cells."sidak", "scheffe" and
"mvt"; adjusted confidence limits
adj.conf.low/adj.conf.high.contrast_family(), specify_contrast()
(contrasts by level name), pm_joint() (joint F tests and
slices), pm_slopes() (slopes per level),
contrastmeans(joint = TRUE).equivalence =); robust covariances
(vcov = "HC0" to "HC3",
~ cluster, or a matrix or function).average = "response"; pm_boxcox() and
pm_yeojohnson() for formulas.mean_type = "overall" for zero-inflated glmmTMB
models.Kmatrix() handles poly(), splines,
transformations, gam smooths, covariates by name and
combinations of factors that are not a model term;
cov_reduce and exclude.df_method = "Kenward-Roger",
"KR-expected", "KR-average" (Genstat),
"Satterthwaite", "containment",
"between-within", "inner-outer",
"residual" or a number, also for lme and
gls.anova() of lmer fits with Kenward-Roger or
Satterthwaite F tests, Types I, II, III, without lmerTest.varcomp() for every model class, with
observed-information SEs and Satterthwaite intervals;
test = TRUE tests each component (likelihood ratio,
boundary mixture or parametric bootstrap).se_ranef() for lmer, glmer,
glmmTMB, lme and semireg fits,
with any covariance structure; checked against SAS PROC MIXED;
predict = TRUE adds the fixed part to each BLUP.R2_model() with method = "piepho" or
"nakagawa", for every model class; reproduces Piepho
(2023).lm, glm,
lmer, lme, gls,
glmer and glmmTMB, with or without refits
(refit).permlmer() tests GLMMs on the working scale;
method = "quantile" for 0/1 responses.adj = "westfall"; robust = TRUE (HC3, sign
flips).bootmodels() for parametric bootstrap p-values, usable
as permlist.permindex() and perms for restricted
permutations; permstats(); permcombine().semireg() and
semireg_tmb(): mgcv bases, by =,
s(x, f) and s(x, f1*f2) deviation curves,
bs = "os", bs = "ztps",
bs = "user", t2() tensor products, random
curves (s(x) | g), glmmTMB covariance structures.semipred(): simultaneous bands,
deriv = 1, 2, curve differences with a test,
bias_adjust, boundary;
semiboundary() for two-dimensional data.anova() of semireg() fits with tests of
smooth variances; predictmeans() on semireg()
fits.coef(),
vcov(), fitted() and other methods work.autoplot() for every result: means, bars, confidence
limits, p-value heat maps, curves, surfaces, 3-D, differences;
x, group, panel,
interval, data, scales.residplot(), CookD() and
PMplot() are drawn with ggplot2 for every model class;
residplot(interactive = TRUE) uses plotly. Many overlapping
points are drawn as transparent open circles (or, with
dense = "bins", as shaded bins with the outstanding points
on top); the Q-Q plot of many residuals keeps every tail point.pm_check(): a table of checks of a fitted model
(outliers, influence, normality, equal variances, dispersion,
separation, collinearity, …).advice() returns it,
options(predictmeans.advice = FALSE) hides it.pm_coef(), pm_vcov(),
pm_basis(), pm_data(), pm_df(),
pm_linkinv() for new model classes (?pm_coef).
The columns of the design are matched to the coefficients by name; a
name without a column stops with a message, never a silent
mismatch.Caschool,
DataExam5.2, copper and M. P. Wand’s
examples.autoplot() of means by group with the data
(data = TRUE) works with ggplot2 3.4, as
DESCRIPTION promises (it stopped: “position_jitterdodge()
requires at least one aesthetic to dodge by”).
Permutation tests, bootmodels() and
variance-component tests of lmer/glmer fits
with missing values work with older lme4 (1.1-35 dropped the missing
rows twice in refit()).
A glmmTMB fit with aliased coefficients
(e.g. combinations of levels without data) no longer stops every means
function with “logical subscript too long”; the means equal those of the
same lmer ML fit.
semireg() with a deviation smooth
s(x, f1*f2) no longer gives the warning “number of items to
replace”.
permlmer() reports lme4 convergence warnings of the
permuted refits once, as a count, instead of one warning per
refit.
Tukey p-values within atvar levels used the number
of pairs instead of means.
predictmeans() failed for lmer models
with a missing treatment combination, and for ML lmer
fits.
predictmeans() with permlist and
atvar failed; a user Df for lmer
gave NA p-values.
Factor levels containing ":" broke the pairwise
tables.
Within-atvar adjusted p-values could be matched to
the wrong pairs.
contrastmeans() failed with any missing treatment
combination.
Kenward-Roger ignored prior weights and offsets of
lmer fits.
semireg() 0/1 responses had SEs 15-25% too small;
Gamma and inverse-Gaussian SEs were too small.
semireg() gaussian fits had wrong
anova() df and varcomp() SEs.
semireg_tmb() negative binomial SEs were scaled by
theta; zero-inflated bands were too narrow.
semipred(contr = ) bands of generalized models were
wrong.
varcomp() SEs for glmer and limits for
glmmTMB were wrong.
R2_glmm() was wrong for some glmmTMB families,
offsets and correlated random effects.
permindex() with block or
group returned indices for sorted data.
permmodels() permuted only one column of
cbind() responses; type I lmer tables compared
different statistics.
permmodels() and CookD() could refit
with a data set of the same name found elsewhere.
CookD() failed for every lmer
model.
anova() for lmer and
semireg fits and of se_ranef() show their
usage (CRAN pre-test: “Rd files without ”).vignette("predictmeans") rewritten, with a table of
default df by model class.?advice lists every
advice id.The full development log of 2.0.0 is in the package source, file
dev/NEWS-2.0-development.md.
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.