R/RcppExports.R

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Marginal transformation of the observations to Frechet or Pareto scale
#'
#' This function uses the probability integral transform to map the observations
#' to unit Frechet scale \code{GEV(1,1,1)} or unit Pareto distribution \code{GP(1,1,1)}.
#' The function returns a list with the transformed observation and the marginal transformation
#' Jacobian.
#'
#' @param data \code{n} by \code{d} matrix of observations on original scale
#' @inheritParams nllmvsdir
#' @param GEVorGP logical indicating whether to transform to unit Frechet or unit Pareto. Default to \code{true} (GEV).
#' @export
MarginalTransformation <- function(data, u, lambda, scale, shape, GEVorGP = TRUE) {
    .Call('ExtLiouv_MarginalTransformation', PACKAGE = 'ExtLiouv', data, u, lambda, scale, shape, GEVorGP)
}

#' Indicates whether observations lie above the threshold.
#'
#' The function returns a boolean matrix of indicators.
#'
#' @param data matrix of all observations
#' @param threshold vector of thresholds under which observations are censored
#' @return matrix of logical indicating whether or not observations lie above the marginal threshold
#' @keywords internal
#' @export
isAbove <- function(data, threshold) {
    .Call('ExtLiouv_isAbove', PACKAGE = 'ExtLiouv', data, threshold)
}

#' Negative log-likelihood of scaled Dirichlet extreme value model
#'
#' This is the workhorse with the likelihood, which transforms observations
#' and returns the objective function value.
#'
#' @param y \code{n} by \code{d} matrix of observations on original scale
#' @param u threshold (on \code{y}-scale), to be substracted from y
#' @param thid \code{n} by \code{d} matrix of logical vector indicating whether or not a
#' threshold exceedance was observed
#' @param N total number of observations (not just exceedances)
#' @param scale vector of scale parameters
#' @param shape vector of shape parameters
#' @param lambda vector of percentage of threshold exceedances
#' @param alpha vector of parameters for the Dirichlet model
#' @param rho regular variation parameter
#' @return the negative log-composite likelihood value
#' @section Note: The \code{N} argument is there mostly for cases in which function returns
#' observations stripped from their contribution; in such cases, the count
#' would otherwise be `incorrect'.
#' @export
nllmvsdir <- function(y, thid, N, lambda, u, alpha, rho, scale, shape) {
    .Call('ExtLiouv_nllmvsdir', PACKAGE = 'ExtLiouv', y, thid, N, lambda, u, alpha, rho, scale, shape)
}

#' Negative log-likelihood of scaled negative Dirichlet extreme value model
#'
#' This is the workhorse with the likelihood, which transforms observations
#' and returns the objective function value.
#'
#' @param y \code{n} by \code{d} matrix of observations on original scale
#' @param u threshold (on \code{y}-scale), to be substracted from y
#' @param thid \code{n} by \code{d} matrix of logical vector indicating whether or not a
#' threshold exceedance was observed
#' @param N total number of observations (not just exceedances)
#' @param scale vector of scale parameters
#' @param shape vector of shape parameters
#' @param lambda vector of percentage of threshold exceedances
#' @param alpha vector of parameters for the Dirichlet model
#' @param rho index of regular variation parameter, in \eqn{(0, \min(\alpha))}
#' @return the negative log-composite likelihood value
#' @section Note: The \code{N} argument is there mostly for cases in which function returns
#' observations stripped from their contribution; in such cases, the count
#' would otherwise be `incorrect'.
#' @export
nllmvsnegdir <- function(y, thid, N, lambda, u, alpha, rho, scale, shape) {
    .Call('ExtLiouv_nllmvsnegdir', PACKAGE = 'ExtLiouv', y, thid, N, lambda, u, alpha, rho, scale, shape)
}

#' Negative log-likelihood of Husler-Reiss model
#'
#' This is the workhorse with the likelihood, which transforms observations
#' and returns the objective function value.
#'
#' @param y \code{n} by \code{d} matrix of observations on original scale
#' @param u threshold (on \code{y}-scale), to be substracted from y
#' @param thid \code{n} by \code{d} matrix of logical vector indicating whether or not a
#' threshold exceedance was observed
#' @param N total number of observations (not just exceedances)
#' @param scale vector of scale parameters
#' @param shape vector of shape parameters
#' @param lambda vector of percentage of threshold exceedances
#' @param Lambda matrix of parameters
#' @return the negative log-composite likelihood value
#' @section Note: The \code{N} argument is there mostly for cases in which function returns
#' observations stripped from their contribution; in such cases, the count
#' would otherwise be `incorrect'.
#' @export
nllmvhr <- function(y, thid, N, lambda, u, Lambda, scale, shape) {
    .Call('ExtLiouv_nllmvhr', PACKAGE = 'ExtLiouv', y, thid, N, lambda, u, Lambda, scale, shape)
}

#' Negative log-likelihood of extremal Student model
#'
#' This is the workhorse with the likelihood, which transforms observations
#' and returns the objective function value.
#' @param y \code{n} by \code{d} matrix of observations on original scale
#' @param u threshold (on \code{y}-scale), to be substracted from y
#' @param thid \code{n} by \code{d} matrix of logical vector indicating whether or not a
#' threshold exceedance was observed
#' @param N total number of observations (not just exceedances)
#' @param scale vector of scale parameters
#' @param shape vector of shape parameters
#' @param lambda vector of percentage of threshold exceedances
#' @param Rho correlation matrix
#' @param nu degrees of freedom of the model
#' @return the negative log-composite likelihood value
#' @section Note: The \code{N} argument is there mostly for cases in which function returns
#' observations stripped from their contribution; in such cases, the count
#' would otherwise be `incorrect'.
#' @export
nllmvxstud <- function(y, thid, N, lambda, u, Rho, nu, scale, shape) {
    .Call('ExtLiouv_nllmvxstud', PACKAGE = 'ExtLiouv', y, thid, N, lambda, u, Rho, nu, scale, shape)
}

#' Spectral density of scaled Dirichlet and negative Dirichlet extreme value distributions
#'
#' @param param vector containing the parameters \eqn{\alpha} and \eqn{\rho}, in this order.
#' @param dat matrix of Fréchet or Pareto observations, of dimension \eqn{n} by \eqn{d}.
#' @param d dimension of model
#' @param transform logical indicating whether parameters are on the log scale. Default to \code{TRUE}
#'
#' @details The function is provided as a wrapper and takes parameters on the log scale for \eqn{\alpha} (\eqn{\rho}).
#' @return the log-likelihood for the \code{n} sample
.dirspecdens <- function(param, dat, d, transform = TRUE) {
    .Call('ExtLiouv_dirspecdens', PACKAGE = 'ExtLiouv', param, dat, d, transform)
}

#' Spectral density of scaled negative Dirichlet extreme value distribution
#'
#' @param param vector containing the parameters \eqn{\alpha} and \eqn{\rho}, in this order.
#' @param dat matrix of Fréchet or Pareto observations, of dimension \eqn{n} by \eqn{d}.
#' @param d dimension of model
#' @param transform logical indicating whether parameters are on the log scale. Default to \code{TRUE}
#'
#' @details The function is provided as a wrapper and takes parameters on the log scale for \eqn{\alpha} and \eqn{\rho}.
#' @return the log-likelihood for the \code{n} sample
.negdirspecdens <- function(param, dat, d, transform = TRUE) {
    .Call('ExtLiouv_negdirspecdens', PACKAGE = 'ExtLiouv', param, dat, d, transform)
}

#' Spectral density of Coles and Tawn extreme value distribution
#'
#' @param param vector containing the parameters \eqn{\alpha}.
#' @param dat matrix of pseudo-dat, of dimension \eqn{d}
#' @param transform logical indicating whether parameters are on the log scale. Default to \code{TRUE}
#' @return the value of the log likelihood for a sample of size \code{n}
.ctspecdens <- function(param, dat, transform = TRUE) {
    .Call('ExtLiouv_ctspecdens', PACKAGE = 'ExtLiouv', param, dat, transform)
}
lbelzile/ExtLiouv documentation built on May 20, 2019, 8:28 p.m.