Learn R Programming

rmp (version 2.2)

dp.post.est: Posterior probability mass function estimation with DP prior

Description

Performs Bayesian probability mass function estimation under DP prior with Poisson base measure.

Usage

dp.post.est(x, y, alpha, lambda)

Value

A vector of size length(x) containing the probability masses

Arguments

x

Values on which to compute the pmf.

y

Vector of observed data.

alpha

DP precision parameter

lambda

Mean parameter for the Poisson base measure.

Author

Antonio Canale

Details

Performs probability mass function estimation under th following model $$y_i \mid P \sim P, i=1, \dots, n$$ $$P \sim DP(\alpha, P_0),$$ where \(P_0\) is Poisson with mean lambda.

References

Carota, C., and Parmigiani, G. (2002), ``Semiparametric Regression for Count Data,'' Biometrika, 89, 265--281.

Examples

Run this code
data(ethylene)
y <- tapply(ethylene$impl,FUN=mean,INDEX=ethylene$id)
z <- tapply(ethylene$dose,FUN=mean,INDEX=ethylene$id)

# Estimate the pmf of the number of implants in the control group
y0  <- y[z==0]
pmf.control = dp.post.est(0:30, y0, alpha = 1)

Run the code above in your browser using DataLab