Title: | Goodness-of-Fit Tests for Copulae |
---|---|
Description: | Several Goodness-of-Fit (GoF) tests for Copulae are provided. A new hybrid test, Zhang et al. (2016) <doi:10.1016/j.jeconom.2016.02.017> is implemented which supports all of the individual tests in the package, e.g. Genest et al. (2009) <doi:10.1016/j.insmatheco.2007.10.005>. Estimation methods for the margins are provided and all the tests support parameter estimation and predefined values. The parameters are estimated by pseudo maximum likelihood but if it fails the estimation switches automatically to inversion of Kendall's tau. For reproducibility of results, the functions support the definition of seeds. Also all the tests support automatized parallelization of the bootstrapping tasks. The package provides an interface to perform new GoF tests by submitting the test statistic. |
Authors: | Ostap Okhrin <[email protected]>, Simon Trimborn <[email protected]>, Martin Waltz <[email protected]> |
Maintainer: | Simon Trimborn <[email protected]> |
License: | GPL (>=3) |
Version: | 0.4-2 |
Built: | 2024-10-29 04:16:28 UTC |
Source: | https://github.com/simontrimborn/gofcopula |
A dataset containing the volatility-adjusted log returns of two Banks in the years 2004-2012.
A list with 9 entries containing the Banks log returns divided by years.
Yahoo-Finance.
CopulaTestTable
returns a table which shows the applicable
dimensions and copula for each test.
CopulaTestTable()
CopulaTestTable()
Before performing a gof test with the package on a dataset, it pays out to know the implemented copula and dimensions for each test. This function is dedicated to help finding the applicable tests depending on the copula and dimensions available.
A character matrix which consists of dimensions for the combination of tests and copula.
CopulaTestTable()
CopulaTestTable()
A dataset containing the volatility-adjusted log returns of two Cryptocurrencies in the years 2015-2018.
A list with 4 entries containing the Cryptocurrencies log returns divided by years.
CoinMetrics. https://coinmetrics.io/
gof
computes for a given dataset and based on the choices of
the user different tests for different copulae. If copulae are given, all
the implemented tests for those copulae are calculated. If tests are given,
all the implemented copulae for every test are used. If both copulae and
tests are given, all possible combinations are calculated.
gof( x, priority = "copula", copula = NULL, tests = NULL, customTests = NULL, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", m = 1, delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gof( x, priority = "copula", copula = NULL, tests = NULL, customTests = NULL, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", m = 1, delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
x |
A matrix containing the data with rows being observations and columns being variables. |
priority |
A character string which is either |
copula |
A character vector which indicates the copula to test for.
Possible are |
tests |
A character vector which indicates the tests to use. Possible choices are the individual tests implemented in this package. |
customTests |
A character vector which indicates the customized test to use, if any. The test has to be loaded into the workspace. Currently the function containing the test has to have 2 arguments, the first one for the dataset and the second one for the copula to test for. The arguments have to be named "x" and "copula" respectively. |
param |
The copulae parameters to use for each test, if it shall not be estimated. |
param.est |
Shall be either |
df |
The degrees of freedom, if not meant to be estimated. Only
necessary if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The vector of control parameters to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. One can either specify one flip degree which will be applied on all copulae or choose an individual flip for each copula in which case the input has to be a vector. |
M |
The amount of bootstrap rounds to be performed by each test. Default is 1000. |
MJ |
Just for the test gofKernel. Size of bootstrapping sample. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
m |
Length of blocks. Only necessary if the test |
delta.J |
Scaling parameter for the matrix of smoothing parameters.
Only necessary if the test |
nodes.Integration |
Number of knots of the bivariate Gauss-Legendre
quadrature. Only necessary if the test |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
If a character vector is given for the argument copula
and nothing
for tests
, then all tests are performed for which the given copulae
are implemented. If tests
contains a character vector of tests and
copula = NULL
, then this tests will be performed for all implemented
copulae. If character vectors are given for copula
and tests
,
then the tests are performed with the given copulae. If tests = NULL
and copula = NULL
, then the argument priority
catches in and
defines the procedure.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
Note that this function does not display warning()
messages. Due to
the large amount of tests run at once, the messages are not tracable to the
situation when they appeared. Hence they are omitted for this function.
A list containing several objects of class
gofCOP with the
following components for each copulae
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of the estimated margin distributions.
Only applicable if the margins were not specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
data(IndexReturns2D) gof(IndexReturns2D, priority = "tests", copula = "normal", tests = c("gofRosenblattSnB", "gofRosenblattSnC"), M = 5)
data(IndexReturns2D) gof(IndexReturns2D, priority = "tests", copula = "normal", tests = c("gofRosenblattSnB", "gofRosenblattSnC"), M = 5)
gofArchmChisq
contains the Chisq gof test with a Rosenblatt
transformation for archimedean copulae, described in Hering and Hofert (2015).
The test follows the RosenblattChisq test as described in Genest (2009)
and Hofert (2014), and compares the empirical copula against a parametric
estimate of the copula derived under the null hypothesis. The margins can be
estimated by a bunch of distributions and the time which is necessary for
the estimation can be given. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation. The gof statistics are computed with the
function gofTstat
from the package copula.
It is possible to insert datasets of all dimensions above 1
(except for the "amh"
copula) and the possible copulae are
"clayton"
, "gumbel"
, "frank"
, "joe"
and
"amh"
. The parameter estimation is performed with pseudo maximum
likelihood method. In case the estimation fails, inversion of Kendall's tau
is used.
gofArchmChisq( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofArchmChisq( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This Anderson-Darling test statistic (supposedly) computes
U[0,1]-distributed (under ) random variates via the
distribution function of chi-square distribution with d degrees of freedom,
see Hofert et al. (2014). The
hypothesis is
with as the true class
of copulae under
.
This test is based on the Rosenblatt transformation for archimedean copula
which uses the mapping . Following
Hering and Hofert (2015) the mapping provides
pseudo observations
, given by
Let be an Archimedean copula with
monotone generator
and continuous Kendall distribution function
. Then,
and
.
The Anderson-Darling test statistic of the variates
is computed (via ADGofTest::ad.test
), where ,
denotes the quantile function of the standard normal distribution function,
denotes the distribution function of the
chi-square distribution with
d
degrees of freedom, and
is the
th component in the
th row of
.
The test statistic is then given by
The approximate p-value is computed by the formula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
Christian Hering, Marius Hofert (2015) Goodness-of-fit tests for
Archimedean copulas in high dimensions. In: Glau K., Scherer M.,
Zagst R. (eds) Innovations in Quantitative Risk Management,
Springer Proceedings in Mathematics & Statistics, Volume 99,
Springer, Cham, 357-373.
doi:10.1007/978-3-319-09114-3_21
data(IndexReturns2D) gofArchmChisq("clayton", IndexReturns2D, M = 10)
data(IndexReturns2D) gofArchmChisq("clayton", IndexReturns2D, M = 10)
gofArchmGamma
contains the Gamma gof test with a Rosenblatt
transformation for archimedean copulae, described in Hering and Hofert (2015).
The test follows the RosenblattChisq test as described in Genest (2009)
and Hofert (2014), and compares the empirical copula against a parametric
estimate of the copula derived under the null hypothesis. The margins can be
estimated by a bunch of distributions and the time which is necessary for
the estimation can be given. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation. The gof statistics are computed with the
function gofTstat
from the package copula.
It is possible to insert datasets of all dimensions above 1
(except for the "amh"
copula) and the possible copulae are
"clayton"
, "gumbel"
, "frank"
, "joe"
and
"amh"
. The parameter estimation is performed with pseudo maximum
likelihood method. In case the estimation fails, inversion of Kendall's tau
is used.
gofArchmGamma( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofArchmGamma( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This Anderson-Darling test statistic (supposedly) computes
U[0,1]-distributed (under ) random variates via the
distribution function of the gamma distribution, see Hofert et al. (2014).
As written in Hofert et al. (2014) computes this Anderson-Darling test
statistic for (supposedly) U[0,1]-distributed (under H_0) random variates
via the distribution function of the gamma distribution. The
hypothesis is
with
as the true class of copulae under
.
This test is based on the Rosenblatt transformation for archimedean copula
which uses the mapping . Following
Hering and Hofert (2015) the mapping provides
pseudo observations
, given by
Let be an Archimedean copula with
monotone generator
and continuous Kendall distribution function
. Then,
and
.
The Anderson-Darling test statistic of the variates
is computed (via ADGofTest::ad.test
), where ,
denotes the distribution function of
the gamma distribution with shape parameter d and shape parameter one (being
equal to an Erlang(d) distribution function).
The test statistic is then given by
The approximate p-value is computed by the formula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
Christian Hering, Marius Hofert (2015) Goodness-of-fit tests for
Archimedean copulas in high dimensions. In: Glau K., Scherer M.,
Zagst R. (eds) Innovations in Quantitative Risk Management,
Springer Proceedings in Mathematics & Statistics, Volume 99,
Springer, Cham, 357-373.
doi:10.1007/978-3-319-09114-3_21
data(IndexReturns2D) gofArchmGamma("clayton", IndexReturns2D, M = 10)
data(IndexReturns2D) gofArchmGamma("clayton", IndexReturns2D, M = 10)
gofArchmSnB
contains the SnB gof test with a Rosenblatt
transformation for archimedean copulae, described in Hering and Hofert (2015).
The test follows the RosenblattChisq test as described in Genest (2009)
and Hofert (2014), and compares the empirical copula against a parametric
estimate of the copula derived under the null hypothesis. The margins can be
estimated by a bunch of distributions and the time which is necessary for
the estimation can be given. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation. The gof statistics are computed with the
function gofTstat
from the package copula.
It is possible to insert datasets of all dimensions above 1
(except for the "amh"
copula) and the possible copulae are
"clayton"
, "gumbel"
, "frank"
, "joe"
and
"amh"
. The parameter estimation is performed with pseudo maximum
likelihood method. In case the estimation fails, inversion of Kendall's tau
is used.
gofArchmSnB( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofArchmSnB( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This test is based on the Rosenblatt transformation for archimedean copula
which uses the mapping . Following
Hering and Hofert (2015) the mapping provides
pseudo observations
, given by
Let be an Archimedean copula with
monotone generator
and continuous Kendall distribution function
. Then,
and
.
The resulting independence copula is given by
.
The test statistic is then defined as
with
.
The approximate p-value is computed by the formula, see copula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
Christian Hering, Marius Hofert (2015) Goodness-of-fit tests for
Archimedean copulas in high dimensions. In: Glau K., Scherer M.,
Zagst R. (eds) Innovations in Quantitative Risk Management,
Springer Proceedings in Mathematics & Statistics, Volume 99,
Springer, Cham, 357-373.
doi:10.1007/978-3-319-09114-3_21
data(IndexReturns2D) gofArchmSnB("clayton", IndexReturns2D, M = 10)
data(IndexReturns2D) gofArchmSnB("clayton", IndexReturns2D, M = 10)
gofArchmSnC
contains the SnC gof test with a Rosenblatt
transformation for archimedean copulae, described in Hering and Hofert (2015).
The test follows the RosenblattChisq test as described in Genest (2009)
and Hofert (2014), and compares the empirical copula against a parametric
estimate of the copula derived under the null hypothesis. The margins can be
estimated by a bunch of distributions and the time which is necessary for
the estimation can be given. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation. The gof statistics are computed with the
function gofTstat
from the package copula.
It is possible to insert datasets of all dimensions above 1
(except for the "amh"
copula) and the possible copulae are
"clayton"
, "gumbel"
, "frank"
, "joe"
and
"amh"
. The parameter estimation is performed with pseudo maximum
likelihood method. In case the estimation fails, inversion of Kendall's tau
is used.
gofArchmSnC( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofArchmSnC( copula = c("clayton", "gumbel", "frank", "joe", "amh"), x, param = 0.5, param.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This test is based on the Rosenblatt transformation for archimedean copula
which uses the mapping . Following
Hering and Hofert (2015) the mapping provides
pseudo observations
, given by
Let be an Archimedean copula with
monotone generator
and continuous Kendall distribution function
. Then,
and
.
The resulting independence copula is given by
.
The test statistic is then defined as
with
.
The approximate p-value is computed by the formula, see copula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
Christian Hering, Marius Hofert (2015) Goodness-of-fit tests for
Archimedean copulas in high dimensions. In: Glau K., Scherer M.,
Zagst R. (eds) Innovations in Quantitative Risk Management,
Springer Proceedings in Mathematics & Statistics, Volume 99,
Springer, Cham, 357-373.
doi:10.1007/978-3-319-09114-3_21
data(IndexReturns2D) gofArchmSnC("clayton", IndexReturns2D, M = 10)
data(IndexReturns2D) gofArchmSnC("clayton", IndexReturns2D, M = 10)
The computation of a gof test can take very long, especially when the number
of bootstrap rounds is high. The function gofCheckTime
computes the time which the estimation most likely takes.
gofCheckTime( copula, x, tests = NULL, customTests = NULL, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", print.res = TRUE, m = 1, delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofCheckTime( copula, x, tests = NULL, customTests = NULL, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", print.res = TRUE, m = 1, delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
A character vector which indicates the copula to test for.
Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
tests |
A character vector which indicates the test to use. |
customTests |
A character vector which indicates the customized test to use, if any. |
param |
The copulae parameters to use for each test, if it shall not be estimated. |
param.est |
Shall be either |
df |
The degrees of freedom, if not meant to be estimated. Only
necessary if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
The number of bootstrapping rounds which shall be later taken in the estimation. |
MJ |
Just for the test gofKernel. Size of bootstrapping sample. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
print.res |
Logical which defines if the resulting time shall be printed or given as value. Default is TRUE. |
m |
Length of blocks. Only necessary if the test |
delta.J |
Scaling parameter for the matrix of smoothing parameters.
Only necessary if the test |
nodes.Integration |
Number of knots of the bivariate Gauss-Legendre
quadrature. Only necessary if the test |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. |
The function estimates the time which the entire gof test will take.
## Not run: data(IndexReturns2D) gofCheckTime("normal", IndexReturns2D, "gofKendallKS", M = 10000) ## End(Not run)
## Not run: data(IndexReturns2D) gofCheckTime("normal", IndexReturns2D, "gofKendallKS", M = 10000) ## End(Not run)
gofco
is an interface with the copula
package. It reads
out the information from a copula class object and hands them over to a
specified gof test or set of tests.
gofco( copulaobject, x, tests = c("gofPIOSRn", "gofKernel"), customTests = NULL, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", m = 1, delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofco( copulaobject, x, tests = c("gofPIOSRn", "gofKernel"), customTests = NULL, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", m = 1, delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copulaobject |
An object with of class |
x |
A matrix containing the data with rows being observations and columns being variables. |
tests |
A character vector which indicates the tests to use. Possible choices are the individual tests implemented in this package. |
customTests |
A character vector which indicates the customized test to use, if any. The test has to be loaded into the workspace. Currently the function containing the test has to have 2 arguments, the first one for the dataset and the second one for the copula to test for. The arguments have to be named "x" and "copula" respectively. |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping samples in the single tests. |
MJ |
Size of bootstrapping sample. Only necessary if the test
|
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
m |
Length of blocks. Only necessary if the test |
delta.J |
Scaling parameter for the matrix of smoothing parameters.
Only necessary if the test |
nodes.Integration |
Number of knots of the bivariate Gauss-Legendre
quadrature. Only necessary if the test |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. |
The function reads out the arguments in the copula class object. If the dependence parameter is not specified in the object, it is estimated. In case that the object describes a "t"-copula, then the same holds for the degrees of freedom. The dimension is not extracted from the object. It is obtained from the inserted dataset.
When more than one test shall be performed, the hybrid test is computed too.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Yan, Jun. Enjoy the joy of copulas: with a package copula. Journal of Statistical Software 21.4 (2007): 1-21.
data(IndexReturns2D) copObject = normalCopula(param = 0.5) gofco(copObject, x = IndexReturns2D, tests = c("gofPIOSRn", "gofKernel"), M = 20)
data(IndexReturns2D) copObject = normalCopula(param = 0.5) gofco(copObject, x = IndexReturns2D, tests = c("gofPIOSRn", "gofKernel"), M = 20)
gofCopula4Test
returns for a given test the applicable
implemented copula.
gofCopula4Test(test)
gofCopula4Test(test)
test |
The test to search for copula. |
In case that the decision for a certain gof test was already done, it is interesting to know which copula can be used with this test.
A character vector which consists of the names of the copula.
gofCopula4Test("gofRosenblattSnB") gofCopula4Test("gofPIOSTn")
gofCopula4Test("gofRosenblattSnB") gofCopula4Test("gofPIOSTn")
gofCustomTest
allows to include own Goodness-of-Fit tests and
perform the test with the package. The margins can be estimated by a bunch
of distributions and the time which is necessary for the estimation can be
given. The approximate p-values are computed with a parametric bootstrap,
which computation can be accelerated by enabling in-build parallel
computation. It is possible to insert datasets of all dimensions above 1 and
the possible copulae are "normal"
, "t"
, "clayton"
,
"gumbel"
, "frank"
, "joe"
, "amh"
,
"galambos"
, "huslerReiss"
, "tawn"
, "tev"
,
"fgm"
and "plackett"
. The parameter estimation is performed
with pseudo maximum likelihood method. In case the estimation fails,
inversion of Kendall's tau is used.
gofCustomTest( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, customTest = NULL, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofCustomTest( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, customTest = NULL, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
customTest |
A character string with the name of the customized test. The test has to be loaded into the workspace. Currently the function containing the test has to have 2 arguments, the first one for the dataset and the second one for the copula to test for. The arguments have to be named "x" and "copula" respectively. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
The approximate p-value is computed by the formula, see copula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
# For illustration we load here the test statistic of the gofSn test Testfunc = function(x, copula) { C.theo = pCopula(x, copula = copula) C.n = F.n(x, X = x) CnK = sum((C.n - C.theo)^2) return(CnK) } data(IndexReturns2D) gofCustomTest(copula = "normal", x = IndexReturns2D, customTest = "Testfunc", M=10)
# For illustration we load here the test statistic of the gofSn test Testfunc = function(x, copula) { C.theo = pCopula(x, copula = copula) C.n = F.n(x, X = x) CnK = sum((C.n - C.theo)^2) return(CnK) } data(IndexReturns2D) gofCustomTest(copula = "normal", x = IndexReturns2D, customTest = "Testfunc", M=10)
gofCvM
performs the "CvM"
gof test, described in Genest
et al. (2009), for copulae and compares the empirical copula against a
parametric estimate of the copula derived under the null hypothesis. The
margins can be estimated by a bunch of distributions and the time which is
necessary for the estimation can be given. The approximate p-values are
computed with a parametric bootstrap, which computation can be accelerated
by enabling in-build parallel computation. The gof statistics are computed
with the function gofTstat
from the package copula. It is
possible to insert datasets of all dimensions above 1 and the possible
copulae are "normal"
, "t"
, "clayton"
, "gumbel"
,
"frank"
, "joe"
, "amh"
, "galambos"
,
"huslerReiss"
, "tawn"
, "tev"
, "fgm"
and
"plackett"
. The parameter estimation is performed with pseudo
maximum likelihood method. In case the estimation fails, inversion of
Kendall's tau is used.
gofCvM( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofCvM( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
With the pseudo observations for
,
and
is the empirical copula given by
It shall be
tested the
hypothesis:
with as the true class of copulae under
. The test statistic
is then defined as
with the estimation of
under the
.
The approximate p-value is computed by the formula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Rosenblatt, M. (1952). Remarks on a Multivariate Transformation.
The Annals of Mathematical Statistics 23, 3, 470-472.
Hering,
C. and Hofert, M. (2014). Goodness-of-fit tests for Archimedean copulas in
high dimensions. Innovations in Quantitative Risk Management.
Marius Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
data(IndexReturns2D) gofCvM("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofCvM("normal", IndexReturns2D, M = 10)
gofGetHybrid
computes based on previous test results from this
package and on p-values from your own goodness-of-fit tests the hybrid test
p-values for the specified testing size.
gofGetHybrid(result, p_values = NULL, nsets = NULL)
gofGetHybrid(result, p_values = NULL, nsets = NULL)
result |
An object of |
p_values |
A vector containing different p-values from your own goodness-of-fit tests. If the elements are unnamed, the test results in the output will be labeled with Test_A, Test_B etc. |
nsets |
The desired number of tests to be included in each hybrid test.
It should be an integer larger than 1 and smaller or equal than the number
of tests given in |
In most of scenarios for goodness-of-fit tests, including the one for copula models (e.g. Genest et al. (2009)) there exists no single dominant optimal test. Zhang et al. (2015) proposed a hybrid test which performed in their simulation study more desirably compared to the applied single tests.
The p-value is a combination of the single tests in the following way:
where is
the number of tests and
the p-value of the test
. It is ensured that the hybrid test is consistent as long as at
least one of the tests is consistent.
The computation of the individual p-values is performed as described in the details of this tests. Note that the derivation differs.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Zhang, S., Okhrin, O., Zhou, Q., and Song, P.. Goodness-of-fit
Test For Specification of Semiparametric Copula Dependence Models.
Journal of Econometrics, 193, 2016, pp. 215-233
doi:10.1016/j.jeconom.2016.02.017
data(IndexReturns2D) res_2 = gof(x = IndexReturns2D, copula = "normal", tests = c("gofKernel", "gofKendallCvM", "gofWhite"), M = 10) gofGetHybrid(result = res_2, p_values = c("MyTest" = 0.3, "AnotherTest" = 0.7), nsets = 3)
data(IndexReturns2D) res_2 = gof(x = IndexReturns2D, copula = "normal", tests = c("gofKernel", "gofKendallCvM", "gofWhite"), M = 10) gofGetHybrid(result = res_2, p_values = c("MyTest" = 0.3, "AnotherTest" = 0.7), nsets = 3)
gofKendallCvM
tests a given dataset for a copula based on
Kendall's process with the Cramer-von Mises test statistic. The margins can
be estimated by a bunch of distributions and the time which is necessary for
the estimation can be given. The possible copulae are "normal"
,
"t"
, "clayton"
, "gumbel"
, "frank"
, "joe"
,
"amh"
, "galambos"
, "huslerReiss"
, "tawn"
,
"tev"
, "fgm"
and "plackett"
. See for
reference Genest et al. (2009). The parameter estimation is performed with
pseudo maximum likelihood method. In case the estimation fails, inversion of
Kendall's tau is used. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation.
gofKendallCvM( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofKendallCvM( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrap samples. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
With the pseudo observations for
,
and
is the empirical copula given by
Let the
rescaled pseudo observations be
and the distribution
function of
shall be
. The estimated version is given by
with The
testable
hypothesis is then
with being an open subset of
for an
integer
, see Genest et al. (2009). The resulting
Cramer-von Mises test statistic is then given by
Because consists of more distributions than
the test is not necessarily consistent.
The approximate p-value is computed by the formula
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Christian
Genest, Jean-Francois Quessy, Bruno Remillard (2006). Goodness-of-fit
Procedures for Copula Models Based on the Probability Integral
Transformation. Scandinavian Journal of Statistics, Volume 33, Issue
2, 2006, Pages 337-366.
doi:10.1111/j.1467-9469.2006.00470.x
Ulf
Schepsmeier, Jakob Stoeber, Eike Christian Brechmann, Benedikt Graeler
(2015). VineCopula: Statistical Inference of Vine Copulas. R package
version 1.4.. https://cran.r-project.org/package=VineCopula
data(IndexReturns2D) gofKendallCvM("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofKendallCvM("normal", IndexReturns2D, M = 10)
gofKendallKS
tests a given dataset for a copula based on
Kendall's process with the Kolmogorov-Smirnov test statistic. The margins
can be estimated by a bunch of distributions and the time which is necessary
for the estimation can be given. The possible copulae are "normal"
,
"t"
, "clayton"
, "gumbel"
, "frank"
, "joe"
,
"amh"
, "galambos"
, "huslerReiss"
, "tawn"
,
"tev"
, "fgm"
and "plackett"
. See for
reference Genest et al. (2009). The parameter estimation is performed with
pseudo maximum likelihood method. In case the estimation fails, inversion of
Kendall's tau is used. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation.
gofKendallKS( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofKendallKS( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrap samples. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
With the pseudo observations for
,
and
is the empirical copula given by
Let the
rescaled pseudo observations be
and the distribution
function of
shall be
. The estimated version is given by
with
The testable
hypothesis is then
with being an open subset of
for an integer
, see Genest et al.
(2009). The resulting Kolmogorov-Smirnof test statistic is then given by
Because consists of more distributions than the
is the test not necessarily consistent.
The approximate p-value is computed by the formula
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Christian
Genest, Jean-Francois Quessy, Bruno Remillard (2006). Goodness-of-fit
Procedures for Copula Models Based on the Probability Integral
Transformation. Scandinavian Journal of Statistics, Volume 33, Issue
2, 2006, Pages 337-366.
doi:10.1111/j.1467-9469.2006.00470.x
Ulf
Schepsmeier, Jakob Stoeber, Eike Christian Brechmann, Benedikt Graeler
(2015). VineCopula: Statistical Inference of Vine Copulas. R package
version 1.4.. https://cran.r-project.org/package=VineCopula
data(IndexReturns2D) gofKendallKS("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofKendallKS("normal", IndexReturns2D, M = 10)
gofKernel
tests a 2 dimensional dataset with the Scaillet test for a
copula. The possible copulae are "normal"
, "t"
,
"clayton"
, "gumbel"
, "frank"
, "joe"
,
"amh"
, "galambos"
, "huslerReiss"
, "tawn"
,
"tev"
, "fgm"
and "plackett"
. The parameter
estimation is performed with pseudo maximum likelihood method. In case the
estimation fails, inversion of Kendall's tau is used. The approximate
p-values are computed with a parametric bootstrap, which computation can be
accelerated by enabling in-build parallel computation.
gofKernel( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofKernel( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, MJ = 100, dispstr = "ex", delta.J = 0.5, nodes.Integration = 12, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The parameter to be used. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
MJ |
Size of bootstrapping sample. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
delta.J |
Scaling parameter for the matrix of smoothing parameters. |
nodes.Integration |
Number of knots of the bivariate Gauss-Legendre quadrature. |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
The Scaillet test is a kernel-based goodness-of-fit test with a fixed
smoothing parameter. For the copula density , the corresponding kernel estimator is given by
where for
;
are the pseudo observations,
and
for which a bivariate
quadratic kernel is used, as in Scaillet (2007). The matrix of smoothing
parameters is
with
the sample covariance
matrix. The test statistic is then given by
where denotes the convolution operator and
is
a weight function, see Zhang et al. (2015). The bivariate Gauss-Legendre
quadrature method is used to compute the integral in the test statistic
numerically, see Scaillet (2007).
The approximate p-value is computed by the formula
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Zhang, S., Okhrin, O., Zhou, Q., and Song, P.. Goodness-of-fit
Test For Specification of Semiparametric Copula Dependence Models.
Journal of Econometrics, 193, 2016, pp. 215-233
doi:10.1016/j.jeconom.2016.02.017
Scaillet, O.
(2007). Kernel based goodness-of-fit tests for copulas with fixed smoothing
parameters. Journal of Multivariate Analysis, 98:533-543
data(IndexReturns2D) gofKernel("normal", IndexReturns2D, M = 5, MJ = 5)
data(IndexReturns2D) gofKernel("normal", IndexReturns2D, M = 5, MJ = 5)
gofKS
performs the "KS"
gof test for copulae
and compares the empirical copula against a parametric estimate of the
copula derived under the null hypothesis. The margins can be estimated by a
bunch of distributions and the time which is necessary for the estimation
can be given. The approximate p-values are computed with a parametric
bootstrap, which computation can be accelerated by enabling in-build parallel
computation. The gof statistics are computed with the function
gofTstat
from the package copula. It is possible to insert
datasets of all dimensions above 1 and the possible copulae are
"normal"
, "t"
, "clayton"
, "gumbel"
,
"frank"
, "joe"
, "amh"
, "galambos"
,
"huslerReiss"
, "tawn"
, "tev"
, "fgm"
and
"plackett"
. The parameter estimation is performed with pseudo maximum
likelihood method. In case the estimation fails, inversion of
Kendall's tau is used.
gofKS( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofKS( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "huslerReiss", "tawn", "tev", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
With the pseudo observations for
,
and
is the empirical copula given by
It shall be
tested the
hypothesis:
with as the true class of copulae under
. The resulting Kolmogorov-Smirnof test statistic is then
given by
with
the estimation of
under the
.
The approximate p-value is computed by the formula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Rosenblatt, M. (1952). Remarks on a Multivariate Transformation.
The Annals of Mathematical Statistics 23, 3, 470-472.
Hering,
C. and Hofert, M. (2014). Goodness-of-fit tests for Archimedean copulas in
high dimensions. Innovations in Quantitative Risk Management.
Marius Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
data(IndexReturns2D) gofKS("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofKS("normal", IndexReturns2D, M = 10)
gofOutputHybrid
outputs the desired Hybrid tests from previous
test results from this package for the specified testing size.
gofOutputHybrid(result, tests = NULL, nsets = NULL)
gofOutputHybrid(result, tests = NULL, nsets = NULL)
result |
An object of |
tests |
Individual tests which should be used in the hybrid test.
Submit a vector containing the position of the individual tests as they
appear in the object submitted, e.g. |
nsets |
The desired number of tests to be included in each hybrid test.
It should be an integer larger than 1 and smaller or equal than the number
of tests given in |
In most of scenarios for goodness-of-fit tests, including the one for copula models (e.g. Genest et al. (2009)) there exists no single dominant optimal test. Zhang et al. (2015) proposed a hybrid test which performed in their simulation study more desirably compared to the applied single tests.
The p-value is a combination of the single tests in the following way:
where is
the number of tests and
the p-value of the test
. It is ensured that the hybrid test is consistent as long as at
least one of the tests is consistent.
The computation of the individual p-values is performed as described in the details of this tests. Note that the derivation differs.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Zhang, S., Okhrin, O., Zhou, Q., and Song, P.. Goodness-of-fit
Test For Specification of Semiparametric Copula Dependence Models.
Journal of Econometrics, 193, 2016, pp. 215-233
doi:10.1016/j.jeconom.2016.02.017
data(IndexReturns2D) res1 = gof(IndexReturns2D, priority = "tests", copula = "normal", tests = c("gofKendallCvM", "gofRosenblattSnC", "gofKendallKS"), M = 5) gofOutputHybrid(res1, tests = 1, nsets = 2) # mind the difference to the regular output res1
data(IndexReturns2D) res1 = gof(IndexReturns2D, priority = "tests", copula = "normal", tests = c("gofKendallCvM", "gofRosenblattSnC", "gofKendallKS"), M = 5) gofOutputHybrid(res1, tests = 1, nsets = 2) # mind the difference to the regular output res1
gofPIOSRn
tests a 2 or 3 dimensional dataset with the approximate
PIOS test for a copula. The possible copulae are "normal"
,
"t"
, "clayton"
, "gumbel"
, "frank"
, "joe"
,
"amh"
, "galambos"
, "fgm"
and "plackett"
. The
parameter estimation is performed with pseudo maximum likelihood method. In
case the estimation fails, inversion of Kendall's tau is used. The
approximate p-values are computed with a semiparametric bootstrap, which
computation can be accelerated by enabling in-build parallel computation.
gofPIOSRn( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofPIOSRn( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The parameter to be used. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
The "Rn" test is introduced in Zhang et al. (2015). It is a information
ratio statistic which is approximately equivalent to the "Tn" test, which is
the PIOS test. Both test the hypothesis
"Rn" is introduced because the "Tn" test has
to estimate parameters which can be computationally demanding. The
test statistic of the "Tn" test is defined as
with the log likelihood function, the pseudo observations
for
;
and
and
By defining two information matrices
where
represents the negative sensitivity matrix,
the variability matrix and
is the
expectation under the true copula
. Under suitable regularity
conditions, given in Zhang et al. (2015), holds then in probability, that
as
The approximate p-value is computed by the formula
For more details, see Zhang et al. (2015). The applied estimation method is the two-step pseudo maximum likelihood approach, see Genest and Rivest (1995).
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Zhang, S., Okhrin, O., Zhou, Q., and Song, P.. Goodness-of-fit
Test For Specification of Semiparametric Copula Dependence Models.
Journal of Econometrics, 193, 2016, pp. 215-233
doi:10.1016/j.jeconom.2016.02.017
Genest, C., K.
G. and Rivest, L.-P. (1995). A semiparametric estimation procedure of
dependence parameters in multivariate families of distributions.
Biometrika, 82:534-552
data(IndexReturns2D) gofPIOSRn("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofPIOSRn("normal", IndexReturns2D, M = 10)
gofPIOSTn
tests a 2 or 3 dimensional dataset with the PIOS test for a
copula. The possible copulae are "normal"
, "t"
,
"clayton"
, "gumbel"
, "frank"
, "joe"
,
"amh"
, "galambos"
, "fgm"
and "plackett"
.
The parameter estimation is performed with pseudo maximum likelihood method.
In case the estimation fails, inversion of Kendall's tau is used. The
approximate p-values are computed with a semiparametric bootstrap, which
computation can be accelerated by enabling in-build parallel computation.
gofPIOSTn( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", m = 1, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofPIOSTn( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", m = 1, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The parameter to be used. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
m |
Length of blocks. |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
The "Tn" test is introduced in Zhang et al. (2015). It tests the
hypothesis
For the test blocks of length m
are constructed out of the data. The
test compares then the pseudo likelihood of the data in each block with the
overall parameter and with the parameter by leaving out the data in the
block. By this procedure can be determined if the data in the block
influence the parameter estimation significantly. The test statistic is
defined as
with the pseudo observations for
;
and
and
The approximate p-value is computed by the formula
The applied estimation method is the two-step pseudo maximum likelihood approach, see Genest and Rivest (1995).
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Zhang, S., Okhrin, O., Zhou, Q., and Song, P.. Goodness-of-fit
Test For Specification of Semiparametric Copula Dependence Models.
Journal of Econometrics, 193, 2016, pp. 215-233
doi:10.1016/j.jeconom.2016.02.017
Genest, C., K.
G. and Rivest, L.-P. (1995). A semiparametric estimation procedure of
dependence parameters in multivariate families of distributions.
Biometrika, 82:534-552
data(IndexReturns2D) gofPIOSTn("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofPIOSTn("normal", IndexReturns2D, M = 10)
gofRosenblattChisq
contains the RosenblattChisq gof test for
copulae, described in Genest (2009) and Hofert (2014), and compares the
empirical copula against a parametric estimate of the copula derived under
the null hypothesis. The margins can be estimated by a bunch of
distributions and the time which is necessary for the estimation can be
given. The approximate p-values are computed with a parametric bootstrap,
which computation can be accelerated by enabling in-build parallel
computation. The gof statistics are computed with the function
gofTstat
from the package copula. It is possible to insert
datasets of all dimensions above 1 and the possible copulae are
"normal"
, "t"
, "clayton"
, "gumbel"
,
"frank"
, "joe"
, "amh"
, "galambos"
,
"fgm"
and "plackett"
. The parameter estimation is performed
with pseudo maximum likelihood method. In case the estimation fails,
inversion of Kendall's tau is used.
gofRosenblattChisq( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofRosenblattChisq( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This Anderson-Darling test statistic (supposedly) computes
U[0,1]-distributed (under ) random variates via the
distribution function of chi-square distribution with d degrees of freedom,
see Hofert et al. (2014). The
hypothesis is
with as the true class
of copulae under
.
This test is based on the Rosenblatt probability integral transform which
uses the mapping . Following Genest et al. (2009) ensures this transformation the
decomposition of a random vector
with a distribution into mutually independent elements with a uniform
distribution on the unit interval. The mapping provides pseudo observations
, given by
The mapping is
performed by assigning to every vector for
and for
,
The Anderson-Darling test statistic of the variates
is computed (via ADGofTest::ad.test
), where ,
denotes the quantile function of the standard normal distribution function,
denotes the distribution function of the
chi-square distribution with
d
degrees of freedom, and
is the
th component in the
th row of
.
The test statistic is then given by
The approximate p-value is computed by the formula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
data(IndexReturns2D) gofRosenblattChisq("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofRosenblattChisq("normal", IndexReturns2D, M = 10)
gofRosenblattGamma
contains the RosenblattGamma gof tests for
copulae, described in Genest (2009) and Hofert (2014), and compares the
empirical copula against a parametric estimate of the copula derived under
the null hypothesis. The margins can be estimated by a bunch of
distributions and the time which is necessary for the estimation can be
given. The approximate p-values are computed with a parametric bootstrap,
which computation can be accelerated by enabling in-build parallel
computation. The gof statistics are computed with the function
gofTstat
from the package copula. It is possible to insert
datasets of all dimensions above 1 and the possible copulae are
"normal"
, "t"
, "clayton"
, "gumbel"
,
"frank"
, "joe"
, "amh"
, "galambos"
,
"fgm"
and "plackett"
. The parameter estimation is performed
with pseudo maximum likelihood method. In case the estimation fails,
inversion of Kendall's tau is used.
gofRosenblattGamma( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofRosenblattGamma( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This Anderson-Darling test statistic (supposedly) computes
U[0,1]-distributed (under ) random variates via the
distribution function of the gamma distribution, see Hofert et al. (2014).
As written in Hofert et al. (2014) computes this Anderson-Darling test
statistic for (supposedly) U[0,1]-distributed (under H_0) random variates
via the distribution function of the gamma distribution. The
hypothesis is
with
as the true class of copulae under
.
This test is based on the Rosenblatt probability integral transform which
uses the mapping . Following Genest et al. (2009) ensures this transformation the
decomposition of a random vector
with a distribution into mutually independent elements with a uniform
distribution on the unit interval. The mapping provides pseudo observations
, given by
The mapping is
performed by assigning to every vector for
and for
,
The Anderson-Darling test statistic of the variates
is computed (via ADGofTest::ad.test
), where ,
denotes the distribution function of
the gamma distribution with shape parameter d and shape parameter one (being
equal to an Erlang(d) distribution function).
The test statistic is then given by
The approximate p-value is computed by the formula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
data(IndexReturns2D) gofRosenblattGamma("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofRosenblattGamma("normal", IndexReturns2D, M = 10)
gofRosenblattSnB
contains the SnB gof test for copulae from
Genest (2009) and compares the empirical copula against a parametric
estimate of the copula derived under the null hypothesis. The margins can be
estimated by a bunch of distributions and the time which is necessary for
the estimation can be given. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation. The gof statistics are computed with the
function gofTstat
from the package copula. It is possible to
insert datasets of all dimensions above 1 and the possible copulae are
"normal"
, "t"
, "clayton"
, "gumbel"
,
"frank"
, "joe"
, "amh"
, "galambos"
,
"fgm"
and "plackett"
. The parameter estimation is performed
with pseudo maximum likelihood method. In case the estimation fails,
inversion of Kendall's tau is used.
gofRosenblattSnB( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofRosenblattSnB( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This test is based on the Rosenblatt probability integral transform which
uses the mapping to test the
hypothesis
with as the true class
of copulae under
. Following Genest et al. (2009) ensures this
transformation the decomposition of a random vector
with a distribution into mutually independent
elements with a uniform distribution on the unit interval. The mapping
provides pseudo observations
, given by
The mapping is performed by assigning to every vector
for
and for
,
The resulting independence copula is given by
.
The test statistic is then defined as
with
.
The approximate p-value is computed by the formula, see copula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
data(IndexReturns2D) gofRosenblattSnB("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofRosenblattSnB("normal", IndexReturns2D, M = 10)
gofRosenblattSnC
contains the SnC gof test from Genest (2009)
for copulae and compares the empirical copula against a parametric estimate
of the copula derived under the null hypothesis. The margins can be
estimated by a bunch of distributions and the time which is necessary for
the estimation can be given. The approximate p-values are computed with a
parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation. The gof statistics are computed with the
function gofTstat
from the package copula. It is possible to
insert datasets of all dimensions above 1 and the possible copulae are
"normal"
, "t"
, "clayton"
, "gumbel"
,
"frank"
, "joe"
, "amh"
, "galambos"
,
"fgm"
and "plackett"
. The parameter estimation is performed
with pseudo maximum likelihood method. In case the estimation fails,
inversion of Kendall's tau is used.
gofRosenblattSnC( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofRosenblattSnC( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe", "amh", "galambos", "fgm", "plackett"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, dispstr = "ex", lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are |
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The copula parameter to use, if it shall not be estimated. |
param.est |
Shall be either |
df |
Degrees of freedom, if not meant to be estimated. Only necessary
if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrapping loops. |
dispstr |
A character string specifying the type of the symmetric
positive definite matrix characterizing the elliptical copula. Implemented
structures are "ex" for exchangeable and "un" for unstructured, see package
|
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
This test is based on the Rosenblatt probability integral transform which
uses the mapping to test the
hypothesis
with as the true class
of copulae under
. Following Genest et al. (2009) ensures this
transformation the decomposition of a random vector
with a distribution into mutually independent
elements with a uniform distribution on the unit interval. The mapping
provides pseudo observations
, given by
The mapping is performed by assigning to every vector
for
and for
,
The resulting independence copula is given by
.
The test statistic is then defined as
with
.
The approximate p-value is computed by the formula, see copula,
where and
denote the test statistic and the
bootstrapped test statistc, respectively.
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Christian Genest, Bruno Remillard, David Beaudoin (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics, Volume 44, Issue 2, April 2009,
Pages 199-213, ISSN 0167-6687.
doi:10.1016/j.insmatheco.2007.10.005
Marius
Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula:
Multivariate Dependence with Copulas. R package version 0.999-15..
https://cran.r-project.org/package=copula
data(IndexReturns2D) gofRosenblattSnC("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofRosenblattSnC("normal", IndexReturns2D, M = 10)
gofTest4Copula
returns for a given copula and a dimension the
applicable implemented tests.
gofTest4Copula(copula = NULL, d = 2)
gofTest4Copula(copula = NULL, d = 2)
copula |
The copula to test for. Possible are the copulae
|
d |
The dimension to search for. |
Before performing a gof test on a dataset, it pays out to have a close look at the Scatterplot to receive an idea about the possible type of copula. Afterwards follows the decision about the test. The tests in this package can be used for different types of copulae functions and dimensions. This function is dedicated to help finding the applicable gof tests for the dataset.
A character vector which consists of the names of the tests.
gofTest4Copula("clayton", d = 2) gofTest4Copula("gumbel", d = 5)
gofTest4Copula("clayton", d = 2) gofTest4Copula("gumbel", d = 5)
gofWhich
was renamed to gofTest4Copula
. Please
use gofTest4Copula
.Please see and use the function gofTest4Copula
.
gofWhich(copula = NULL, d = 2)
gofWhich(copula = NULL, d = 2)
copula |
The copula to test for. Possible are the copulae
|
d |
The dimension to search for. |
A character vector which consists of the names of the tests.
gofWhichCopula
was renamed to gofCopula4Test
.
Please use gofCopula4Test
.Please see and use the function gofCopula4Test
.
gofWhichCopula(test)
gofWhichCopula(test)
test |
The test to search for copula. |
A character vector which consists of the names of the copula.
gofWhite
tests a given 2 dimensional dataset for a copula with
the gof test based on White's information matrix equality. The possible
copulae are "normal"
, "t"
, "clayton"
, "gumbel"
,
"frank"
and "joe"
. See for reference Schepsmeier et al. (2015).
The parameter estimation is performed with pseudo maximum likelihood method.
In case the estimation fails, inversion of Kendall's tau is used. The margins
can be estimated by a bunch of distributions and the time which is necessary
for the estimation can be given. The approximate p-values are computed with
a parametric bootstrap, which computation can be accelerated by enabling
in-build parallel computation. The computation of the test statistic and
p-values is performed by corresponding functions from the VineCopula
package.
gofWhite( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
gofWhite( copula = c("normal", "t", "clayton", "gumbel", "frank", "joe"), x, param = 0.5, param.est = TRUE, df = 4, df.est = TRUE, margins = "ranks", flip = 0, M = 1000, lower = NULL, upper = NULL, seed.active = NULL, processes = 1 )
copula |
The copula to test for. Possible are the copulae
|
x |
A matrix containing the data with rows being observations and columns being variables. |
param |
The parameter to be used. |
param.est |
Shall be either |
df |
The degrees of freedom, if not meant to be estimated. Only
necessary if tested for |
df.est |
Indicates if |
margins |
Specifies which estimation method for the margins shall be
used. The default is |
flip |
The control parameter to flip the copula by 90, 180, 270 degrees clockwise. Only applicable for bivariate copula. Default is 0 and possible inputs are 0, 90, 180, 270 and NULL. |
M |
Number of bootstrap samples. |
lower |
Lower bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
upper |
Upper bound for the maximum likelihood estimation of the copula
parameter. The constraint is also active in the bootstrapping procedure. The
constraint is not active when a switch to inversion of Kendall's tau is
necessary. Default |
seed.active |
Has to be either an integer or a vector of M+1 integers.
If an integer, then the seeds for the bootstrapping procedure will be
simulated. If M+1 seeds are provided, then these seeds are used in the
bootstrapping procedure. Defaults to |
processes |
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details. |
The details are obtained from Schepsmeier et al. (2015) who states that this test uses the information matrix equality of White (1982). Under correct model specification is the Fisher Information equivalently calculated as minus the expected Hessian matrix or as the expected outer product of the score function. The null hypothesis is
where
is the expected Hessian matrix and
is the expected outer product of the
score function.
The test statistic is derived by
with
and
where represents the log likelihood
function and
is the length of the parameter vector
.
The test statistic will be rejected if
For small values of M
, initializing the parallelisation via
processes
does not make sense. The registration of the parallel
processes increases the computation time. Please consider to enable
parallelisation just for high values of M
.
Please note, the test gofWhite may be unstable for t-copula. Please handle the results carefully.
An object of the class
gofCOP with the components
method |
a character which informs about the performed analysis |
copula |
the copula tested for |
margins |
the method used to estimate the margin distribution. |
param.margins |
the parameters of
the estimated margin distributions. Only applicable if the margins were not
specified as |
theta |
dependence parameters of the copulae |
df |
the degrees of freedem of the copula. Only applicable for t-copula. |
res.tests |
a matrix with the p-values and test statistics of the hybrid and the individual tests |
Ulf Schepsmeier, Jakob Stoeber, Eike Christian Brechmann,
Benedikt Graeler (2015). VineCopula: Statistical Inference of Vine Copulas.
R package version 1.4..
https://cran.r-project.org/package=VineCopula
Schepsmeier, U.
and J. Stoeber (2014). Derivatives and Fisher information of bivariate
copulas. Statistical Papers, 55(2), 525-542.
https://link.springer.com/article/10.1007/s00362-013-0498-x
Stoeber, J. and U. Schepsmeier (2013). Estimating standard errors in regular
vine copula models Computational Statistics, 28 (6), 2679-2707
Schepsmeier, U. (2015). Efficient information based goodness-of-fit
tests for vine copula models with fixed margins. Journal of
Multivariate Analysis 138, 34-52. Schepsmeier, U. (2014). A goodness-of-fit
test for regular vine copula models.
data(IndexReturns2D) gofWhite("normal", IndexReturns2D, M = 10)
data(IndexReturns2D) gofWhite("normal", IndexReturns2D, M = 10)
A dataset containing the log returns of two european stock indices in the year 1998.
A matrix with 100 rows and 2 columns
The raw data are part of the R datasets and were kindly provided by Erste Bank AG, Vienna, Austria.
A dataset containing the log returns of three european stock indices in the year 1998.
A matrix with 200 rows and 3 columns
The raw data are part of the R datasets and were kindly provided by Erste Bank AG, Vienna, Austria.
Plots an object of class gofCOP.
## S3 method for class 'gofCOP' plot( x, copula = NULL, hybrid = NULL, point.bg = "white", point.col = "black", point.cex = 0.7, jitter.val = 0.1, pal = "xmen", bean.b.o = 0.2, inf.method = "hdi", theme = 2, ... )
## S3 method for class 'gofCOP' plot( x, copula = NULL, hybrid = NULL, point.bg = "white", point.col = "black", point.cex = 0.7, jitter.val = 0.1, pal = "xmen", bean.b.o = 0.2, inf.method = "hdi", theme = 2, ... )
x |
An object of |
copula |
Specify for which copulae to plot the results. The possible
entry is a character vector of the copula names. Default is |
hybrid |
Specify for which combinations to plot the hybrid tests. The
possible entry is a numeric vector of the hybrid combinations. Default is
|
point.bg |
The background color of the plot. Defaults to |
point.col |
The color of the dots. Defaults to |
point.cex |
The size of the dots. Defaults to |
jitter.val |
Jittering the dots left/right for better visibility of
results. Defaults to |
pal |
Color palette of the plots. Defaults to |
bean.b.o |
Specification of how opaque the bars are. Defaults to
|
inf.method |
Type of inference bands. Defaults to Bayesian Highest
Density Intervals, |
theme |
Theme of the plot. See |
... |
Further arguments to be passed to |
The plotting function is constructed around pirateplot
from
the yarrr
package. Please see respective package for more details on
the non-default specifications of the plotting function.
We recommend not to amend the arguments xlim
, data
,
formula
, sortx
, xaxt
, ylim
and ylab
from
pirateplot
. The arguments were defined such that the resulting
plot displays the test results in a proper manner.
None
Phillips, N. (2017). yarrr: A Companion to the e-Book "YaRrr!:
The Pirate's Guide to R". R package version 0.1.5.
https://CRAN.R-project.org/package=yarrr
print.gofCOP
prints the values of an object of class gofCOP.
## S3 method for class 'gofCOP' print(x, ...)
## S3 method for class 'gofCOP' print(x, ...)
x |
An object of |
... |
Further arguments to be passed over. Currently non. |
None