include/vinecopulib/bicop/implementation/class.ipp
//! Fits a bivariate copula (with fixed family) to data.
//!
//! For parametric models, two different methods are available. `"mle"` fits
//! the parameters by maximum-likelihood. `"itau"` uses inversion of
//! Kendall's \f$ \tau \f$, but is only available for one-parameter families
//! and the Student t copula. For the latter, there is a one-to-one
//! transformation for the first parameter, the second is found by profile
//! likelihood optimization (with accuracy of at least 0.5). Nonparametric
//! families have specialized methods, no specification is required.
//!
//! @details When at least one variable is discrete, two types of "observations"
//! are required: the first \f$ n \times 2 \f$ block contains realizations of
//! \f$ F_{X_1}(X_1), F_{X_2}(X_2) \f$. Let \f$ k \f$ denote the number of
//! discrete variables (either one or two). Then the second \f$ n \times k \f$
//! block contains realizations of \f$ F_{X_k}(X_k^-) \f$. The minus indicates a
//! left-sided limit of the cdf. For continuous variables the left limit and the
//! cdf itself coincide. For, e.g., an integer-valued variable, it holds \f$
//! F_{X_k}(X_k^-) = F_{X_k}(X_k - 1) \f$.
//!
//! @param data An \f$ n \times (2 + k) \f$ matrix of observations contained in
//!   \f$(0, 1) \f$, where \f$ k \f$ is the number of discrete variables.
//! @param controls The controls (see FitControlsBicop).
Fits a bivariate copula (with fixed family) to data.
For parametric models, two different methods are available. `"mle"` fits
the parameters by maximum-likelihood. `"itau"` uses inversion of
Kendall's \f$ \tau \f$, but is only available for one-parameter families
and the Student t copula. For the latter, there is a one-to-one
transformation for the first parameter, the second is found by profile
likelihood optimization (with accuracy of at least 0.5). Nonparametric
families have specialized methods, no specification is required.
Fits a bivariate copula ( with fixed family ) to data . For parametric models two different methods are available . ` " mle " ` fits the parameters by maximum - likelihood . ` " itau " ` uses inversion of Kendall ' s \ f$ \ tau \ f$ but is only available for one - parameter families and the Student t copula . For the latter there is a one - to - one transformation for the first parameter the second is found by profile likelihood optimization ( with accuracy of at least 0 . 5 ) . Nonparametric families have specialized methods no specification is required .
inline void
Bicop::fit(const Eigen::MatrixXd& data, const FitControlsBicop& controls)
{
  std::string method;
  if (tools_stl::is_member(bicop_->get_family(), bicop_families::parametric)) {
    method = controls.get_parametric_method();
  } else {
    method = controls.get_nonparametric_method();
  }
  tools_eigen::check_if_in_unit_cube(data);
  auto w = controls.get_weights();
  Eigen::MatrixXd data_no_nan = data;
  check_weights_size(w, data);
  tools_eigen::remove_nans(data_no_nan, w);
  bicop_->fit(prep_for_abstract(data_no_nan),
              method,
              controls.get_nonparametric_mult(),
              w);
  nobs_ = data_no_nan.rows();
}
inline void Bicop :: fit ( const Eigen :: MatrixXd & data , const FitControlsBicop & controls ) { std :: string method ; if ( tools_stl :: is_member ( bicop_ -> get_family ( ) , bicop_families :: parametric ) ) { method = controls . get_parametric_method ( ) ; } else { method = controls . get_nonparametric_method ( ) ; } tools_eigen :: check_if_in_unit_cube ( data ) ; auto w = controls . get_weights ( ) ; Eigen :: MatrixXd data_no_nan = data ; check_weights_size ( w , data ) ; tools_eigen :: remove_nans ( data_no_nan , w ) ; bicop_ -> fit ( prep_for_abstract ( data_no_nan ) , method , controls . get_nonparametric_mult ( ) , w ) ; nobs_ = data_no_nan . rows ( ) ; }
Fits a bivariate copula (with fixed family) to data.
Fits a bivariate copula ( with fixed family ) to data .