These functions estimate the parameters of the (zero-inflated) negative binomial distribution by applying the maximum likelihood method to the labelled observations in class 0.
estim.nbinom(y, z, gamma) estim.zinb(y, z, gamma)
y | observations:
numeric vector of length |
---|---|
z | class labels:
integer vector of length |
gamma | offset:
numeric vector of length |
These functions return a list of numerics.
# data simulation n <- 100 y <- stats::rnbinom(n=n,mu=5,size=1/0.05) y[sample(1:n,size=0.2*n)] <- 0 z <- rep(0,times=n) gamma <- rep(1,times=n) # parameter estimation estim.nbinom(y,z,gamma)#> $mu #> [1] 4.11 #> #> $phi #> [1] 0.5959951 #>estim.zinb(y,z,gamma)#> $mu #> [1] 5.014082 #> #> $phi #> [1] 0.1517328 #> #> $pi #> [1] 0.1803093 #>