Skip to content

Commit

Permalink
Merge pull request #58 from poissonconsulting/sensitivity
Browse files Browse the repository at this point in the history
Add sensitivity functions to produce vector of new pars that vary sd without changing mean
  • Loading branch information
nehill197 committed May 16, 2024
2 parents 542509a + 2c4c0cd commit 7b5154a
Show file tree
Hide file tree
Showing 99 changed files with 3,010 additions and 213 deletions.
33 changes: 7 additions & 26 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
Expand All @@ -12,9 +8,10 @@ on:

name: R-CMD-check

permissions: read-all

jobs:
R-CMD-check:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
Expand All @@ -24,23 +21,17 @@ jobs:
matrix:
config:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -58,14 +49,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true

- name: action-slack
if: failure()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
uses: 8398a7/action-slack@v3.0.0
with:
status: ${{ job.status }}
author_name: "github action: ${{github.workflow}}"
fields: repo, ref, commit, author, message

build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
13 changes: 7 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Package: extras
Title: Helper Functions for Bayesian Analyses
Version: 0.6.1.9000
Authors@R: c(
person("Joe", "Thorley", , "joe@poissonconsulting.ca", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7683-4592")),
person("Nicole", "Hill", , "nicole@poissonconsulting.ca", role = "aut",
person("Nicole", "Hill", , "nicole@poissonconsulting.ca", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7623-2153")),
person("Joe", "Thorley", , "joe@poissonconsulting.ca", role = "aut",
comment = c(ORCID = "0000-0002-7683-4592")),
person("Kirill", "Müller", role = "ctb",
comment = c(ORCID = "0000-0002-1416-3412")),
person("Nadine", "Hussein", role = "ctb",
Expand All @@ -22,7 +22,7 @@ URL: https://poissonconsulting.github.io/extras/,
https://github.com/poissonconsulting/extras
BugReports: https://github.com/poissonconsulting/extras/issues
Depends:
R (>= 3.6)
R (>= 4.3.0)
Imports:
chk,
lifecycle,
Expand All @@ -41,10 +41,11 @@ Suggests:
testthat (>= 3.0.0),
tibble,
tidyr,
viridis
viridis,
withr
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
VignetteBuilder: knitr
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ export(res_pois_zi)
export(res_skewnorm)
export(res_student)
export(rskewnorm)
export(sens_beta)
export(sens_exp)
export(sens_gamma)
export(sens_gamma_pois)
export(sens_gamma_pois_zi)
export(sens_lnorm)
export(sens_neg_binom)
export(sens_norm)
export(sens_pois)
export(sens_skewnorm)
export(sens_student)
export(sextreme)
export(skewness)
export(step)
Expand Down
2 changes: 1 addition & 1 deletion R/dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dev_beta_binom <- function(x, size = 1, prob = 0.5, theta = 0, res = FALSE) {
opt_p <- rep(NA, length(x))
bol <- !is.na(x) & !is.na(size) & !is.na(theta)
for (i in seq_along(x)) {
if (bol[i] & !is.na(bol[i])) {
if (bol[i] && !is.na(bol[i])) {
opt_p[i] <- stats::optimize(opt_beta_binom, interval = c(0, 1), x = x[i],
size = size[i], theta = theta[i], tol = 1e-8)$minimum
}
Expand Down
3 changes: 3 additions & 0 deletions R/params.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
#' @param lower.tail A flag specifying whether to return the lower or upper tail of the distribution.
#' @param q A vector of quantiles.
#' @param p A vector of probabilities.
#' @param sd_mult A non-negative multiplier on the standard deviation of the distribution.
#' @param alpha The first shape parameter of the Beta distribution.
#' @param beta The second shape parameter of the Beta distribution.
#' @name params
NULL
Loading

0 comments on commit 7b5154a

Please sign in to comment.