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

Raw File Download
Permalink

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
content badge Iframe embedding
swh:1:cnt:6b9a70bcf6307d1bd71c4f838bb483d446da946f
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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
## Hessian, gradient expansion functions for 1-parameter base distributions
#  Useful for GLM and GLM-like models
#  Reference: Theorem A.1 of http://arxiv.org/pdf/1308.0657v1.pdf

### One-parameter distributions
ll_1par_expand <- function(beta,X,y,ll_1par_base) {
  # obtain base distribution derivatives
  ret <- ll_1par_base(X%*%beta,y) 

  # expand base derivatives
  f <- sum(ret$f)
  g <- t(X)%*%ret$g
	xtw <- 0*X
	for (k in 1:ncol(X)) xtw[,k] <- X[,k]*ret$h
	h <- t(xtw)%*%X
  
  return (list(f=f,g=g,h=h))
}

## log-likelihood for base GLM distributions
# Bernoulli distribution with logit link function: y ~ dBern(1/(1+exp(-u))), y=0,1
ll_bern_logit <- function(u,y) {
  eu <- exp(u)
  f <- -log(1+1/eu)-(1-y)*u
  g <- 1/(1+eu)-(1-y)
  h <- -eu/(1+eu)^2
  return (list(f=f,g=g,h=h))
}
# Poisson distribution with log link function: y ~ dPois(exp(u)), y=0,1,2,...
ll_pois_log <- function(u,y) {
  eu <- exp(u)
  f <- y*u-eu - lfactorial(y)
  g <- y-eu
  h <- -eu
  return (list(f=f,g=g,h=h))
}
# exponential distribution with log link function: y ~ dExp(exp(u)), y in [0,+Inf] 
ll_exp_log <- function(u,y) {
  eu <- exp(u)
  f <- u-y*eu
  g <- 1-y*eu
  h <- -y*eu
  return (list(f=f,g=g,h=h))
}
# goemetric distribution with logit link function: y ~ dGeom(1/(1+exp(-u)))
ll_geom_logit <- function(u,y) {
  eu <- exp(u)
  f <- -(y*u+(1+y)*log(1+1/eu))
  g <- -y+(1+y)/(1+eu)
  h <- -(1+y)*eu/(1+eu)^2
  return (list(f=f,g=g,h=h))
}

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