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/sns
11 November 2022, 14:07:59 UTC
  • Code
  • Branches (8)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/0.9
    • refs/tags/0.9.1
    • refs/tags/1.0.0
    • refs/tags/1.1.0
    • refs/tags/1.1.1
    • refs/tags/1.1.2
    • refs/tags/1.2.2
    No releases to show
  • 19b637c
  • /
  • R
  • /
  • ess.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:86e97edaafdd7ba3b8c43866f60c05a96bdfc277
origin badgedirectory badge Iframe embedding
swh:1:dir:3f9917389f75c8281afed647d11acde9ce210747
origin badgerevision badge
swh:1:rev:766b6821a98ea206fe461d23237bc4a4589c24af
origin badgesnapshot badge
swh:1:snp:218ce733af7de6247148caa3cf8c71ef1c66e614
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: 766b6821a98ea206fe461d23237bc4a4589c24af authored by Alireza Mahani on 02 November 2022, 10:02:22 UTC
version 1.2.2
Tip revision: 766b682
ess.R
############################################################################# 
# Computes the effective sample size using the algorithm in Section 2.3 of
# the paper (http://arxiv.org/pdf/1011.0175v1.pdf) by Madeline Thompson.
# The algorithm is taken from earlier work on 'Initial Sequence Estimators'
# by multiple authors. 
# 
# Args: 
#   x - matrix object with each sample (possibly multivariate) as a row
# Returns:
#   effective sample sizes for the time series in each col of 'x'
############################################################################# 
ess <- function(x, method = c("coda", "ise")) {
  method <- match.arg(method) # TODO: added per JSS suggestion; must be tested
  
  # recursive call to each column of x
  if (NCOL(x) > 1) {
    return (apply(x, 2, ess, method))
  }
  
  # require minimum length of 3 for array
  M <- length(x)
  if (M < 3) return (NA)

  # return zero for constant arrays
  if (sd(x) == 0.0) return (0.0)
  
  # coda method
  if (method == "coda") return (effectiveSize(x))
  
  # ise method
  autocf <- acf(x, plot = FALSE, lag.max = length(x))$acf
  sum <- 0
  prev <- 0
  for (s in 1:(M-2)) {
    rho <- autocf[s+1]
    if ((prev + rho) <= 0) {
      break
    } else {
      sum <- sum + rho
      prev <- rho
    }
  }
  return (M/(1+2*sum))
}

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