NBF: Negative Binomial Family distribution for fitting a GAMLSS

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

The NBF() function defines the Negative Binomial family distribution, a three parameter distribution, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss(). The functions dNBF, pNBF, qNBF and rNBF define the density, distribution function, quantile function and random generation for the negative binomial family, NBF(), distribution.

The functions dZINBF, pZINBF, qZINBF and rZINBF define the density, distribution function, quantile function and random generation for the zero inflated negative binomial family, ZINBF(), distribution a four parameter distribution.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
NBF(mu.link = "log", sigma.link = "log", nu.link = "log")

dNBF(x, mu = 1, sigma = 1, nu = 2, log = FALSE)

pNBF(q, mu = 1, sigma = 1, nu = 2, lower.tail = TRUE, log.p = FALSE)

qNBF(p, mu = 1, sigma = 1, nu = 2, lower.tail = TRUE, log.p = FALSE)

rNBF(n, mu = 1, sigma = 1, nu = 2)

ZINBF(mu.link = "log", sigma.link = "log", nu.link = "log", 
      tau.link = "logit")
      
dZINBF(x, mu = 1, sigma = 1, nu = 2, tau = 0.1, log = FALSE)

pZINBF(q, mu = 1, sigma = 1, nu = 2, tau = 0.1, lower.tail = TRUE, 
      log.p = FALSE)
      
qZINBF(p, mu = 1, sigma = 1, nu = 2, tau = 0.1, lower.tail = TRUE, 
      log.p = FALSE)      
      
rZINBF(n, mu = 1, sigma = 1, nu = 2, tau = 0.1)      

Arguments

mu.link

The link function for mu

sigma.link

The link function for sigma

nu.link

The link function for nu

tau.link

The link function for tau

x

vector of (non-negative integer)

mu

vector of positive means

sigma

vector of positive dispersion parameter

nu

vector of power parameter

tau

vector of inflation parameter

log, log.p

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

lower.tail

logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]

p

vector of probabilities

q

vector of quantiles

n

number of random values to return

Details

The definition for Negative Binomial Family distribution , NBF, is similar to the Negative Binomial type I. The probability function of the NBF can be obtained by replacing σ with σ μ^{ν-2} where ν is a power parameter. The distribution has mean μ and variance μ+σ μ^{ν}.

Value

returns a gamlss.family object which can be used to fit a Negative Binomial Family distribution in the gamlss() function.

Author(s)

Bob Rigby and Mikis Stasinopoulos

References

Anscombe, F. J. (1950) Sampling theory of the negative binomial and logarithmic distributions, Biometrika, 37, 358-382.

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, http://www.jstatsoft.org/v23/i07.

Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.

Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.

See Also

NBI, NBII

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
NBF() # default link functions for the Negative Binomial Family 
# plotting the distribution
plot(function(y) dNBF(y, mu = 10, sigma = 0.5, nu=2 ), from=0, 
     to=40, n=40+1, type="h")
# creating random variables and plot them 
tN <- table(Ni <- rNBF(1000, mu=5, sigma=0.5, nu=2))
r <- barplot(tN, col='lightblue')
# zero inflated NBF
ZINBF() # default link functions  for the zero inflated NBF 
# plotting the distribution
plot(function(y) dZINBF(y, mu = 10, sigma = 0.5, nu=2, tau=.1 ), 
     from=0, to=40, n=40+1, type="h")
# creating random variables and plot them 
tN <- table(Ni <- rZINBF(1000, mu=5, sigma=0.5, nu=2, tau=0.1))
r <- barplot(tN, col='lightblue')
## Not run: 
library(gamlss)
data(species)
species <- transform(species, x=log(lake))
m6 <- gamlss(fish~poly(x,2), sigma.fo=~1, data=species, family=NBF, 
          n.cyc=200)
fitted(m6, "nu")[1]

## End(Not run)

Stan125/gamlss.dist documentation built on May 12, 2019, 7:38 a.m.