Skip to content

Commit

Permalink
Suppress more warnings, allow plot customization
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Belzile committed May 3, 2023
1 parent 0d75bb3 commit 25e3697
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
26 changes: 21 additions & 5 deletions R/profile.R
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,24 @@ plot.eprof <- function(x, ...) {
} else{
xlim <- args$xlim
}
plot(NULL, type = "n", bty = "l", xlim = xlim, ylim = ylim, xlab = ifelse(!tikz,
expression(psi), "$\\psi$"), ylab = "Profile log likelihood")
if(is.null(args$xlab)){
xlab <- ifelse(!tikz,
expression(psi),
"$\\psi$")
} else{
xlab <- args$xlab
}
if(is.null(args$ylab)){
ylab <- "profile log likelihood"
} else{
ylab <- args$ylab
}
plot(NULL, type = "n",
bty = "l",
xlim = xlim,
ylim = ylim,
xlab = xlab,
ylab = ylab)
abline(h = -qchisq(level, 1)/2, col = "gray")
# Legend
lcols <- NULL
Expand Down Expand Up @@ -1485,9 +1501,9 @@ gpd.pll <- function(psi, param = c("scale", "shape", "quant", "VaR", "ES", "Nmea
std.error <- sqrt(solve(gpdr.infomat(par = mle, dat = dat, method = "exp", m = m))[1,
1])
constr.mle.quant <- function(quant) {
suppressMessages(Rsolnp::solnp(par = 0.01, function(lambda, psi, m) {
suppressWarnings(suppressMessages(Rsolnp::solnp(par = 0.01, function(lambda, psi, m) {
-gpdr.ll(par = c(psi, lambda), dat = dat, m = m)
}, psi = quant, m = m, control = list(trace = 0))$par)
}, psi = quant, m = m, control = list(trace = 0))$par))
}


Expand Down Expand Up @@ -1913,6 +1929,7 @@ gpd.pll <- function(psi, param = c("scale", "shape", "quant", "VaR", "ES", "Nmea
}
ans$family <- "gpd"
ans$threshold <- threshold
ans$param <- param
if(plot){
plot(ans)
}
Expand Down Expand Up @@ -1960,7 +1977,6 @@ plot.fr <- function(x, ...) {
} else if (sum(c(1, 2, 3, 4) %in% whichPlot) == 2) {
par(mfrow = c(1, 2))
}

fr <- x
xl <- ifelse(is.null(fr$param), expression(psi), fr$param)

Expand Down
2 changes: 1 addition & 1 deletion R/rgparp.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rparp <- function(n, shape = 1, riskf = c("sum", "site", "max", "min", "l2"),
# Body of rmevspec
models <- c("log", "neglog", "bilog", "negbilog", "hr", "br", "xstud", "smith", "schlather", "ct", "sdir", "dirmix", "negdir",
"dir")
model <- match.arg(model, models)[1]
model <- match.arg(model, models, several.ok = TRUE)[1]
if (model == "schlather") {
if (!missing(param))
warning("Parameter value (degrees of freedom) set to one for Schlather model")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `mev`: Modelling Extreme values

[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/mev)](https://cran.r-project.org/package=mev)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version-last-release/mev)](https://cran.r-project.org/package=mev)
[![License](https://img.shields.io/badge/license-GPL%20%28%3E=%203%29-blue.svg?style=flat)](http://www.gnu.org/licenses/gpl-3.0.html)
[![Downloads](http://cranlogs.r-pkg.org/badges/mev?color=brightgreen)](http://www.r-pkg.org/pkg/mev)

Expand Down

0 comments on commit 25e3697

Please sign in to comment.