Learn R Programming

CopulaRegression (version 0.1-5)

simulate_regression_data: Simulate regression data

Description

Simulate regression data

Usage

simulate_regression_data(n,alpha,beta,R,S,delta,tau,family,zt,exposure)

Arguments

n
number of samples
alpha
coefficients for the Gamma regression
beta
coefficients for the (zero-truncated) Poisson regression
R
n x p design matrix for the Gamma model
S
n x q design matrix for the (zero-truncated) Poisson model
delta
dispersion parameter of the Gamma distribution
tau
Kendalls tau
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.
zt
logical. If zt=TRUE, we use a zero-truncated Poisson variable. Otherwise, we use a Poisson variable. Default is TRUE.

Value

  • n samples from the joint regression 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,we 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

simulate_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]

Run the code above in your browser using DataLab