AM_find_gamma_NegBin {AntMAN} | R Documentation |
Given that the prior on M is a Negative Binomial, find the
hyperparameter of the weights
prior to match
, where
is user-specified
Description
Once the prior on the number of mixture components M is assumed to be a Negative Binomial with
parameter r>0
and 0<p<1
, with mean is 1+ r*p/(1-p), this function adopts a bisection method
to find the value of gamma
such that the induced distribution on the number of clusters is centered around a
user specifed value , i.e. the function uses a bisection method to solve for
(Argiento and Iorio 2019).
The user can provide a lower
and an upper
bound for the possible values of
. The default values
are
and
. A defaault value for the tolerance is
. Moreover, after a
maximum number of iteration (default is 31), the function stops warning that convergence has not bee reached.
Usage
AM_find_gamma_NegBin(
n,
r,
p,
Kstar = 6,
gam_min = 0.001,
gam_max = 10000,
tolerance = 0.1
)
Arguments
n |
The sample size. |
r |
The dispersion parameter |
p |
The probability of failure parameter |
Kstar |
The mean number of clusters the user wants to specify. |
gam_min |
The lower bound of the interval in which |
gam_max |
The upper bound of the interval in which |
tolerance |
Level of tolerance of the method. |
Value
A value of gamma
such that
Examples
n <- 82
r <- 1
p <- 0.8571
gam_nb= AM_find_gamma_NegBin(n,r,p,Kstar=6, gam_min=0.001,gam_max=10000, tolerance=0.1)
prior_K_nb= AM_prior_K_NegBin(n,gam_nb, r, p)
prior_K_nb%*%1:n