mcp 0.3.0
New features:
-
Get fits and predictions for in-sample and out-of-sample data. Read more in the article on these functions.
- Use
predict(fit)
to get predicted values and quantiles. - Use
fitted(fit)
to get estimated values and quantiles. - Use
residuals(fit)
to get residuals and quantiles.
All of the above functions include many arguments that align with (and extends) the options already in
plot.mcpfit()
, including getting fits/predictions for sigma (which_y = "sigma"
), for the prior (prior = TRUE
), and arbitrary quantiles (probs = c(0.1, 0.5, 0.999)
). Use thenewdata
argument to get out-of-sample fitted/predicted values. Setsummary = FALSE
to get per-draw values. - Use
-
Added support for weighted regression for gaussian families:
model = list(y | weights(weight_column) ~ 1 + x)
. Weights are visualized as dot sizes inplot(fit)
. -
Support for more link functions across families (e.g.,
family = gaussian(link = "log")
) see this article for more info:gaussian
: "identity", "log"binomial
: "logit", "probit", "identity"bernoulli
: "logit", "probit", "identity"poisson
: "log", "identity"
-
New argument
scale
infitted()
,plot()
, andfit$simulate()
. Whenscale = "response"
(default), they return fits on the observed scale. Whenscale = "linear"
, they return fits on the parameter scale where the linear trends are. Useful for model understanding and debugging. -
Use
pp_check(fit)
to do prior/posterior predictive checking. Seepp_check(fit, type = "x")
for a list of plot types.pp_check(fit, facet_by = "varying_column")
facets by a data column. -
Improvements to
plot()
:- Change point densities are now computed on a per-panel basis in
plot(fit, facet_by = "varying_column")
. Previous releases only displayed population-level change points. - You can now plot varying effects with
rate = FALSE
for binomial models. - Change point densities in
plot(fit)
are not located directly on the x-axis. They were "floating" 5% above the x-axis in the previous releases.
- Change point densities are now computed on a per-panel basis in
-
New argument
nsamples
reduces the number of samples used in most functions to speed up processing.nsamples = NULL
uses all samples for maximum accuracy. -
New argument
arma
in many functions toggles whether autoregressive effects should be modelled. -
Although the API is still in alpha, feel free to try extracting samples using
mcp:::tidy_samples(fit)
. This is useful for further processing usingtidybayes
,bayesplot
, etc. and is used extensively internally inmcp
. One useful feature is computing absolute values for varying change points:mcp:::tidy_samples(fit, population = FALSE, absolute = TRUE)
. Feedback is appreciated beforetidy_samples
will to become part of themcp
API in a future release.
Other changes
- Change point densities in
plot(fit)
are now scaled to 20% of the plot for each chain X changepoint combo. This addresses a common problem where a wide posterior was almost invisibly low when a narrow posterior was present. This means that heights should only be compared within each chain x changepoint combo - not across. - Removed the implicit ceiling of 1000 lines and samples in
plot.mcpfit()
. - Rownames are removed from
ranef()
andfixef()
returns. - A major effort has been put into making
mcp
robust and agile to develop.mcp
now use defensive programming with helpful error messages. The Test suite includes 3600+ tests. plot()
,predict()
, etc. are now considerably faster for AR(N) due to vectorization of the underlying code.
Bug fixes
- Sigma is now forced to stay positive via a floor at 0.
- Fixed: support and require dplyr 1.0.0. Now also requires tidybayes 2.0.3.
- Fixed: Parallel sampling sometimes produced identical chains.
- Fixed several small bugs