Learn R Programming

HelpersMG (version 4.5)

newdbeta: Density for the Beta distributions.

Description

Density for the Beta distribution with parameters mu and v or shape1 and shape2 (and optional non-centrality parameter ncp).

Usage

newdbeta(x, mu = NULL, v = NULL, shape1, shape2, ncp = 0, log = FALSE)

Arguments

x

vector of quantiles.

mu

mean of the Beta distribution.

v

variance of the Beta distribution.

shape1

non-negative parameters of the Beta distribution.

shape2

non-negative parameters of the Beta distribution.

ncp

non-centrality parameter.

log

logical; if TRUE, probabilities p are given as log(p).

Value

newdbeta gives the density for the Beta distributions

Details

newdbeta returns the density for the Beta distributions

The Beta distribution with parameters shape1 = a and shape2 = b has density gamma(a+b)/(gamma(a)gamma(b))x^(a-1)(1-x)^(b-1) for a > 0, b > 0 and 0 <= x <= 1 where the boundary values at x=0 or x=1 are defined as by continuity (as limits). The mean is a/(a+b) and the variance is ab/((a+b)^2 (a+b+1)). These moments and all distributional properties can be defined as limits.

Examples

Run this code
# NOT RUN {
pi <- rbeta(100, shape1=0.48, shape2=0.12)
hist(pi, freq=FALSE, breaks=seq(from=0, to=1, by=0.1), ylim=c(0, 8), las=1)
library("HelpersMG")
mx <- ScalePreviousPlot()$ylim["end"]/
      max(newdbeta(seq(from=0.01, to=0.99, by=0.01), mu = 0.8, v=0.1))
curve(newdbeta(x, mu = 0.8, v=0.1)*mx, add=TRUE, col="red")
# }

Run the code above in your browser using DataLab