Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/cran/bayestestR
04 October 2022, 07:12:41 UTC
  • Code
  • Branches (24)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/0.1.0
    • refs/tags/0.10.0
    • refs/tags/0.10.5
    • refs/tags/0.11.0
    • refs/tags/0.11.5
    • refs/tags/0.12.1
    • refs/tags/0.13.0
    • refs/tags/0.2.0
    • refs/tags/0.2.2
    • refs/tags/0.2.5
    • refs/tags/0.3.0
    • refs/tags/0.4.0
    • refs/tags/0.5.0
    • refs/tags/0.5.1
    • refs/tags/0.5.2
    • refs/tags/0.5.3
    • refs/tags/0.6.0
    • refs/tags/0.7.0
    • refs/tags/0.7.2
    • refs/tags/0.7.5
    • refs/tags/0.8.0
    • refs/tags/0.8.2
    • refs/tags/0.9.0
    No releases to show
  • 5324d50
  • /
  • tests
  • /
  • testthat
  • /
  • test-si.R
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:15aa7900f16b92ea88c643471f83c86b3eec15ae
origin badgedirectory badge Iframe embedding
swh:1:dir:801f068ffba1e3a3d0affc5fbbf6d58c1a2850ad
origin badgerevision badge
swh:1:rev:85d0a0463621c30063752c5577e591be0de5ae60
origin badgesnapshot badge
swh:1:snp:2c68a6c5a8af2f06ac2c0225927f25b54fd1f9d0
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 85d0a0463621c30063752c5577e591be0de5ae60 authored by Dominique Makowski on 26 July 2021, 08:40:08 UTC
version 0.10.5
Tip revision: 85d0a04
test-si.R
if (require("rstanarm") && suppressPackageStartupMessages(require("bayestestR", quietly = TRUE)) &&
  require("testthat") && require("emmeans")) {
  test_that("si.numeric", {
    set.seed(333)
    prior <- distribution_normal(1000, mean = 0, sd = 1)
    posterior <- distribution_normal(1000, mean = .5, sd = .3)

    res <- si(posterior, prior)
    expect_equal(res$CI_low, 0.03999124, tolerance = 0.02)
    expect_equal(res$CI_high, 1.053103, tolerance = 0.02)
    expect_s3_class(res, c("bayestestR_si"))

    res <- si(posterior, prior, BF = 3)
    expect_equal(res$CI_low, 0.333, tolerance = 0.02)
    expect_equal(res$CI_high, 0.759, tolerance = 0.02)

    res <- si(posterior, prior, BF = 100)
    expect_true(all(is.na(res$CI_low)))
    expect_true(all(is.na(res$CI_high)))

    res <- si(posterior, prior, BF = c(1 / 3, 1, 3))
    expect_equal(res$CI, c(1 / 3, 1, 3), tolerance = 0.02)
    expect_equal(res$CI_low, c(-0.119, 0.039, 0.333), tolerance = 0.02)
    expect_equal(res$CI_high, c(1.213, 1.053, 0.759), tolerance = 0.02)
  })

  test_that("si.rstanarm", {
    skip_on_cran()

    data(sleep)
    contrasts(sleep$group) <- contr.orthonorm # See vignette
    stan_model <- stan_lmer(extra ~ group + (1 | ID), data = sleep, refresh = 0)

    set.seed(333)
    stan_model_p <- update(stan_model, prior_PD = TRUE)
    res1 <- si(stan_model, stan_model_p, verbose = FALSE)

    set.seed(333)
    res2 <- si(stan_model, verbose = FALSE)

    expect_s3_class(res1, c("bayestestR_si"))
    expect_equal(res1, res2)

    set.seed(123)
    group_diff <- pairs(emmeans(stan_model, ~group))
    res3 <- si(group_diff, prior = stan_model)

    expect_equal(res3$CI_low, -2.746, tolerance = 0.3)
    expect_equal(res3$CI_high, -0.4, tolerance = 0.3)
  })
}

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top