Learn R Programming

gamCopula (version 0.0-7)

gamVineStructureSelect: Structure selection and estimation of a GAM-Vine model.

Description

This function select the structure and estimates the parameter(s) of a Generalized Additive model (GAM) Vine model, where GAMs for individual edges are specified either for the copula parameter or Kendall's tau. It solves the maximum penalized likelihood estimation for the copula families supported in this package by reformulating each Newton-Raphson iteration as a generalized ridge regression, which is solved using the mgcv package.

Usage

gamVineStructureSelect(
  udata,
  lin.covs = NULL,
  smooth.covs = NULL,
  simplified = TRUE,
  type = 0,
  familyset = NA,
  rotations = TRUE,
  familycrit = "AIC",
  treecrit = "tau",
  level = 0.05,
  trunclevel = NA,
  tau = TRUE,
  method = "FS",
  tol.rel = 0.001,
  n.iters = 10,
  parallel = FALSE,
  verbose = FALSE,
  select.once = TRUE
)

Arguments

udata

A matrix or data frame containing the data in [0,1]^d.

lin.covs

A matrix or data frame containing the parametric (i.e., linear) covariates (default: lin.covs = NULL).

smooth.covs

A matrix or data frame containing the non-parametric (i.e., smooth) covariates (default: smooth.covs = NULL).

simplified

If TRUE (default), then a simplified vine is fitted (which is possible only if there are exogenous covariates). If FALSE, then a non-simplified vine is fitted.

type

type = 0 (default) for a R-Vine and type = 1 for a C-Vine.

familyset

An integer vector of pair-copula families to select from (the independence copula MUST NOT be specified in this vector unless one wants to fit an independence vine!). Not listed copula families might be included to better handle limit cases. If familyset = NA (default), selection among all possible families is performed. Coding of pair-copula families: 1 Gaussian, 2 Student t, 5 Frank, 301 Double Clayton type I (standard and rotated 90 degrees), 302 Double Clayton type II (standard and rotated 270 degrees), 303 Double Clayton type III (survival and rotated 90 degrees), 304 Double Clayton type IV (survival and rotated 270 degrees), 401 Double Gumbel type I (standard and rotated 90 degrees), 402 Double Gumbel type II (standard and rotated 270 degrees), 403 Double Gumbel type III (survival and rotated 90 degrees), 404 Double Gumbel type IV (survival and rotated 270 degrees).

rotations

If TRUE, all rotations of the families in familyset are included.

familycrit

Character indicating the criterion for bivariate copula selection. Possible choices: familycrit = 'AIC' (default) or 'BIC', as in BiCopSelect from the VineCopula package.

treecrit

Character indicating how pairs are selected in each tree. treecrit = "tau" uses the maximum spanning tree of the Kendall's tau (i.e., the tree of maximal overall dependence), treecrit = "rho" uses the Spearman's rho.

level

Numerical; Passed to gamBiCopSelect, it is the significance level of the test for removing individual predictors (default: level = 0.05) for each conditional pair-copula.

trunclevel

Integer; level of truncation.

tau

TRUE (default) for a calibration function specified for Kendall's tau or FALSE for a calibration function specified for the Copula parameter.

method

'NR' for Newton-Raphson and 'FS' for Fisher-scoring (default).

tol.rel

Relative tolerance for 'FS'/'NR' algorithm.

n.iters

Maximal number of iterations for 'FS'/'NR' algorithm.

parallel

TRUE (default) for parallel selection of copula family at each edge or FALSE for the sequential version. for the Copula parameter.

verbose

TRUE if informations should be printed during the estimation and FALSE (default) for a silent version. from mgcv.

select.once

if TRUE the GAM structure is only selected once, for the family that appears first in familyset.

Value

gamVineSeqFit returns a gamVine-class object.

See Also

gamVineSeqFit,gamVineCopSelect, gamVine-class, gamVineSimulate and gamBiCopSelect.

Examples

Run this code
# NOT RUN {
require(VineCopula)
set.seed(0)


## An example with a 3-dimensional GAM-Vine

# Sample size
n <- 1e3

# Define a R-vine tree structure matrix
d <- 3
Matrix <- c(2, 3, 1, 0, 3, 1, 0, 0, 1)
Matrix <- matrix(Matrix, d, d)
nnames <- paste("x", 1:d, sep = "")

# Copula families for each edge
fam <- c(301, 401, 1)

# Parameters for the first tree (two unconditional copulas)
par <- c(1, 2)

# Pre-allocate the GAM-Vine model list
count <- 1
model <- vector(mode = "list", length = d * (d - 1) / 2)

# The first tree contains only the two unconditional copulas
for (i in 1:(d - 1)) {
  model[[count]] <- list(family = fam[count], par = par[count], par2 = 0)
  count <- count + 1
}

# The second tree contains a unique conditional copula
# In this first example, we take a linear calibration function (10*x-5)

# Set-up a dummy dataset
tmp <- data.frame(u1 = runif(1e2), u2 = runif(1e2), x1 = runif(1e2))

# Set-up an arbitrary linear model for the calibration function
model[[count]] <- gamBiCopFit(tmp, ~x1, fam[count])$res

# Update the coefficients of the model
attr(model[[count]], "model")$coefficients <- c(-5, 10)

# Define gamVine object
GVC <- gamVine(Matrix = Matrix, model = model, names = nnames)
GVC
# }
# NOT RUN {
# Simulate new data
simData <- data.frame(gamVineSimulate(n, GVC))
colnames(simData) <- nnames

# Fit data using sequential estimation assuming true model known
summary(fitGVC <- gamVineSeqFit(simData, GVC))

# Fit data using structure selection and sequential estimation
summary(fitGVC2 <- gamVineStructureSelect(simData, simplified = FALSE))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab