## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(rvinecopulib) set.seed(201) ## ----construct---------------------------------------------------------------- cop <- bicop_dist( family = "clayton", rotation = 90, parameters = 2 ) cop ## ----evaluate----------------------------------------------------------------- points <- rbind(c(0.2, 0.7), c(0.8, 0.3)) dbicop(points, cop) pbicop(points, cop) rbicop(4, cop) ## ----direct------------------------------------------------------------------- dbicop(points, "gaussian", 0, 0.6) ## ----h-functions-------------------------------------------------------------- h <- hbicop(points, cond_var = 1, family = cop) h hbicop(cbind(points[, 1], h), cond_var = 1, family = cop, inverse = TRUE) ## ----dependence--------------------------------------------------------------- par_to_ktau("clayton", 90, 2) get_ktau(cop) blomqvist_beta(cop) tail_dep(cop) ## ----selection---------------------------------------------------------------- u <- rbicop(300, "gumbel", 180, 2) fit <- bicop( u, family_set = c("gaussian", "clayton", "gumbel", "frank"), selcrit = "bic" ) fit summary(fit) ## ----weights------------------------------------------------------------------ weights <- seq_len(nrow(u)) weighted_fit <- bicop( u, family_set = c("gaussian", "gumbel"), weights = weights ) weighted_fit ## ----discrete----------------------------------------------------------------- counts <- cbind(rpois(80, 2), rpois(80, 3)) u_discrete <- cbind( ppois(counts[, 1], 2), ppois(counts[, 2], 3), ppois(counts[, 1] - 1, 2), ppois(counts[, 2] - 1, 3) ) fit_discrete <- bicop( u_discrete, var_types = c("d", "d"), family_set = "onepar" ) fit_discrete ## ----vectorized--------------------------------------------------------------- rho <- seq(-0.7, 0.7, length.out = nrow(points)) dbicop(points, "gaussian", 0, parameters = rho) rbicop(length(rho), "gaussian", 0, parameters = rho)