gamVineStructureSelect {gamCopula} | R Documentation |
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: |
smooth.covs |
A matrix or data frame containing the non-parametric
(i.e., smooth) covariates (default: |
simplified |
If |
type |
|
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 |
rotations |
If |
familycrit |
Character indicating the criterion for bivariate copula
selection. Possible choices: |
treecrit |
Character indicating how pairs are selected in each tree.
|
level |
Numerical; Passed to |
trunclevel |
Integer; level of truncation. |
tau |
|
method |
|
tol.rel |
Relative tolerance for |
n.iters |
Maximal number of iterations for
|
parallel |
|
verbose |
|
select.once |
if |
Value
gamVineSeqFit
returns a gamVine-class
object.
See Also
gamVineSeqFit
,gamVineCopSelect
,
gamVine-class
, gamVineSimulate
and
gamBiCopSelect
.
Examples
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))
## End(Not run)