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

swh:1:snp:71aa7a1048a256887a7ca6e4730d9177c0e591ed
  • Code
  • Branches (6)
  • Releases (0)
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/1.0.0
    • refs/tags/1.0.1
    • refs/tags/1.0.2
    • refs/tags/1.0.3
    • refs/tags/1.0.4
    No releases to show
  • 71d6ecc
  • /
  • tests
  • /
  • testthat
  • /
  • test-likelihood.R
Raw File Download

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
content badge
swh:1:cnt:195a376e26b48d15e35346077c8e20d0b901e621
directory badge
swh:1:dir:e3e0a741b504d74fb8040c1ba1d729b6cdedd105
revision badge
swh:1:rev:6eaddec6ef0bffeedea3b70bece1699cb1c5f66a
snapshot badge
swh:1:snp:71aa7a1048a256887a7ca6e4730d9177c0e591ed

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: 6eaddec6ef0bffeedea3b70bece1699cb1c5f66a authored by Lisa Amrhein on 26 February 2021, 13:10:02 UTC
version 1.0.2
Tip revision: 6eaddec
test-likelihood.R
test_that("Consistency of Poisson likelihoods", {
  p <- 13
  rand_pois <- rpois(100, lambda = p)
  nl_pois <- nlogL_pois(rand_pois, p)
  expect_equal(nl_pois, nlogL_zipois(rand_pois, c(0, p)))
  expect_equal(nl_pois, nlogL_pois2(rand_pois, c(1, p, 10)))
  expect_equal(nl_pois, nlogL_pois2(rand_pois, c(0, 10, p)))
  expect_equal(nl_pois, nlogL_zipois2(rand_pois, c(0, 1, p, 10)))
  expect_equal(nl_pois, nlogL_zipois2(rand_pois, c(0, 0, 10, p)))
})

test_that("Consistency of Negative-Binomial likelihoods", {
  p <- c(7, 13)
  rand_nb <- rnbinom(100, size = p[1], mu = p[2])
  nl_nb <- nlogL_nb(rand_nb, p)
  expect_equal(nl_nb, nlogL_zinb(rand_nb, c(0, p)))
  expect_equal(nl_nb, nlogL_nb2(rand_nb, c(1, p, 11, 19)))
  expect_equal(nl_nb, nlogL_nb2(rand_nb, c(0, 11, 19, p)))
  expect_equal(nl_nb, nlogL_zinb2(rand_nb, c(0, 1, p, 11, 19)))
  expect_equal(nl_nb, nlogL_zinb2(rand_nb, c(0, 0, 11, 19, p)))
})

test_that("Consistency of Poisson-Beta likelihoods", {
  p <- c(5,7,13)
  rand_pb <- rpb(100, p[1], p[2], p[3])
  nl_pb <- nlogL_pb(rand_pb, p)
  expect_equal(nl_pb, nlogL_zipb(rand_pb, c(0, p)))
  expect_equal(nl_pb, nlogL_pb2(rand_pb, c(1, p, 11, 19, 23)))
  expect_equal(nl_pb, nlogL_pb2(rand_pb, c(0, 11, 19, 23, p)))
  expect_equal(nl_pb, nlogL_zipb2(rand_pb, c(0, 1, p, 11, 19, 23)))
  expect_equal(nl_pb, nlogL_zipb2(rand_pb, c(0, 0, 11, 19, 23, p)))
})

back to top

Software Heritage — Copyright (C) 2015–2026, 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— Content policy— Contact— JavaScript license information— Web API