updating: Bayesian updating of prior distributions

Description Usage Arguments See Also Examples

Description

All prior distributions described in Prior can be updated with binomial observations (x out of n responses).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S4 method for signature 'PointMass'
update(object, x, n)

## S4 method for signature 'Beta'
update(object, x, n)

## S4 method for signature 'BetaMixture'
update(object, x, n)

## S4 method for signature 'GenericDistribution'
update(object, x, n)

## S4 method for signature 'JeffreysPrior'
update(object, x, n)

Arguments

object

Prior distribution object to update

x

number of responses out of n individuals

n

number of individuals out of which x had a response

See Also

Prior, condition

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
  # point mass distributions are invariant under updating
  update(PointMass(.4), 3, 10)

## End(Not run)

## Not run: 
  update(Beta(5, 7), 3, 10) # same as Beta(8, 14)

## End(Not run)

## Not run: 
  update(1/3*Beta(5, 7) + 2/3*Beta(1,1), 3, 10) # update mixtures

## End(Not run)
## Not run: 
  design    <- Design(c(0, 30, 25, 0), c(Inf, 10, 7, -Inf))
  prior     <- JeffreysPrior(design)
  posterior <- update(prior, 3, 10) # results in a GenericDistribution object (no analytical update)
  update(posterior, 2, 5) # the generic posterior of a Jeffreys prior can also be updated again

## End(Not run)

kkmann/badr documentation built on Oct. 18, 2020, 5:22 p.m.