Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8030eb3

Browse files
committed
Add informative messages to shape.hill
1 parent4e7eeba commit8030eb3

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

‎DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: mev
22
Type: Package
33
Title: Modelling of Extreme Values
4-
Version: 2.0.0002
4+
Version: 2.0.0003
55
Authors@R: c(
66
person(given="Leo", family="Belzile", role = c("aut", "cre"), email = "belzilel@gmail.com", comment = c(ORCID = "0000-0002-9135-014X")),
77
person(given="Jennifer L.", family="Wadsworth", role=c("aut")),

‎NEWS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
- Warnings are not produced when`fit.egp` fails to obtain standard errors.
1818
- The`print` method for`thselect.egp` is more explicit about the lack of threshold returned if the hypothesis is rejected at the highest threshold considered (which returns`NA`).
1919
-`thselect.ncpgp` now passes ordered thresholds to inner function to avoid warning messages.
20+
- Function`shape.hill` now provides more informative error messages when passing vectors of invalid number of exceedances`k`.
21+
2022

2123
#mev 2.0 (Release date 2025-10-22)
2224

‎R/tailindex.R‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,22 @@ PickandsXU <- function(xdat, m) {
115115
shape.hill<-function(xdat,k) {
116116
logdata<- log(xdat[xdat>0& is.finite(xdat)])
117117
logdata<- sort(logdata,decreasing=TRUE)
118+
n<- length(logdata)
119+
stopifnot(n>10)
118120
if (missing(k)) {
119-
k<- seq(10, length(logdata)-1)
121+
k<-10:(n-1)
122+
}else {
123+
k<- as.integer(sort(k))
124+
if (k[length(k)]>=n) {
125+
k<-k[k<n]
126+
}
127+
if (length(k)==0|k[1]<1) {
128+
stop(
129+
"Invalid value for\"k\": must be a vector of integers between 1 and length(xdat)-1."
130+
)
131+
}
120132
}
121-
n<- length(logdata)
122-
k<- as.integer(sort(k))
123-
k<-k[k<n]
133+
124134
kmin<-k[1]
125135
kmax<- min(k[length(k)],n-1)
126136
n<- min(kmax+1,n)
@@ -326,6 +336,11 @@ plot.mev_shape_rbm <- function(x, type = c("shape", "risk"), log = TRUE, ...) {
326336
#' @inheritParams shape.rbm
327337
#' @param kmax maximum number of exceedances to consider.
328338
#' @return a list with elements
339+
#' \itemize{
340+
#' \item{\code{k0}:} the number of exceedances at the selected threshold
341+
#' \item{\code{thresh0}:} the selected threshold, or accordingly the (\eqn{k_0+1})th order statistic
342+
#' \item{\code{shape}:} the RBM shape estimate
343+
#' }
329344
#' @export
330345
thselect.rbm<-function(xdat,kmax= length(xdat)) {
331346
xdat<- sort(xdat,decreasing=TRUE)

‎man/thselect.rbm.Rd‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp