New Features
- Fit models with the new
stanlibackend (backend = "stanli"), which
needs no C++ toolchain or compilation step. - Extend
posterior_predictbeyond random draws via argumentoutput,
which can be"random"(the default),"probability","pit",
"density", or"quantile", with supporting argumentsq,p,
lower.tail,log.p, andlogthanks to Aki Vehtari and
Florence Bockting. (#1857) - Predict all mixing proportions of a
mixturefamily without a reference
category viarefcat = NA, analogous torefcat = NAin categorical models.
Thanks to Gidon Frischkorn. (#1450) - Support the
ordbetafamily to handle exact 0s and 1s in unit interval data.
Thanks to Robert Kubinec. (#1852)
Bug Fixes
- Fix predictions of
gpterms with a factorbyvariable in models
with othergpterms. Thanks to Nicholas Clark. (#1979) - Evaluate the Stan functions of ordinal models on the log scale, as
log_lik
does, for all links ofsratioandcratioand the links other than logit
of the other families, so improbable categories no longer make the log
density-Inf. Thanks to Ahmed Eldeeb. (#1962) - Fix compilation of models with the softit link, and of non-linear
cumulative,hurdle_cumulativeandacatmodels with the cauchit link.
Thanks to Ahmed Eldeeb. (#1962) - Use the complementary CDFs in the Stan code of two-sided truncation and
interval censoring once the CDF of the lower bound rounds towards 1, for
thepoisson,beta_binomial,weibull,lognormal,shifted_lognormal,
exgaussian, andstudentfamilies, whose truncated log density otherwise
became inaccurate and then infinite. Thanks to Ahmed Eldeeb. (#1956) - Evaluate
log_likof ordinal models on the log scale throughout, so
improbable categories no longer give-InforNaNwhere their log
probability is representable, and stop it failing for two categories or a
single draw. Thanks to Ahmed Eldeeb. (#1192) - Factor out the largest category in
log_softmax(), which overflowed or
underflowed for large linear predictors. Thanks to Ahmed Eldeeb. (#1951) - Index the top category as
nthres + 1in the Stan code of logit
hurdle_cumulativemodels with a predicteddiscorcs()terms, which
stopped sampling with an index error. Thanks to Ahmed Eldeeb. (#1952) - Improve numerical consistency of COM-Poisson probabilities and means.
Refit models where the previous approximation was inaccurate. (#1938) - Account for censoring and truncation in COM-Poisson
log_lik(). (#1938) - Fix COM-Poisson CDF vectorization and support boundaries. (#1938)
- Return
-Infrather thanNaNfromlog_sum_exp()when both arguments
are-Inf, matching Stan. This also affectsnlf()formulas that call it.
Thanks to Ahmed Eldeeb. (#1899) - Evaluate the cdf and survival function of
frechet,gen_extreme_value,
discrete_weibull,asym_laplace,inverse.gaussian,exgaussianand the
zero-inflated and hurdle families on the log scale, so that truncated
log_likreaches them too. Thanks to Ahmed Eldeeb. (#1899) - Preserve the matrix structure of factors in
newdata, which is required for
matrix predictors of smooth terms such asmrf. Thanks to Sebastian
Weber. (#1935) - Stop rounding
posterior_predictoutput to integers for discrete models
unlessoutputis"random", which collapsed probabilities and densities
to 0 or 1. Thanks to Ahmed Eldeeb. (#1923) - Include the lower bound in
posterior_predictoutputs"probability",
"pit","density"and"quantile"for truncated discrete models,
matching the other post-processing methods. Thanks to Ahmed Eldeeb. (#1923) - Include the lower bound when computing
posterior_epredfor truncated
discrete models, matching the generated Stan code andlog_lik.
Thanks to Ahmed Eldeeb. (#1923) - Normalize truncated
log_likbyP(lb <= Y <= ub)for integer
responses, matching the generated Stan code, so thatlooandwaic
agree with the model that was fitted. Thanks to Ahmed Eldeeb. (#1903) - Improve the numerical stability of
log_likfor truncated and
interval-censored models, which previously returnedInforNaNwhenever
both bounds fell far into the same tail. Families whose CDF is not itself
accurate on the log scale are not yet covered.
Thanks to Ahmed Eldeeb. (#1899) - Warn when
log_likreturns infinite values, which the existing check for
NAvalues did not catch. (#1899) - Align the R functions
log1m_exp()andlog_diff_exp()with their
definitions in Stan. (#1899) - Cox models now place the knots of the baseline hazard based on the event
times only instead of both event and censoring times. Models fitted with
brms 2.23.1 or earlier keep using their original knots in post-processing.
Thanks to Sebastian Weber. (#1898) - The basis of the baseline hazard of Cox models is now stored with the
response instead of with the predictor terms. As a result,log_lik,loo
andkfoldapplied to new data reuse the knots chosen at fitting time also
for non-linear formulas. Thanks to Sebastian Weber. (#1898) kfold_predict()supports now families whose predictions are not draws x
observations matrices (e.g. categorical models). (#1889)bayes_R2now uses model-based residual variances for Gaussian and Bernoulli
models and falls back to residual-based computation for other families. This
change may lead to changes in plotting results. (#1815)- Restore the mode parameterization of the
com_poissonfamily on the Stan
side, which had switched to the classical parameterization in #1765 while the
R-side density functions did not, so that R-side post-processing no longer
disagrees with the sampled density whenevershape != 1. Also correct the
condition selecting the asymptotic normalizing constant, which was left
unchanged by that switch and so no longer described the intended region.
Models fitted withcom_poissonandshape != 1using affected versions
were sampled under the classical parameterization and should be
refitted. (#1927) - Compare magnitudes when skipping unrelated levels in
gr(..., cov = M)terms
with correlated coefficients, so that negative entries of the covariance
matrix's Cholesky factor are no longer silently discarded. This affected
multivariate and random-slope models using genomic or pedigree relationship
matrices. (#1939) - Fix several other minor bugs.
Other Changes
- Improve documentation in several places.
- Support the upcoming CmdStanR 1.0 release.