update.beta_binomial_fit: Update the Beta-Binomial model posterior with new data

Description Usage Arguments Value Examples

View source: R/beta_binom.R

Description

Uses the previously computed Beta posterior as prior to compute a new Beta posterior, which can subsequently be updated as even more data becomes available.

Usage

1
2
## S3 method for class 'beta_binomial_fit'
update(object, x, n = NULL, n_sims = 1000, ...)

Arguments

object

An object of class "beta_binomial_fit".

x

A numeric vector of success counts OR a 2x2 table or matrix.

n

A numeric vector of totals. (Optional if x is a table or matrix.)

sims

Number of draws (simulations) to make from the posterior distributions.

Value

An S3 object of class "beta_binomial_fit".

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
fake_data <- matrix(c(200, 150, 250, 300), nrow = 2, byrow = TRUE)
colnames(fake_data) <- c('Safe' ,'Dangerous')
rownames(fake_data) <- c('Animals', 'Plants')

fit <- beta_binom(fake_data)
fit <- update(fit, x = c(100, 200), n = c(400, 600))

## End(Not run)

bearloga/BCDA documentation built on Feb. 8, 2021, 3:43 p.m.