Next: invchi()
Up: MacAnova Help File
Previous: interrupt
Contents
Usage:
invbeta(P, alpha, beta [,upper:T or lower:F]), P, alpha and beta REAL,
elements of P between 0 and 1, those of alpha and beta > 0
|
Keywords:
probabilities, random numbers
invbeta(p,a,b) computes the pth quantile (100*p percent point) of the
beta distribution with parameters a and b.
The elements of p must be between 0 and 1, inclusive, and the elements
of a and b must be positive REAL numbers.
If p, a, and b are not all scalars (single numbers), all non-scalar
arguments must have must have the same size and shape and any scalar
arguments are used to compute all the elements of the result.
invbeta(p,a,b,upper:T) and invbeta(p,a,b,lower:F) compute an upper tail
quantile mathematically equivalent to invbeta(1 - p,a,b), but more
accurate when p is very close to 1.
invbeta() is the inverse of cumbeta().
invbeta(runi(n),a,b) will generate a random sample of size n from a beta
distribution .
You can use invbeta() to compute an "exact" confidence for a probability
p based on an observed value x_obs of a binomial random variable with n
trials and P(success) = p.
Cmd> n <- 19; x_obs <- 11; alpha <- .05 # 95% confidence
Cmd> p_l <- invbeta(alpha/2,x_obs,n - x_obs + 1)
Cmd> p_u <- invbeta(alpha/2,x_obs + 1,n - x_obs,upper:T)
Cmd> vector(p_l,p_u) # exact confidence limits
(1) 0.335 0.79748
Cmd> vector(cumbin(x_obs,n,p_u),cumbin(x_obs,n,p_l,upper:T)) #check
(1) 0.025 0.025
Cmd> invbeta(.975,3,4) # P(x <= .77722) = .975
(1) 0.77722
Cmd> invbeta(.025,3,4,upper:T) # P(x >= .77722) = .025
(1) 0.77722
See also cumbeta(), cumbin(), runi().
Gary Oehlert
2003-01-15