Learn R Programming

CopulaRegression (version 0.1-5)

loglik_joint: Loglikelihood of the joint regression model

Description

Loglikelihood of the joint regression model

Usage

loglik_joint(alpha,beta,theta, delta, x, y, R, S, family, exposure, negative,zt)

Arguments

alpha
The regression coefficients for the Gamma regression
beta
The regression coefficients for the (zero-truncated) Poisson regression
theta
The copula parameter
delta
dispersion parameter of the Gamma distribution
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.
negative
boolean, if TRUE the negative of the loglikelihood is returned. Default is TRUE.
zt
logical. If zt=TRUE, we use a zero-truncated Poisson variable. Otherwise, we use a Poisson variable. Default is TRUE.

Value

  • loglikelihood

Details

For a Gamma distributed variable X and a (zero truncated) Possion variable Y, the loglikelihood is given by $$\ell=\sum_{i=1} ^n \left(f_X(x_i) \left(D_u(F_Y(y_i),F_X(x_i)|\theta) - D_u(F_Y(y_i -1),F_X(x_i)|\theta) \right)\right)\,.$$Here $D_u$ is the h-function of a copula famila family with copula 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

density_joint

Examples

Run this code
library(VineCopula)
 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
 theta<-BiCopTau2Par(tau=tau,family=family)
 # 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]
 #compute loglikelihood for the true coefficients
 out<-loglik_joint(alpha,beta,theta,delta,x,y,R,S,family,exposure)

Run the code above in your browser using DataLab