Compute various point-estimates, such as the mean, the median or the MAP, to describe posterior distributions.
point_estimate(x, centrality = "all", dispersion = FALSE, ...) # S3 method for numeric point_estimate(x, centrality = "all", dispersion = FALSE, threshold = 0.1, ...) # S3 method for stanreg point_estimate( x, centrality = "all", dispersion = FALSE, effects = c("fixed", "random", "all"), component = c("location", "all", "conditional", "smooth_terms", "sigma", "distributional", "auxiliary"), parameters = NULL, ... ) # S3 method for brmsfit point_estimate( x, centrality = "all", dispersion = FALSE, effects = c("fixed", "random", "all"), component = c("conditional", "zi", "zero_inflated", "all"), parameters = NULL, ... ) # S3 method for BFBayesFactor point_estimate(x, centrality = "all", dispersion = FALSE, ...)
x | Vector representing a posterior distribution, or a data frame of such
vectors. Can also be a Bayesian model ( |
---|---|
centrality | The point-estimates (centrality indices) to compute. Character (vector) or list with one or more of these options: |
dispersion | Logical, if |
... | Additional arguments to be passed to or from methods. |
threshold | For |
effects | Should results for fixed effects, random effects or both be returned? Only applies to mixed models. May be abbreviated. |
component | Should results for all parameters, parameters for the conditional model or the zero-inflated part of the model be returned? May be abbreviated. Only applies to brms-models. |
parameters | Regular expression pattern that describes the parameters that
should be returned. Meta-parameters (like |
There is also a plot()
-method implemented in the see-package.
Vignette In-Depth 1: Comparison of Point-Estimates
#> # Point Estimates #> #> Median | Mean | MAP #> -------------------------- #> -0.01 | -4.73e-03 | -0.03 #>#> # Point Estimates #> #> Median | MAD | Mean | SD | MAP #> ------------------------------------------ #> -8.46e-03 | 0.96 | 9.15e-03 | 0.96 | -0.08 #>#> # Point Estimates #> #> Median | MAP #> ---------------- #> -2.70e-03 | 0.07 #>df <- data.frame(replicate(4, rnorm(100))) point_estimate(df, centrality = "all", dispersion = TRUE)#> # Point Estimates #> #> Parameter | Median | MAD | Mean | SD | MAP #> ------------------------------------------------ #> X1 | -0.09 | 1.01 | -0.13 | 1.00 | 0.15 #> X2 | 0.20 | 0.87 | 0.19 | 0.96 | 0.24 #> X3 | -0.07 | 0.89 | -0.01 | 0.94 | -0.25 #> X4 | -0.09 | 1.02 | 0.03 | 1.00 | -0.33 #>#> # Point Estimates #> #> Parameter | Median | MAP #> -------------------------- #> X1 | -0.09 | 0.15 #> X2 | 0.20 | 0.24 #> X3 | -0.07 | -0.25 #> X4 | -0.09 | -0.33 #>if (FALSE) { # rstanarm models # ----------------------------------------------- library(rstanarm) model <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars) point_estimate(model, centrality = "all", dispersion = TRUE) point_estimate(model, centrality = c("median", "MAP")) # emmeans estimates # ----------------------------------------------- library(emmeans) point_estimate(emtrends(model, ~1, "wt"), centrality = c("median", "MAP")) # brms models # ----------------------------------------------- library(brms) model <- brms::brm(mpg ~ wt + cyl, data = mtcars) point_estimate(model, centrality = "all", dispersion = TRUE) point_estimate(model, centrality = c("median", "MAP")) # BayesFactor objects # ----------------------------------------------- library(BayesFactor) bf <- ttestBF(x = rnorm(100, 1, 1)) point_estimate(bf, centrality = "all", dispersion = TRUE) point_estimate(bf, centrality = c("median", "MAP")) }