predict.copreg: Prediction of the copula regression model

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

View source: R/predict.copreg.R

Description

This function predicts the outcome of a copula regression model for new data.

Usage

1
2
## S3 method for class 'copreg'
predict(object,Rtest,Stest,exposure=rep(1,nrow(Stest)),independence=FALSE,...)

Arguments

object

copreg object returned from copreg

Rtest

design matrix of the new data for the Gamma model

Stest

design matrix of the new data for the zero truncated Poisson model

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.

independence

logical. Do we assume that the two variables are independent. Default is FALSE.

...

other parameters

Details

For new data that is defined by the design matrices Rtest and Stest, and the exposure time exposure, the function predicts the values x of the Gamma variable, the values y of the (zero truncated) Poisson variable, and the policy loss. If independence=TRUE, the function predicts the policy loss under the assumption that X and Y are independent.

Value

x.pred

predicted value of x

y.pred

predicted value of y

l.pred

predicted value of the policy loss

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

copreg, simulate_regression_data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)
 
# fitted values

## Not run: out<-predict(my.model,R,S)

Example output

Loading required package: MASS
Loading required package: VineCopula
Warning messages:
1: In log(density_joint(x, y, mu, delta, lambda, theta, family, zt)) :
  NaNs produced
2: In log(density_joint(x, y, mu, delta, lambda, theta, family, zt)) :
  NaNs produced
3: In log(density_joint(x, y, mu, delta, lambda, theta, family, zt)) :
  NaNs produced

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