simulate_regression_data: Simulate regression data

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

View source: R/simulate_regression_data.R

Description

Simulate regression data

Usage

1
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.

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(μ_i,δ)

with \ln(μ_i)={ r_i} ^\top α for the continuous variable. For the count variable, if zt=TRUE, we use a zero-truncated Poisson model,

Y_i\sim ZTP(λ_{i})

with \ln(λ_{i})=\ln(e_i)+{s_i}^\top β. 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 θ.

Value

n samples from the joint regression model

Author(s)

Nicole Kraemer

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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]

Example output

Loading required package: MASS
Loading required package: VineCopula

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