Package 'fbglm'

Title: Fractional Binomial Regression Model
Description: Fit a fractional binomial regression model and extended zero-inflated negative binomial regression model to count data with excess zeros using maximum likelihood estimation. Compare zero-inflated regression models via Vuong closeness test.
Authors: Jeonghwa Lee [aut, cre, cph]
Maintainer: Jeonghwa Lee <[email protected]>
License: MIT + file LICENSE
Version: 1.5.0
Built: 2024-10-26 06:08:41 UTC
Source: https://github.com/cran/fbglm

Help Index


Fractional binomial regression model

Description

Fit a fractional binomial regression model via maximum likelihood.

Usage

fbglm(y, x)

Arguments

y

A response vector.

x

A data frame with covariates.

Details

Fractional binomial distribution can be considered as zero-inflated, over-dispersed binomial model, and it has three parameters (p,H,c)(p,H,c) in addition to the number of trials nn. We use a specific parametrization such that p,H,c(0,1)p,H,c \in (0,1), and regress these parameters with logit link on the covariates, while letting nn as the maximum of the response y.

Value

A list of log-likelihood, estimated coefficients, and maximum likelihood estimation results.

References

Breece, C. and Lee, J. (2024) Fractional binomial regression model for count data with excess zeros.https://arxiv.org/html/2410.08488v1

Examples

library(agridat)
library(bbmle)
sample<-sample(270, 30)
my_y<-ridout.appleshoots$roots[sample]
my_x<-data.frame(pho=ridout.appleshoots$pho[sample])
fbglm(y=my_y, x=my_x  )

Vuong closeness test for zero-inflated models

Description

Compare zero-inflated regression models via Vuong closeness test.

Usage

test(y, x, model1, model2)

Arguments

y

A response vector.

x

A data frame with covariates.

model1

A character; one of "ZINB", "ZIP", "ZINB2", and "fbglm".

model2

A character; one of "ZINB", "ZIP", "ZINB2", and "fbglm".

Details

Perform one-tailed Vuong closeness test with the null hypothesis that the two models are equally close to the true data generating process, against the alternative that one model 1 is closer than model 2. Choose model1 and model2 from zero-inflated negative binomial regression ("ZINB"), extended zero-inflated negative binomial regression ("ZINB2"), zero-inflated Poisson regression ("ZIP"), and fractional binomial regression ("fbglm"). For "ZINB2" and "fbglm", see "fbglm::ZINB2" and "fbglm::fbglm" for details. In "ZIP" and "ZINB", all the covariates are used as regressors in both the count and zero-inflation component.

Value

One-sided p-value will be returned.

References

Vuong, Quang H. (1989). Likelihood Ratio Tests for Model Selection and non-nested Hypotheses. Econometrica. 57 (2): 307–333.

Examples

library(agridat)
library(bbmle)
sample<-sample(270, 30)
my_y<-ridout.appleshoots$roots[sample]
my_x<-data.frame(pho=ridout.appleshoots$pho[sample])
test( y=my_y, x=my_x , "fbglm", "ZINB2" )

Extended zero-inflated negative binomial regression

Description

Fit extended zero-inflated negative binomial regression model via maximum likelihood.

Usage

ZINB2(y, x)

Arguments

y

A response vector.

x

A data frame with covariates.

Details

The model regresses all the parameters– zero-inflation component π\pi (with logit link), and both the mean μ\mu and dispersion parameter θ\theta (with log link)– on covariates.

Value

A list of log-likelihood, estimated coefficients, and maximum likelihood estimation results.

References

Breece, C. and Lee, J. (2024) Fractional binomial regression model for count data with excess zeros.https://arxiv.org/html/2410.08488v1

Examples

library(agridat)
library(bbmle)
sample<-sample(270, 30)
my_y<-ridout.appleshoots$roots[sample]
my_x<-data.frame(pho=ridout.appleshoots$pho[sample])
ZINB2(y=my_y, x=my_x  )