Learn R Programming

CopulaRegression (version 0.1-5)

ztp.glm: GLM for a zero truncated Poisson variable

Description

Zero truncated generalized linear model.

Usage

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.

Value

  • coefficientsestimated regression coefficients
  • sdestimated standard error, if sd.error=TRUE

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(\lambda_{i})$$ with $\ln(\lambda_{i})=\ln(e_i)+{s_i}^\top \beta$. Here $e_i$ denotes the exposure time.

See Also

mle_marginal, mle_joint

Examples

Run this code
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)

Run the code above in your browser using DataLab