Learn R Programming

CopulaRegression (version 0.1-5)

copreg: Joint, copula-based regression model

Description

This functions fits a joint, bivariate regression model for a Gamma generalized linear model and a (zero-truncated) Poisson generalized linear model.

Usage

copreg(x,y,R,S=R,family=1,exposure,sd.error=FALSE,joint=TRUE,zt=TRUE)

Arguments

x
n observations of the Gamma variable
y
n observations of the (zero-truncated) Poisson variable
R
n x p design matrix for the Gamma model
S
n x q design matrix for the (zero-truncated) Poisson model
family
an integer defining the bivariate copula family: 1 = Gauss, 3 = Clayton, 4=Gumbel, 5=Frank
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.
joint
logical. Should the two generalized liner models be estimated jointly? Default is TRUE.
zt
logical. If zt=TRUE, we fit a marginal zero-truncated Poisson regression model. Otherwise, we fit a marginal Poisson regression model. Default is TRUE.

Value

  • This is an object of class copreg
  • alphaestimated coefficients for X, including the intercept
  • betaestimated coefficients for Y, including the intercept
  • sd.alphaestimated standard deviation of alpha (if sd.error=TRUE)
  • sd.betaestimated standard deviation of beta (if sd.error=TRUE)
  • deltaestimated dispersion parameter
  • thetaestimated copula parameter if joint=TRUE, 0 otherwise (in combination with family=1, 0 corresponds to the independence assumption)
  • familycopula family as provided in the function call if joint=TRUE, 1 otherwise (in combination with theta=0, 1 corresponds to the independence assumption)
  • llloglikelihood of the estimated model, evaluated at each observation
  • loglikoverall loglikelihood, i.e. sum of ll
  • alpha0estimated coefficients for X under independence, including the intercept
  • beta0estimated coefficients for Y under independence, including the intercept
  • sd.alpha0estimated standard deviation (if sd.error=TRUE)
  • sd.beta0estimated standard deviation (if sd.error=TRUE)
  • delta0estimated dispersion parameter under independence
  • theta00 (in combination with family0=1, 0 corresponds to the independence assumption)
  • family01 (in combination with theta0=0, 1 corresponds to the independence assumption)
  • ll0loglikelihood of the estimated model under independence, evaluated at each observation
  • loglik0overall loglikelihood, under independence, i.e. sum of ll0
  • ztThe value of zt
  • tau_IFMestimated Kendall's $\tau$ based on the marginal models, using inference from margins
  • theta_ifmestimated copula parameter, estimated via inference from margins
  • nparthe number of estimated parameters in the model

Details

We consider positive continuous random variables $X_i$ and positive or non-negative count variables $Y_i$. We model $X_i$ in terms of a covariate vector $r_i$ and $Y_i$ in terms of a covariate vector $s_i$. The marginal regression models are specified via $$X_i\sim Gamma(\mu_i,\delta)$$ with $\ln(\mu_i)={ r_i} ^\top \alpha$ for the continuous variable. For the count variable, if zt=TRUE, we use a zero-truncated Poisson model, $$Y_i\sim ZTP(\lambda_{i})$$ with $\ln(\lambda_{i})=\ln(e_i)+{s_i}^\top \beta$. Otherwise, we use a Poisson model. $e_i$ denotes the exposure time. Further, mwe assume that the dependency of $X_i$ and $Y_i$ is modeled in terms of a copula family with parameter $\theta$.

References

N. Kraemer, E. Brechmann, D. Silvestrini, C. Czado (2013): Total loss estimation using copula-based regression models. Insurance: Mathematics and Economics 53 (3), 829 - 839.

See Also

mle_marginal,mle_joint, simulate_regression_data

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]
 
 # joint model without standard errors
 my.model<-copreg(x,y,R,S,family,exposure,FALSE,TRUE)

Run the code above in your browser using DataLab