poisdp: Poisson sampling with a discrete prior

Description Usage Arguments Value See Also Examples

View source: R/poisdp.r

Description

Evaluates and plots the posterior density for mu, the mean rate of occurance in a Poisson process and a discrete prior on mu

Usage

1
poisdp(y.obs, mu, mu.prior, ...)

Arguments

y.obs

a random sample from a Poisson distribution.

mu

a vector of possibilities for the mean rate of occurance of an event over a finite period of space or time.

mu.prior

the associated prior probability mass.

...

additional arguments that are passed to Bolstad.control

Value

A list will be returned with the following components:

likelihood

the scaled likelihood function for mu given y.obs

posterior

the posterior probability of mu given y.obs

mu

the vector of possible mu values used in the prior

mu.prior

the associated probability mass for the values in mu

See Also

poisgamp poisgcp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## simplest call with an observation of 4 and a uniform prior on the
## values mu = 1,2,3
poisdp(4,1:3,c(1,1,1)/3)

##  Same as the previous example but a non-uniform discrete prior
mu = 1:3
mu.prior = c(0.3,0.4,0.3)
poisdp(4,mu=mu,mu.prior=mu.prior)

##  Same as the previous example but a non-uniform discrete prior
mu = seq(0.5,9.5,by=0.05)
mu.prior = runif(length(mu))
mu.prior = sort(mu.prior/sum(mu.prior))
poisdp(4,mu=mu,mu.prior=mu.prior)

## A random sample of 50 observations from a Poisson distribution with
## parameter mu = 3 and  non-uniform prior
y.obs = rpois(50,3)
mu = c(1:5)
mu.prior = c(0.1,0.1,0.05,0.25,0.5)
results = poisdp(y.obs, mu, mu.prior)

##  Same as the previous example but a non-uniform discrete prior
mu = seq(0.5,5.5,by=0.05)
mu.prior = runif(length(mu))
mu.prior = sort(mu.prior/sum(mu.prior))
y.obs = rpois(50,3)
poisdp(y.obs,mu=mu,mu.prior=mu.prior)

Bolstad documentation built on Jan. 8, 2021, 2:03 a.m.