R/mple_com_ikte_gaus.R

#' mple_com_ikte_gaus
#'
#' @param rho rho of which make comparison of MPLE and IKTE
#'
#' @return matrix with loglikelihood of MPLE and IKTE estimation
#' @export
#'
mple_com_ikte_gaus <- function(rho){
  out <- matrix(ncol = 2, nrow = length(rho))
  for (i in 1:length(rho)){
    set.seed(271)
    nc <- normalCopula(rho[i], dim = 3)
    U <- pobs(rCopula(1000, copula = nc))
    fit.N <- fitCopula(normalCopula(, dim = 3, dispstr = "un"), data = U)
    mple_rho <- fit.N@loglik
    P. <- cor(U, method = "kendall")
    ikte_rho <- sum(dCopula(U, copula = normalCopula(P2p(P.), dim = 3, dispstr = "un"), log = TRUE)) # log-likelihood
    out[i,] <- c(mple_rho, ikte_rho)
  }
  colnames(out) <- c("MPLE", "IKTE")
  rownames(out) <- rho
  return(t(out))
}
3schwartz/SpecialeScrAndFun documentation built on May 4, 2019, 6:29 a.m.