BetaRates-class {BetaModels}R Documentation

Class "BetaRates"

Description

Test for different proportions (rates) in different groups using a Bayesian model in which all rate parameters follow a beta distribution and are selected from a common hyperdistribution.

Usage

BetaRates(k, n, x=seq(-3,3, length=100), y=x)
## S4 method for signature 'BetaRates'
summary(object, ...)
## S4 method for signature 'BetaRates'
image(x, col=greyscale(128), ...)
samplePosteriorRates(br, nsamp=2000)
guessCenter(v)

Arguments

object

object of class BetaRates

br

object of class BetaRates

x

In the image method, an object of class BetaRates. In the BetaRates constructor, a vector of the x-axis grid points at which to compute the posterior probability; see Details.

y

vector of the y-axis grid points at which to compute the posterior probability; see Details.

k

vector of "success" counts

n

vector of all counts

col

vector containing the color map to use for the image

nsamp

Number of posterior samples to take

v

Vector of observed rates

...

extra arguments for generic or plotting routines

Details

TBD

Value

The BetaRates constructor returns an object of the indicated class.

The graphical method image) invisibly returns the object on which it was invoked.

The summary method returns a vector with the maximum a posteriori parameters of the beta distribution.

The samplePosteriorRates function returns a list with two components. The first component, xy, is an nsamp-by-2 matrix with x-y values samples from the posterior distribution. The second component, theta, is an nsamp-by-length(k) matrix with posterior samples of the rates associated with each experiment supplied to the constructor.

The guessCenter function returns a list with both x-y and alpha-beta coordinates of the naive (frequentist) estimate fo mthe overall Beta distribution parameters.

Creating Objects

Although objects can be created directly using new, the most common usage will be to pass a vector of p-values to the BetaRates function.

Slots

k:

vector of "success" counts.

n:

vector of all counts.

x:

vector of the x-axis grid points at which to compute the posterior probability; see Details.

y:

vector of the y-axis grid points at which to compute the posterior probability; see Details.

results:

Matrix of posterior probabilities.

logresults:

Matrix of log-transformed posterior probabilities.

Methods

summary(object, ...)

Prints a summary of the betaRates object. This includes (1) the maximum a posterior coordinates on x-y-space, (2) the usual alpha-beta parameters for the Beta distribution, and (3) the mean and variance.

image(x, col, ...)

Plots an ikmage of the posterior probabilities using te specified color map. The point with the maximum posterior probability is marked in red.

Author(s)

Kevin R. Coombes krc@silicovore.com

References

Gelman A, Carlin JB, Stern HS, Rubin DB. Bayesian Data Analysis, second edition. Chapman and Hall/CRC, Boca Raton, 2004. Section 5.3, pages 15-131.

Examples

showClass("BetaRates")
event <- c( 37,  4,  6,  1,  2, 10,  1, 13,   7,  1,  10)
total <- c(137, 18, 18, 26, 24, 45, 12, 43, 162, 78, 280)
guessCenter(event/total)
br <- BetaRates(event, total, x=seq(-3, 0, length=100), y=seq(0, 3, length=100))
image(br)
summary(br)

[Package BetaModels version 0.1.9 Index]