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
  • 0e42ceb
  • /
  • tests
  • /
  • testthat
  • /
  • test-BFBayesFactor.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:e13d0cdd53b8eee9d5fd634b87554611764eb03b
origin badgedirectory badge Iframe embedding
swh:1:dir:994afc0e99ff43db28c4f918307594485d5a636c
origin badgerevision badge
swh:1:rev:428249f43a9c6fd0c425b28deb5fee51a9525d69
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: 428249f43a9c6fd0c425b28deb5fee51a9525d69 authored by Dominique Makowski on 18 September 2022, 01:46:03 UTC
version 0.13.0
Tip revision: 428249f
test-BFBayesFactor.R
if (requiet("testthat") && requiet("BayesFactor") && requiet("bayestestR")) {
  set.seed(333)
  x <- BayesFactor::correlationBF(y = iris$Sepal.Length, x = iris$Sepal.Width)
  test_that("p_direction", {
    expect_equal(as.numeric(p_direction(x)), 0.9225, tolerance = 1)
  })


  # BF t.test one sample ---------------------------
  data(sleep)
  diffScores <- sleep$extra[1:10] - sleep$extra[11:20]
  x <- BayesFactor::ttestBF(x = diffScores)
  test_that("p_direction", {
    expect_equal(as.numeric(p_direction(x)), 0.99675, tolerance = 1)
  })


  # BF t.test two samples ---------------------------
  data(chickwts)
  chickwts <- chickwts[chickwts$feed %in% c("horsebean", "linseed"), ]
  chickwts$feed <- factor(chickwts$feed)
  x <- BayesFactor::ttestBF(formula = weight ~ feed, data = chickwts)
  test_that("p_direction", {
    expect_equal(as.numeric(p_direction(x)), 1, tolerance = 1)
  })

  # BF t.test meta-analytic ---------------------------
  t <- c(-.15, 2.39, 2.42, 2.43)
  N <- c(100, 150, 97, 99)
  x <- BayesFactor::meta.ttestBF(t = t, n1 = N, rscale = 1)
  test_that("p_direction", {
    expect_equal(as.numeric(p_direction(x)), 0.99975, tolerance = 1)
  })

  # # ---------------------------
  # # "BF ANOVA"
  # data(ToothGrowth)
  # ToothGrowth$dose <- factor(ToothGrowth$dose)
  # levels(ToothGrowth$dose) <- c("Low", "Medium", "High")
  # x <- BayesFactor::anovaBF(len ~ supp*dose, data=ToothGrowth)
  # test_that("p_direction", {
  #   expect_equal(as.numeric(p_direction(x)), 91.9, tol=0.1)
  # })
  #
  # # ---------------------------
  # # "BF ANOVA Random"
  # data(puzzles)
  # x <- BayesFactor::anovaBF(RT ~ shape*color + ID, data = puzzles, whichRandom="ID")
  # test_that("p_direction", {
  #   expect_equal(as.numeric(p_direction(x)), 91.9, tol=0.1)
  # })
  #
  #
  # # ---------------------------
  # # "BF lm"
  # x <- BayesFactor::lmBF(len ~ supp + dose, data = ToothGrowth)
  # test_that("p_direction", {
  #   expect_equal(as.numeric(p_direction(x)), 91.9, tol=0.1)
  # })
  #
  #
  # x2 <- BayesFactor::lmBF(len ~ supp + dose + supp:dose, data = ToothGrowth)
  # x <- x / x2
  # test_that("p_direction", {
  #   expect_equal(as.numeric(p_direction(x)), 91.9, tol=0.1)
  # })


  test_that("rope_range", {
    x <- BayesFactor::lmBF(len ~ supp + dose, data = ToothGrowth)
    expect_equal(rope_range(x)[2], sd(ToothGrowth$len) / 10)

    x <- BayesFactor::ttestBF(
      ToothGrowth$len[ToothGrowth$supp == "OJ"],
      ToothGrowth$len[ToothGrowth$supp == "VC"]
    )
    expect_equal(rope_range(x)[2], sd(ToothGrowth$len) / 10)

    x <- BayesFactor::ttestBF(formula = len ~ supp, data = ToothGrowth)
    expect_equal(rope_range(x)[2], sd(ToothGrowth$len) / 10)

    # else
    x <- BayesFactor::correlationBF(ToothGrowth$len, ToothGrowth$dose)
    expect_equal(rope_range(x, verbose = FALSE), c(-0.05, 0.05))
  })
}

back to top

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