Description Usage Arguments Details Value Author(s) References Examples
Density and cdf of the univariate marginal distribution.
1 2 3 4 | dmargmodel(y,mu,gam,invgam,margmodel)
pmargmodel(y,mu,gam,invgam,margmodel)
dmargmodel.ord(y,mu,gam,link)
pmargmodel.ord(y,mu,gam,link)
|
y |
Vector of (non-negative integer) quantiles. |
mu |
The parameter μ of the univariate distribution. |
gam |
The parameter(s) γ that are not regression parameters. γ is NULL for Poisson and Bernoulli distribution. |
invgam |
The inverse of parameter γ of negative binomial distribution. |
margmodel |
Indicates the marginal model. Choices are “poisson” for Poisson, “bernoulli” for Bernoulli, and “nb1” , “nb2” for the NB1 and NB2 parametrization of negative binomial in Cameron and Trivedi (1998). See details. |
link |
The link function. Choices are “logit” for the logit link function, and “probit” for the probit link function. |
Negative binomial distribution NB(τ,ξ) allows for overdispersion and its probability mass function (pmf) is given by
f(y;τ,ξ)=\frac{Γ(τ+y)}{Γ(τ)\; y!} \frac{ξ^y}{(1+ξ)^{τ + y}},\quad \begin{matrix} y=0,1,2,…, \\ τ>0,\; ξ>0,\end{matrix}
with mean μ=τ\,ξ=\exp(β^T x) and variance τ\,ξ\,(1+ξ).
Cameron and Trivedi (1998) present the NBk parametrization where τ=μ^{2-k}γ^{-1} and ξ=μ^{k-1}γ, 1≤ k≤ 2. In this function we use the NB1 parametrization (τ=μγ^{-1},\; ξ=γ), and the NB2 parametrization (τ=γ^{-1},\; ξ=μγ); the latter is the same as in Lawless (1987).
margmodel.ord
is a variant of the code for ordinal (probit and logistic) model. In this case, the response Y is assumed to have density
f_1(y;ν,γ)=F(α_{y}+ν)-F(α_{y-1}+ν),
where ν=xβ is a function of x and the p-dimensional regression vector β, and γ=(α_1,…,α_{K-1}) is the $q$-dimensional vector of the univariate cutpoints (q=K-1). Note that F normal leads to the probit model and F logistic leads to the cumulative logit model for ordinal response.
The density and cdf of the univariate distribution.
Aristidis K. Nikoloulopoulos A.Nikoloulopoulos@uea.ac.uk
Harry Joe harry.joe@ubc.ca
Cameron, A. C. and Trivedi, P. K. (1998) Regression Analysis of Count Data. Cambridge: Cambridge University Press.
Lawless, J. F. (1987) Negative binomial and mixed Poisson regression. The Canadian Journal of Statistics, 15, 209–225.
1 2 3 4 5 6 7 8 9 10 | y<-3
gam<-2.5
invgam<-1/2.5
mu<-0.5
margmodel<-"nb2"
dmargmodel(y,mu,gam,invgam,margmodel)
pmargmodel(y,mu,gam,invgam,margmodel)
link="probit"
dmargmodel.ord(y,mu,gam,link)
pmargmodel.ord(y,mu,gam,link)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.