Skip to contents

Two fixed univariate marginals coupled by a bivariate copula.

Usage

model_bivariate(
  marginal_x,
  marginal_y,
  copula = "Normal",
  estimation_method = "InferenceFromMargins",
  parameters = NULL,
  parameter_values = NULL,
  use_default_flat_priors = NULL
)

Arguments

marginal_x, marginal_y

each a list with family, data, and parameter_values elements describing a fixed marginal.

copula

copula family name: "Normal" (the default), "StudentT", "Clayton", "Frank", "Gumbel", "Joe", or "AliMikhailHaq".

estimation_method

"InferenceFromMargins" (the default), "PseudoLikelihood", or "FullLikelihood".

parameters

optional model_parameter() object or list of them, setting bounds, fixed flags, priors, or starting values.

parameter_values

optional numeric vector of all parameter values, applied last.

use_default_flat_priors

logical; set FALSE alongside a custom prior.

Value

An object of class corehydro_model.

Note

Fit an Archimedean copula ("Clayton", "Frank", "Gumbel", "Joe", "AliMikhailHaq") with optimizer = "DifferentialEvolution". fit_mle() and fit_map() default to "NelderMead", whose start point is the midpoint of the copula's constraint range: for Gumbel, whose range is {1, 100}, that is theta 50.5, and the local search slides to the lower bound and reports Success with the independence copula. On 150 Gumbel pairs simulated at theta 3, "NelderMead" returned theta 1.0000 with a log-likelihood of 0.0000 while "DifferentialEvolution" returned theta 3.0334 at 110.5081. "Powell" errors on some samples, so "DifferentialEvolution" is the recommendation rather than any global optimizer. Elliptical copulas ("Normal", "StudentT") are not affected.

Examples

x <- c(12, 15, 9, 22, 18, 14, 10, 28, 17, 11, 19, 13)
y <- c(2.1, 2.6, 1.7, 3.7, 3.1, 2.5, 1.9, 4.6, 3.0, 2.0, 3.3, 2.3)
model_bivariate(
  marginal_x = list(family = "Normal", data = x, parameter_values = c(mean(x), sd(x))),
  marginal_y = list(family = "Normal", data = y, parameter_values = c(mean(y), sd(y))),
  copula = "Normal"
)
#> <corehydro_model> bivariate