gpoisson: Generalized Poisson regression for count data

Description Usage Arguments Value See Also Examples

Description

Generalized Poisson (GP) regression for count data; 2 versions. GP(theta,vrho) has pmf f(y;theta,vrho)= [theta*(theta+vrho y)^(y-1)]*exp(-theta-vrho*y) / y! .

Usage

1
2
3
4
5
6
7
8
gp1nllk(param,y,xdat)
gp2nllk(param,y,xdat)
gp1pmfcdf(ub,param,x)
gp2pmfcdf(ub,param,x)
gp1cdf(y,param,x)
gp2cdf(y,param,x)
gp1pmf(y,param,x)
gp2pmf(y,param,x)

Arguments

param

parameter of GP model, length is 2+number of covariates; the parameters are: b0=intercept, bvec= vector regression coefficients (length(bvec)=length(x)=ncol(xdat), and xi (for GP1) or theta (for GP2). For GP1, mu(x)= exp(b[0]+bvec^T x), xi=(overdispersion index minus one) and 1-vrho=sqrt(1/(1+xi)) are fixed, and theta(x)=mu(x)*(1-vrh). For GP2, mu(x)= exp(b[0]+bvec^T x), theta=convolution parameter is fixed and 1-vrho(x)=theta/mu(x).

xdat

matrix for gp1nllk and gp2nllk

x

vector for gp1pmfcdf, gp2pmfcdf, gp1cdf, gp2cdf, gp1pmf, gp2pmf

y

vector for gp1nllk and gp2nllk (with length(y)=nrow(xdat)); non-negative integer for the other functions

ub

upper bound integer for which pmf and cdf are computed

Value

negative log-likelihood for gp1nllk and gp2nllk;

matrix with columns (0:ub,pmf,cdf) for gp1pmfcdf and gp2pmfcdf, computed in an efficient way (parameters assumed to be such that most probability is on small counts);

cdf for gp1cdf and gp2cdf;

pmf for gp1pmf and gp2pmf.

See Also

gpois negbinom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
y= c(
 2, 1, 1, 0,35, 9, 0, 1, 4, 0, 0, 1, 4, 0, 0, 8, 7, 2, 0, 7, 0, 0, 3, 4, 0,
 4, 1, 3, 0, 6, 1, 0, 2, 8, 0,12, 0, 4, 2, 1, 3, 0, 9, 0, 0, 0, 2, 0, 8, 1,
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 2, 8, 9, 0, 0, 5, 8, 3, 7, 6,10, 4, 5, 7, 6, 7, 3, 4,10, 4, 8, 8, 3,
 9, 5,10, 9, 5,10,10, 8,10, 5,10, 6, 5, 9, 8,10, 7, 8, 9, 7, 8, 4, 8, 3, 5,
 5, 7,10, 8, 1, 3, 3, 8,10, 3, 5, 5, 7, 5,10, 8, 5, 8, 5, 0, 6, 8, 2, 5, 6,
 7,10, 5, 0, 5, 2, 0, 3,10, 7, 4, 6, 9, 2, 8, 5, 9, 7, 5,10, 8, 8, 7, 7, 7,
10,10, 2, 5, 7, 5, 9, 6, 7, 6, 9, 9, 6, 8,10, 7, 8, 8,10,10, 5,10, 5, 8,10,
 8, 7,10, 9,10, 4, 6, 9, 5, 9, 9, 6, 8, 8, 2, 5, 8, 3, 7, 0, 8, 8,10, 5, 7,
 6, 7,10, 5, 5, 1, 5, 6, 4,10, 5, 5, 5, 7, 2, 8, 5,10,10,10,10, 6, 6, 6, 6,
 7, 8, 8,10,10, 8, 7, 8, 3, 8, 8, 8, 6, 3, 7,10,10, 2, 9, 2)
fit=nlm(ieenllk,p=c(2.5,-.2,5),hessian=TRUE,print.level=1,upmf=gp1pmf,
    xdat=hsat,ydat=y,LB=c(-1,-2,0),UB=c(10,10,10))

YafeiXu/CopulaModel documentation built on May 9, 2019, 11:07 p.m.