Fits the Bell regression model to overdispersed count data.
Arguments
- formula
- an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. 
- data
- an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which ypbp is called. 
- approach
- approach to be used to fit the model (mle: maximum likelihood; bayes: Bayesian approach). 
- hessian
- hessian logical; If TRUE (default), the hessian matrix is returned when approach="mle". 
- link1
- assumed link function for degenerate distribution (logit, probit, cloglog, cauchy); default is logit. 
- link2
- assumed link function for count distribution (log, sqrt or identiy); default is log. 
- hyperpars
- a list containing the hyperparameters associated with the prior distribution of the regression coefficients; if not specified then default choice is hyperpars = c(mu_psi = 0, sigma_psi = 10, mu_beta = 0, sigma_beta = 10). 
- ...
- further arguments passed to either - rstan::optimizingor- rstan::sampling.
Examples
# \donttest{
# ML approach:
data(cells)
mle <- zibellreg(cells ~ smoker+gender|smoker+gender, data = cells, approach = "mle")
summary(mle)
#> Call:
#> zibellreg(formula = cells ~ smoker + gender | smoker + gender, 
#>     data = cells, approach = "mle")
#> 
#> Zero-inflated regression coefficients:
#>             Estimate   StdErr z.value  p.value   
#> (Intercept) -1.95199  0.84467 -2.3110 0.020835 * 
#> smoker       2.17630  0.82289  2.6447 0.008176 **
#> gender      -0.49576  0.42055 -1.1788 0.238465   
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> 
#> Count regression coefficients:
#>              Estimate    StdErr z.value   p.value    
#> (Intercept)  0.716555  0.179842  3.9843 6.767e-05 ***
#> smoker      -0.611607  0.183394 -3.3349 0.0008532 ***
#> gender       0.036323  0.177474  0.2047 0.8378313    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> --- 
#> logLik = -610.3234   AIC = 1232.647 
# Bayesian approach:
bayes <- zibellreg(cells ~ 1|smoker+gender, data = cells, approach = "bayes", refresh = FALSE)
#> Warning: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
#> Running the chains for more iterations may help. See
#> https://mc-stan.org/misc/warnings.html#tail-ess
summary(bayes)
#> Call:
#> zibellreg(formula = cells ~ 1 | smoker + gender, data = cells, 
#>     approach = "bayes", refresh = FALSE)
#> 
#> Zero-inflated regression coefficients:
#>               mean se_mean   sd   2.5%    25%    50%    75% 97.5%  n_eff  Rhat
#> (Intercept) -1.309   0.145 1.25 -2.105 -1.369 -1.144 -0.947 -0.62 74.785 1.057
#> 
#> Count regression coefficients:
#>               mean se_mean    sd   2.5%    25%    50%    75%  97.5%    n_eff
#> (Intercept)  0.709   0.004 0.148  0.417  0.610  0.712  0.810  0.989 1543.243
#> smoker      -1.077   0.003 0.149 -1.365 -1.180 -1.077 -0.977 -0.777 2492.686
#> gender       0.179   0.003 0.139 -0.093  0.083  0.177  0.273  0.460 2996.759
#>              Rhat
#> (Intercept) 1.002
#> smoker      1.001
#> gender      1.000
#> --- 
#> Inference for Stan model: zibellreg.
#> 4 chains, each with iter=2000; warmup=1000; thin=1; 
#> post-warmup draws per chain=1000, total post-warmup draws=4000.
#> 
# }