bicopulaGOF {usefr}  R Documentation 
Goodnessoffit (GOF) tests for a twodimensional copula based,
by default, on the knowledge of the marginal probability distributions.
Several functionalities/tools from copulapackage
are integrated to perform the GOF of copulas that includes specific
margin parameter settings. In terms of
copulapackage
vocabulary, these are GOF for copula
objects from class Mvdc
(also called nonfree
copulas).
bicopulaGOF(x, y, copula = NULL, margins = NULL, paramMargins = NULL, sample.size = NULL, nboots = 10, approach = c("adchisq", "adgamma", "chisq", "rmse", "Sn", "SnB", "SnC"), Rosenblatt = FALSE, breaks = 12, method = "ml", num.cores = 1L, tasks = 0, seed = 123, verbose = TRUE, ...)
x 
Numerical vector with the observations from the first margin distribution. 
y 
Numerical vector with the observations from the second margin distribution. 
copula 
A copula object from class 
margins 
A character vector specifying all the parametric marginal distributions. See details below. 
paramMargins 
A list whose each component is a list (or numeric vectors) of named components, giving the parameter values of the marginal distributions. See details below. 
sample.size 
The size of the samples used for each sampling. It is not required for the approaches: "Sn", "SnB", and "SnC"; see below. 
nboots 
The number of booststrap resampling to perform. 
approach 
a character string specifying the goodnessoffit test
statistic to be used, which has to be one (or a unique abbreviation) of
following: "adchisq", "adgamma", "Sn", "SnB", "SnC", "chisq", and "rmse".
With the exception of chisq and rmse, all the other
statistics are the same as in functions 
Rosenblatt 
The Andersonâ€“Darling statistic approach using Rosenblatt
transformation is normally used for the GOF in function

breaks 
A single number giving the number of bins for the computation of the Pearson's Chisquared statistic as suggested in reference [1]. Bascally, it is used to split the unit square [0, 1]^2 into bins/regions. 
method 
A character string specifying the estimation method to be used
to estimate the dependence parameter(s); see

num.cores, tasks 
Paramaters for parallele computation using package

seed 
An integer used to set a 'seed' for random number generation. 
verbose 
if verbose, comments and progress bar will be printed. 
Notice that copulapackage
already have
function gofCopula
to perform GOF. However,
its use can be computational expensive for big datasets.
The statistic value estimated for the observations, and the estimated bootstrap p.value.
Robersy Sanchez (https://genomaths.com).
Jaworski, P. Copulae in Mathematical and Quantitative Finance. 213, d (2013).
Wang, Y. et al. Multivariate analysis of joint probability of different rainfall frequencies based on copulas. Water (Switzerland) 9, (2017).
ppCplot
, gofCopula
,
fitCDF
, fitdistr
, and
fitMixDist
require(stats) set.seed(12) margins = c("norm", "norm") ## Random variates from normal distributions X < rnorm(2*1e3, mean = 0, sd = 10) Y < rnorm(2*1e3, mean = 0, sd = 10) parMargins = list( list(mean = 0, sd = 10), list(mean = 0, sd = 10)) bicopulaGOF(x = X, y = Y, copula = "normalCopula", sample.size = 1e2, margins = margins, paramMargins = parMargins, nboots = 999, Rosenblatt = TRUE, approach = "adgamma", num.cores = 1L) bicopulaGOF(x = X, y = Y, copula = "normalCopula", sample.size = 1e2, margins = margins, paramMargins = parMargins, nboots = 999, Rosenblatt = FALSE, approach = "adgamma", num.cores = 1L) ##  Nonparallel expensive computation   # require(copula) # # U < pobs(cbind(X, Y)) #' # Compute the pseudoobservations # fit < fitCopula(normalCopula(), U, method = 'ml') # U < cCopula(u = U, copula = fit@copula) #' # Rosenblatt transformation # # set.seed(123) # system.time( # gof < gofCopula(copula = fit@copula, x = U, N = 99, method = "Sn", # simulation = "pb") # ) # gof ## About ## user system elapsed ## 103.370 0.613 105.022 # ##  Parallel computation with 2 cores   ## Same algorithm as in 'gofCopula' adapted for parallel computation # system.time( # gof < bicopulaGOF(x = X, y = Y, copula = "normalCopula", # margins = margins, paramMargins = parMargins, nboots = 99, # Rosenblatt = TRUE, approach = "Sn", seed = 123, # num.cores = 2L) # ) # gof ## About ## user system elapsed ## 2.491 0.100 51.185 ## ## Same algorithm as in 'gofCopula' adapted for parallel computation and ## Rosenblatt = FALSE # system.time( # gof < bicopulaGOF(x = X, y = Y, copula = "normalCopula", # margins = margins, paramMargins = parMargins, nboots = 99, # Rosenblatt = FALSE, approach = "Sn", seed = 123, # num.cores = 2L) # ) # gof