sd_ratio: Compute the Savage-Dickey density ratio

View source: R/helper_functions.R

sd_ratioR Documentation

Compute the Savage-Dickey density ratio

Description

Computes the Saveage-Dickey density ratio from a posterior object at a specified point

Usage

sd_ratio(x, point)

Arguments

x

a posterior object

point

the point at which to evaluate the Savage-Dickey ratio

Value

A numeric of the Savage-Dickey density ratio

Examples

# define a likelihood
data_model <- likelihood(family = "normal", mean = 5.5, sd = 32.35)

# define a prior
prior_model <- prior(family = "normal", mean = 5.5, sd = 13.3)

model <- extract_posterior(data_model * prior_model)

# compute the Savage-Dickey density ratio at 0
sd_ratio(model, 0)

bayesplay documentation built on April 14, 2023, 12:30 a.m.