Skip to content

Commit

Permalink
Fix bug for bivariate series (QMC vector) for MGP
Browse files Browse the repository at this point in the history
  • Loading branch information
lbelzile committed Jan 10, 2024
1 parent d6ed2a6 commit d2f1ebb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mev
Type: Package
Title: Modelling of Extreme Values
Version: 1.16
Version: 1.16.0002
Authors@R: c(person(given="Leo", family="Belzile", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-9135-014X")), person(given="Jennifer L.", family="Wadsworth", role=c("aut")), person(given="Paul J.", family="Northrop", role=c("aut")), person(given="Scott D.", family="Grimshaw", role=c("aut")), person(given="Jin", family="Zhang", role=c("ctb")), person(given="Michael A.", family="Stephens", role=c("ctb")), person(given="Art B.", family="Owen", role=c("ctb")), person(given="Raphael", family="Huser", role=c("aut")))
Description: Various tools for the analysis of univariate, multivariate and functional extremes. Exact simulation from max-stable processes [Dombry, Engelke and Oesting (2016) <doi:10.1093/biomet/asw008>, R-Pareto processes for various parametric models, including Brown-Resnick (Wadsworth and Tawn, 2014, <doi:10.1093/biomet/ast042>) and Extremal Student (Thibaud and Opitz, 2015, <doi:10.1093/biomet/asv045>). Threshold selection methods, including Wadsworth (2016) <doi:10.1080/00401706.2014.998345>, and Northrop and Coleman (2014) <doi:10.1007/s10687-014-0183-z>. Multivariate extreme diagnostics. Estimation and likelihoods for univariate extremes, e.g., Coles (2001) <doi:10.1007/978-1-4471-3675-0>.
License: GPL-3
Expand Down
13 changes: 9 additions & 4 deletions R/mgplikelihoods.R
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ likmgp <- function(dat,
}
}
if(model %in% c("br", "xstud")){
if(ncol(dat) == 2L){
stop("Function does not support bivariate data sets.")
}
if (!requireNamespace("mvPot", quietly = TRUE)) {
stop(
"Package \"mvPot\" must be installed to use this function.",
call. = FALSE
)
}
}


genvec1 <- ellips$genvec1
B1 <- ifelse(is.null(ellips$B1), 1009L, ellips$B1)
antithetic <- ifelse(is.null(ellips$antithetic), FALSE, ellips$antithetic)
Expand All @@ -266,7 +266,7 @@ likmgp <- function(dat,
}
M1 <- ifelse(is.null(ellips$M1), 1L, ellips$M1)
ncores <- ifelse(is.null(ellips$ncores), 1L, ellips$ncores)

}
if (model == "br") {
intens <- intensBR(tdat = tdat, Lambda = Lambda)
exponentMeasure <- sum(.weightsBR(z = tu, Lambda = Lambda, prime = B1, method = "mvPot", genvec = genvec1, nrep = 1) / tu)
Expand Down Expand Up @@ -434,6 +434,10 @@ clikmgp <- function(dat,
numAbovePerRow <- ellips$numAbovePerRow
numAbovePerCol <- ellips$numAbovePerCol
mmax <- ellips$mmax
if(model %in% c("br","xstud")){
if(ncol(dat) == 2L){
stop("Function does not support bivariate data sets.")
}
genvec1 <- ellips$genvec1
genvec2 <- ellips$genvec2
B1 <- ifelse(is.null(ellips$B1), 1009L, ellips$B1)
Expand All @@ -448,6 +452,7 @@ clikmgp <- function(dat,
M1 <- ifelse(is.null(ellips$M1), 1L, ellips$M1)
M2 <- ifelse(is.null(ellips$M2), 1L, ellips$M2)
ncores <- ifelse(is.null(ellips$ncores), 1L, ellips$ncores)
}
censored <- ellips$censored
if (is.null(censored)) {
censored <- matrix(FALSE, nrow = nrow(tdat), ncol = ncol(tdat))
Expand Down
4 changes: 2 additions & 2 deletions R/multivar.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ chibar <- function(dat, confint = c("delta", "profile", "tem"), qu = 0, level =
}


#' Bivariate angular function for extrapolation based on rays
#' Bivariate angular dependence function for extrapolation based on rays
#'
#' The scale parameter \eqn{g(w)} in the Ledford and Tawn approach is estimated empirically for
#' \eqn{x} large as \deqn{\frac{\Pr(X_P>xw, Y_P>x(1-w))}{\Pr(X_P>x, Y_P>x)}}
Expand Down Expand Up @@ -100,7 +100,7 @@ angextrapo <- function(dat, qu = 0.95, w = seq(0.05, 0.95, length = 20)) {
}

##################
#' Estimation of the bivariate lambda function of Wadsworth and Tawn (2013)
#' Estimation of the bivariate angular dependence function of Wadsworth and Tawn (2013)
#'
#' @param dat an \eqn{n} by \eqn{2} matrix of multivariate observations
#' @param qu quantile level on uniform scale at which to threshold data. Default to 0.95
Expand Down
2 changes: 1 addition & 1 deletion man/angextrapo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions man/frwind.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/lambdadep.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d2f1ebb

Please sign in to comment.