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.

Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in http://www.gamlss.com/.

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.com/).

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)

Example output

Loading required package: MASS

GAMLSS Family: NBF NB Family 
Link function for mu   : log 
Link function for sigma: log 
Link function for nu   : log 

GAMLSS Family: ZINBF 
Link function for mu   : log 
Link function for sigma: log 
Link function for nu   : log 
Link function for tau  : logit 
Loading required package: splines
Loading required package: gamlss.data

Attaching package: 'gamlss.data'

The following object is masked from 'package:datasets':

    sleep

Loading required package: nlme
Loading required package: parallel
 **********   GAMLSS Version 5.1-3  ********** 
For more on GAMLSS look at http://www.gamlss.org/
Type gamlssNews() to see new features/changes/bug fixes.

GAMLSS-RS iteration 1: Global Deviance = 614.1349 
GAMLSS-RS iteration 2: Global Deviance = 613.7821 
GAMLSS-RS iteration 3: Global Deviance = 613.4428 
GAMLSS-RS iteration 4: Global Deviance = 613.1159 
GAMLSS-RS iteration 5: Global Deviance = 612.8035 
GAMLSS-RS iteration 6: Global Deviance = 612.5025 
GAMLSS-RS iteration 7: Global Deviance = 612.2054 
GAMLSS-RS iteration 8: Global Deviance = 611.9217 
GAMLSS-RS iteration 9: Global Deviance = 611.6472 
GAMLSS-RS iteration 10: Global Deviance = 611.3866 
GAMLSS-RS iteration 11: Global Deviance = 611.1413 
GAMLSS-RS iteration 12: Global Deviance = 610.9056 
GAMLSS-RS iteration 13: Global Deviance = 610.6826 
GAMLSS-RS iteration 14: Global Deviance = 610.4682 
GAMLSS-RS iteration 15: Global Deviance = 610.2649 
GAMLSS-RS iteration 16: Global Deviance = 610.0689 
GAMLSS-RS iteration 17: Global Deviance = 609.8839 
GAMLSS-RS iteration 18: Global Deviance = 609.705 
GAMLSS-RS iteration 19: Global Deviance = 609.5371 
GAMLSS-RS iteration 20: Global Deviance = 609.3739 
GAMLSS-RS iteration 21: Global Deviance = 609.2215 
GAMLSS-RS iteration 22: Global Deviance = 609.0729 
GAMLSS-RS iteration 23: Global Deviance = 608.9346 
GAMLSS-RS iteration 24: Global Deviance = 608.7995 
GAMLSS-RS iteration 25: Global Deviance = 608.6739 
GAMLSS-RS iteration 26: Global Deviance = 608.5513 
GAMLSS-RS iteration 27: Global Deviance = 608.4374 
GAMLSS-RS iteration 28: Global Deviance = 608.3263 
GAMLSS-RS iteration 29: Global Deviance = 608.2228 
GAMLSS-RS iteration 30: Global Deviance = 608.1224 
GAMLSS-RS iteration 31: Global Deviance = 608.0284 
GAMLSS-RS iteration 32: Global Deviance = 607.9376 
GAMLSS-RS iteration 33: Global Deviance = 607.8522 
GAMLSS-RS iteration 34: Global Deviance = 607.7701 
GAMLSS-RS iteration 35: Global Deviance = 607.6927 
GAMLSS-RS iteration 36: Global Deviance = 607.6184 
GAMLSS-RS iteration 37: Global Deviance = 607.5481 
GAMLSS-RS iteration 38: Global Deviance = 607.4808 
GAMLSS-RS iteration 39: Global Deviance = 607.417 
GAMLSS-RS iteration 40: Global Deviance = 607.356 
GAMLSS-RS iteration 41: Global Deviance = 607.2981 
GAMLSS-RS iteration 42: Global Deviance = 607.2428 
GAMLSS-RS iteration 43: Global Deviance = 607.1903 
GAMLSS-RS iteration 44: Global Deviance = 607.1401 
GAMLSS-RS iteration 45: Global Deviance = 607.0924 
GAMLSS-RS iteration 46: Global Deviance = 607.0468 
GAMLSS-RS iteration 47: Global Deviance = 607.0034 
GAMLSS-RS iteration 48: Global Deviance = 606.9621 
GAMLSS-RS iteration 49: Global Deviance = 606.9226 
GAMLSS-RS iteration 50: Global Deviance = 606.885 
GAMLSS-RS iteration 51: Global Deviance = 606.8491 
GAMLSS-RS iteration 52: Global Deviance = 606.8149 
GAMLSS-RS iteration 53: Global Deviance = 606.7823 
GAMLSS-RS iteration 54: Global Deviance = 606.7511 
GAMLSS-RS iteration 55: Global Deviance = 606.7214 
GAMLSS-RS iteration 56: Global Deviance = 606.693 
GAMLSS-RS iteration 57: Global Deviance = 606.6659 
GAMLSS-RS iteration 58: Global Deviance = 606.64 
GAMLSS-RS iteration 59: Global Deviance = 606.6153 
GAMLSS-RS iteration 60: Global Deviance = 606.5917 
GAMLSS-RS iteration 61: Global Deviance = 606.5622 
GAMLSS-RS iteration 62: Global Deviance = 606.5334 
GAMLSS-RS iteration 63: Global Deviance = 606.506 
GAMLSS-RS iteration 64: Global Deviance = 606.4802 
GAMLSS-RS iteration 65: Global Deviance = 606.4559 
GAMLSS-RS iteration 66: Global Deviance = 606.4329 
GAMLSS-RS iteration 67: Global Deviance = 606.4112 
GAMLSS-RS iteration 68: Global Deviance = 606.3907 
GAMLSS-RS iteration 69: Global Deviance = 606.3714 
GAMLSS-RS iteration 70: Global Deviance = 606.3532 
GAMLSS-RS iteration 71: Global Deviance = 606.336 
GAMLSS-RS iteration 72: Global Deviance = 606.3198 
GAMLSS-RS iteration 73: Global Deviance = 606.3045 
GAMLSS-RS iteration 74: Global Deviance = 606.29 
GAMLSS-RS iteration 75: Global Deviance = 606.2764 
GAMLSS-RS iteration 76: Global Deviance = 606.2636 
GAMLSS-RS iteration 77: Global Deviance = 606.2515 
GAMLSS-RS iteration 78: Global Deviance = 606.2405 
GAMLSS-RS iteration 79: Global Deviance = 606.2369 
GAMLSS-RS iteration 80: Global Deviance = 606.2332 
GAMLSS-RS iteration 81: Global Deviance = 606.2296 
GAMLSS-RS iteration 82: Global Deviance = 606.226 
GAMLSS-RS iteration 83: Global Deviance = 606.2225 
GAMLSS-RS iteration 84: Global Deviance = 606.2191 
GAMLSS-RS iteration 85: Global Deviance = 606.2158 
GAMLSS-RS iteration 86: Global Deviance = 606.2125 
GAMLSS-RS iteration 87: Global Deviance = 606.2093 
GAMLSS-RS iteration 88: Global Deviance = 606.2062 
GAMLSS-RS iteration 89: Global Deviance = 606.2031 
GAMLSS-RS iteration 90: Global Deviance = 606.2001 
GAMLSS-RS iteration 91: Global Deviance = 606.1972 
GAMLSS-RS iteration 92: Global Deviance = 606.1943 
GAMLSS-RS iteration 93: Global Deviance = 606.1915 
GAMLSS-RS iteration 94: Global Deviance = 606.1888 
GAMLSS-RS iteration 95: Global Deviance = 606.1861 
GAMLSS-RS iteration 96: Global Deviance = 606.1799 
GAMLSS-RS iteration 97: Global Deviance = 606.1753 
GAMLSS-RS iteration 98: Global Deviance = 606.1707 
GAMLSS-RS iteration 99: Global Deviance = 606.1664 
GAMLSS-RS iteration 100: Global Deviance = 606.1623 
GAMLSS-RS iteration 101: Global Deviance = 606.1582 
GAMLSS-RS iteration 102: Global Deviance = 606.1544 
GAMLSS-RS iteration 103: Global Deviance = 606.1507 
GAMLSS-RS iteration 104: Global Deviance = 606.1471 
GAMLSS-RS iteration 105: Global Deviance = 606.1437 
GAMLSS-RS iteration 106: Global Deviance = 606.1404 
GAMLSS-RS iteration 107: Global Deviance = 606.1372 
GAMLSS-RS iteration 108: Global Deviance = 606.1342 
GAMLSS-RS iteration 109: Global Deviance = 606.1312 
GAMLSS-RS iteration 110: Global Deviance = 606.1284 
GAMLSS-RS iteration 111: Global Deviance = 606.1257 
GAMLSS-RS iteration 112: Global Deviance = 606.1231 
GAMLSS-RS iteration 113: Global Deviance = 606.1205 
GAMLSS-RS iteration 114: Global Deviance = 606.1181 
GAMLSS-RS iteration 115: Global Deviance = 606.1157 
GAMLSS-RS iteration 116: Global Deviance = 606.1135 
GAMLSS-RS iteration 117: Global Deviance = 606.1113 
GAMLSS-RS iteration 118: Global Deviance = 606.1092 
GAMLSS-RS iteration 119: Global Deviance = 606.1072 
GAMLSS-RS iteration 120: Global Deviance = 606.1052 
GAMLSS-RS iteration 121: Global Deviance = 606.1033 
GAMLSS-RS iteration 122: Global Deviance = 606.1015 
GAMLSS-RS iteration 123: Global Deviance = 606.0998 
GAMLSS-RS iteration 124: Global Deviance = 606.0981 
GAMLSS-RS iteration 125: Global Deviance = 606.0964 
GAMLSS-RS iteration 126: Global Deviance = 606.0949 
GAMLSS-RS iteration 127: Global Deviance = 606.0933 
GAMLSS-RS iteration 128: Global Deviance = 606.0919 
GAMLSS-RS iteration 129: Global Deviance = 606.0905 
GAMLSS-RS iteration 130: Global Deviance = 606.0891 
GAMLSS-RS iteration 131: Global Deviance = 606.088 
GAMLSS-RS iteration 132: Global Deviance = 606.0862 
GAMLSS-RS iteration 133: Global Deviance = 606.0837 
GAMLSS-RS iteration 134: Global Deviance = 606.0827 
[1] 2.84052

gamlss.dist documentation built on July 13, 2020, 5:08 p.m.