ztp.glm: GLM for a zero truncated Poisson variable

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ztp.glm.R

Description

Zero truncated generalized linear model.

Usage

1
ztp.glm(y, S, exposure = rep(1, length(y)),sd.error=FALSE)

Arguments

y

vector of response values

S

design matrix

exposure

exposure time for the zero-truncated Poisson model, all entries of the vector have to be >0. Default is a constant vector of 1.

sd.error

logical. Should the standard errors of the regression coefficients be returned? Default is FALSE.

Details

We consider positive count variables Y_i. We model Y_i in terms of a covariate vector s_i. The generalized linear model is specified via

Y_i\sim ZTP(λ_{i})

with \ln(λ_{i})=\ln(e_i)+{s_i}^\top β. Here e_i denotes the exposure time.

Value

coefficients

estimated regression coefficients

sd

estimated standard error, if sd.error=TRUE

Author(s)

Nicole Kraemer

See Also

mle_marginal, mle_joint

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n<-200 # number of examples
 R<-S<-cbind(rep(1,n),rnorm(n)) # design matrices with intercept 
 alpha<-beta<-c(1,-1) # regression coefficients
 exposure<-rep(1,n) # constant exposure
 delta<-0.5 # dispersion parameter
 tau<-0.3 # Kendall's tau
 family=3 # Clayton copula
 # simulate data
 my.data<-simulate_regression_data(n,alpha,beta,R,S,delta,tau,family,TRUE,exposure)
 x<-my.data[,1]
 y<-my.data[,2]
# fit marginal ZTP-model with standard errors
my.model<-ztp.glm(y,S,exposure=exposure,TRUE)

Example output

Loading required package: MASS
Loading required package: VineCopula

CopulaRegression documentation built on May 29, 2017, 5:47 p.m.