Learn R Programming

sadists (version 0.2.5)

dnbeta: The doubly non-central Beta distribution.

Description

Density, distribution function, quantile function and random generation for the doubly non-central Beta distribution.

Usage

ddnbeta(x, df1, df2, ncp1, ncp2, log = FALSE, order.max=6)

pdnbeta(q, df1, df2, ncp1, ncp2, lower.tail = TRUE, log.p = FALSE, order.max=6)

qdnbeta(p, df1, df2, ncp1, ncp2, lower.tail = TRUE, log.p = FALSE, order.max=6)

rdnbeta(n, df1, df2, ncp1, ncp2)

Value

ddnbeta gives the density, pdnbeta gives the distribution function, qdnbeta gives the quantile function, and rdnbeta generates random deviates.

Invalid arguments will result in return value NaN with a warning.

Arguments

x, q

vector of quantiles.

df1, df2

the degrees of freedom for the numerator and denominator. We do not recycle these versus the x,q,p,n.

ncp1, ncp2

the non-centrality parameters for the numerator and denominator. We do not recycle these versus the x,q,p,n.

log

logical; if TRUE, densities \(f\) are given as \(\mbox{log}(f)\).

order.max

the order to use in the approximate density, distribution, and quantile computations, via the Gram-Charlier, Edeworth, or Cornish-Fisher expansion.

p

vector of probabilities.

n

number of observations.

log.p

logical; if TRUE, probabilities p are given as \(\mbox{log}(p)\).

lower.tail

logical; if TRUE (default), probabilities are \(P[X \le x]\), otherwise, \(P[X > x]\).

Author

Steven E. Pav shabbychef@gmail.com

Details

Suppose \(x_i \sim \chi^2\left(\delta_i,\nu_i\right)\) be independent non-central chi-squares for \(i=1,2\). Then $$Y = \frac{x_1}{x_1 + x_2}$$ takes a doubly non-central Beta distribution with degrees of freedom \(\nu_1, \nu_2\) and non-centrality parameters \(\delta_1,\delta_2\).

See Also

(doubly non-central) F distribution functions, ddnf, pdnf, qdnf, rdnf.

Examples

Run this code
rv <- rdnbeta(500, df1=100,df2=500,ncp1=1.5,ncp2=12)
d1 <- ddnbeta(rv, df1=100,df2=500,ncp1=1.5,ncp2=12)
# \donttest{
plot(rv,d1)
# }
p1 <- ddnbeta(rv, df1=100,df2=500,ncp1=1.5,ncp2=12)
# should be nearly uniform:
# \donttest{
plot(ecdf(p1))
# }
q1 <- qdnbeta(ppoints(length(rv)), df1=100,df2=500,ncp1=1.5,ncp2=12)
# \donttest{
qqplot(x=rv,y=q1)
# }

Run the code above in your browser using DataLab