Skip to content

Commit

Permalink
Merge pull request #317 from poissonconsulting/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Nov 13, 2023
2 parents 03109aa + 15914cc commit 6425932
Show file tree
Hide file tree
Showing 55 changed files with 741 additions and 294 deletions.
4 changes: 1 addition & 3 deletions .covrignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
R/deprecated.R
R/zzz.R
R/release.R
R/devtools-helpers.R
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,19 @@ export(ssd_data)
export(ssd_dists)
export(ssd_dists_all)
export(ssd_dists_bcanz)
export(ssd_eburrIII3)
export(ssd_ecd)
export(ssd_ecd_data)
export(ssd_egamma)
export(ssd_egompertz)
export(ssd_einvpareto)
export(ssd_elgumbel)
export(ssd_ellogis)
export(ssd_ellogis_llogis)
export(ssd_elnorm)
export(ssd_elnorm_lnorm)
export(ssd_emulti)
export(ssd_eweibull)
export(ssd_exposure)
export(ssd_fit_bcanz)
export(ssd_fit_burrlioz)
Expand Down
9 changes: 9 additions & 0 deletions R/burrrIII3.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ ssd_rburrIII3 <- function(n, shape1 = 1, shape2 = 1, scale = 1, chk = TRUE) {
rdist("burrIII3", n = n, shape1 = shape1, shape2 = shape2, scale = scale, chk = chk)
}

#' @describeIn ssd_e Default Parameter Values for BurrIII Distribution
#' @export
#' @examples
#'
#' ssd_eburrIII3()
ssd_eburrIII3 <- function() {
c(shape1 = 1, shape2 = 1, scale = 1)
}

sburrIII3 <- function(data, pars = NULL) {
if (!is.null(pars)) {
return(pars)
Expand Down
3 changes: 2 additions & 1 deletion R/censor.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ censoring_text <- function(x) {
}

#' Is Censored
#'
#' `r lifecycle::badge('deprecated')`
#'
#' Deprecated for [`ssd_is_censored()`].
#'
#' @param x A fitdists object.
Expand Down
9 changes: 9 additions & 0 deletions R/gamma.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ ssd_rgamma <- function(n, shape = 1, scale = 1, chk = TRUE) {
rdist("gamma", n = n, shape = shape, scale = scale, chk = chk)
}

#' @describeIn ssd_e Default Parameter Values for Gamma Distribution
#' @export
#' @examples
#'
#' ssd_egamma()
ssd_egamma <- function() {
c(shape = 1, scale = 1)
}

sgamma <- function(data, pars = NULL) {
if (!is.null(pars)) {
return(pars)
Expand Down
14 changes: 8 additions & 6 deletions R/ggplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ scale_color_ssd <- function(...) {
}

#' Species Sensitivity Data Points
#'
#'
#' Uses the empirical cumulative distribution to create scatterplot of points `x`.
#'
#' `geom_ssd()` has been deprecated for `geom_ssdpoint()`.
#' @inheritParams ggplot2::layer
#' @inheritParams ggplot2::geom_point
#' @seealso [`ssd_plot_cdf()`]
Expand Down Expand Up @@ -181,10 +180,13 @@ geom_xribbon <- function(mapping = NULL,
)
}

#' @describeIn geom_ssdpoint Species Sensitivity Data Points
#'
#' Uses the empirical cumulative distribution to create scatterplot of points `x`.
#' Species Sensitivity Data Points
#' `r lifecycle::badge('deprecated')`
#'
#' `geom_ssd()` has been deprecated for `geom_ssdpoint()`.
#'
#' @inheritParams ggplot2::layer
#' @inheritParams ggplot2::geom_point
#' @export
#' @examples
#' \dontrun{
Expand All @@ -209,9 +211,9 @@ geom_ssd <- function(mapping = NULL,
}

#' Plot Species Sensitivity Data
#' `r lifecycle::badge('deprecated')`
#'
#' Uses the empirical cumulative density/distribution to visualize species sensitivity data.
#' `r lifecycle::badge('deprecated')`
#'
#' @inheritParams ggplot2::layer
#' @inheritParams ggplot2::geom_point
Expand Down
19 changes: 15 additions & 4 deletions R/gompertz.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

#' Gompertz Probability Density
#'
#' `r lifecycle::badge("deprecated")`
#'
#' @param x A numeric vector of values.
Expand All @@ -40,8 +39,9 @@ ssd_pgompertz <- function(q, location = 1, shape = 1, lower.tail = TRUE, log.p =
)
}

#' @describeIn ssd_p Cumulative Distribution Function for Gompertz Distribution
#' Cumulative Distribution Function for Gompertz Distribution
#' `r lifecycle::badge("deprecated")`
#' @inheritParams params
#' @export
pgompertz <- function(q, llocation = 0, lshape = 0, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_warn("1.0.0", "pgompertz()", "ssd_pgompertz()")
Expand All @@ -63,8 +63,9 @@ ssd_qgompertz <- function(p, location = 1, shape = 1, lower.tail = TRUE, log.p =
)
}

#' @describeIn ssd_q Quantile Function for Gompertz Distribution
#' Quantile Function for Gompertz Distribution
#' `r lifecycle::badge("deprecated")`
#' @inheritParams params
#' @export
qgompertz <- function(p, llocation = 0, lshape = 0, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_warn("1.0.0", "qgompertz()", "ssd_qgompertz()")
Expand All @@ -84,8 +85,18 @@ ssd_rgompertz <- function(n, location = 1, shape = 1, chk = TRUE) {
rdist("gompertz", n = n, location = location, shape = shape, chk = chk)
}

#' @describeIn ssd_r Random Generation for Gompertz Distribution
#' @describeIn ssd_e Default Parameter Values for Gompertz Distribution
#' @export
#' @examples
#'
#' ssd_egompertz()
ssd_egompertz <- function() {
c(location = 1, shape = 1)
}

#' Random Generation for Gompertz Distribution
#' `r lifecycle::badge("deprecated")`
#' @inheritParams params
#' @export
rgompertz <- function(n, llocation = 0, lshape = 0) {
lifecycle::deprecate_warn("1.0.0", "rgompertz()", "ssd_rgompertz()")
Expand Down
3 changes: 2 additions & 1 deletion R/hc-burrlioz.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
}

#' Hazard Concentrations for Burrlioz Fit
#'
#' `r lifecycle::badge('deprecated')`
#'
#' Deprecated for [`ssd_hc()`].
#'
#' @inheritParams params
Expand Down
9 changes: 9 additions & 0 deletions R/invpareto.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ ssd_rinvpareto <- function(n, shape = 3, scale = 1, chk = TRUE) {
rdist("invpareto", n = n, shape = shape, scale = scale, chk = chk)
}

#' @describeIn ssd_e Default Parameter Values for Inverse Pareto Distribution
#' @export
#' @examples
#'
#' ssd_einvpareto()
ssd_einvpareto <- function() {
c(shape = 3, scale = 1)
}

sinvpareto <- function(data, pars = NULL) {
scale <- max(data$right)
shape <- 1 / mean(log(scale / data$right))
Expand Down
28 changes: 24 additions & 4 deletions R/lgumbel.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

#' Log-Gumbel (Inverse Weibull) Probability Density
#'
#' `r lifecycle::badge("deprecated")`
#'
#' @param x A numeric vector of values.
Expand All @@ -40,8 +39,18 @@ ssd_plgumbel <- function(q, locationlog = 0, scalelog = 1, lower.tail = TRUE, lo
)
}

#' @describeIn ssd_p Cumulative Distribution Function for Log-Gumbel Distribution
#' @describeIn ssd_e Default Parameter Values for Log-Gumbel Distribution
#' @export
#' @examples
#'
#' ssd_einvpareto()
ssd_elgumbel <- function() {
list(locationlog = 0, scalelog = 1)
}

#' Cumulative Distribution Function for Log-Gumbel Distribution
#' `r lifecycle::badge("deprecated")`
#' @inheritParams params
#' @export
plgumbel <- function(q, locationlog = 0, scalelog = 1, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_warn("1.0.0", "plgumbel()", "ssd_plgumbel()")
Expand All @@ -63,8 +72,9 @@ ssd_qlgumbel <- function(p, locationlog = 0, scalelog = 1, lower.tail = TRUE, lo
)
}

#' @describeIn ssd_q Quantile Function for Log-Gumbel Distribution
#' Quantile Function for Log-Gumbel Distribution
#' `r lifecycle::badge("deprecated")`
#' @inheritParams params
#' @export
qlgumbel <- function(p, locationlog = 0, scalelog = 1, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_warn("1.0.0", "qlgumbel()", "ssd_qlgumbel()")
Expand All @@ -84,8 +94,18 @@ ssd_rlgumbel <- function(n, locationlog = 0, scalelog = 1, chk = TRUE) {
rdist("gumbel", n = n, location = locationlog, scale = scalelog, .lgt = TRUE, chk = chk)
}

#' @describeIn ssd_r Random Generation for log-Gumbel Distribution
#' @describeIn ssd_e Default Parameter Values for log-Gumbel Distribution
#' @export
#' @examples
#'
#' ssd_elgumbel()
ssd_elgumbel <- function() {
c(locationlog = 0, scalelog = 1)
}

#' Random Generation for log-Gumbel Distribution
#' `r lifecycle::badge("deprecated")`
#' @inheritParams params
#' @export
rlgumbel <- function(n, locationlog = 0, scalelog = 1) {
lifecycle::deprecate_warn("1.0.0", "rlgumbel()", "ssd_rlgumbel()")
Expand Down
10 changes: 10 additions & 0 deletions R/llogis-llogis.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ ssd_rllogis_llogis <- function(n, locationlog1 = 0, scalelog1 = 1,
)
}

#' @describeIn ssd_e Default Parameter Values for Log-Logistic/Log-Logistic Mixture Distribution
#' @export
#' @examples
#'
#' ssd_ellogis_llogis()
ssd_ellogis_llogis <- function() {
c(locationlog1 = 0, scalelog1 = 1,
locationlog2 = 1, scalelog2 = 1, pmix = 0.5)
}

sllogis_llogis <- function(data, pars = NULL) {
if (!is.null(pars)) {
return(pars)
Expand Down
9 changes: 9 additions & 0 deletions R/llogis.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ ssd_rllogis <- function(n, locationlog = 0, scalelog = 1, chk = TRUE) {
rdist("logis", n = n, location = locationlog, scale = scalelog, .lgt = TRUE, chk = chk)
}

#' @describeIn ssd_e Default Parameter Values for Log-Logistic Distribution
#' @export
#' @examples
#'
#' ssd_ellogis()
ssd_ellogis <- function() {
c(locationlog = 0, scalelog = 1)
}

sllogis <- function(data, pars = NULL) {
if (!is.null(pars)) {
return(pars)
Expand Down
10 changes: 10 additions & 0 deletions R/lnorm-lnorm.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ ssd_rlnorm_lnorm <- function(n, meanlog1 = 0, sdlog1 = 1,
)
}

#' @describeIn ssd_e Default Parameter Values for Log-Normal/Log-Normal Mixture Distribution
#' @export
#' @examples
#'
#' ssd_elnorm_lnorm()
ssd_elnorm_lnorm <- function() {
c(meanlog1 = 0, sdlog1 = 1,
meanlog2 = 1, sdlog2 = 1, pmix = 0.5)
}

slnorm_lnorm <- function(data, pars = NULL) {
if (!is.null(pars)) {
return(pars)
Expand Down
9 changes: 9 additions & 0 deletions R/lnorm.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ ssd_rlnorm <- function(n, meanlog = 0, sdlog = 1, chk = TRUE) {
rdist("lnorm", n = n, meanlog = meanlog, sdlog = sdlog, chk = chk)
}

#' @describeIn ssd_e Default Parameter Values for Log-Normal Distribution
#' @export
#' @examples
#'
#' ssd_elnorm()
ssd_elnorm <- function() {
c(meanlog = 0, sdlog = 1)
}

slnorm <- function(data, pars = NULL) {
if (!is.null(pars)) {
return(pars)
Expand Down
Loading

0 comments on commit 6425932

Please sign in to comment.