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

Revision 766b6821a98ea206fe461d23237bc4a4589c24af authored by Alireza Mahani on 02 November 2022, 10:02:22 UTC, committed by cran-robot on 02 November 2022, 10:02:22 UTC
version 1.2.2
1 parent f1cf3c9
  • Files
  • Changes
  • 19b637c
  • /
  • man
  • /
  • sns.fghEval.numaug.Rd
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.

  • revision
  • directory
  • content
revision badge
swh:1:rev:766b6821a98ea206fe461d23237bc4a4589c24af
directory badge
swh:1:dir:74a72f703d47498b9464d469286c27be2cbaf248
content badge
swh:1:cnt:4f0b2e266ff09f22c30c90ea7876c6c9cb6b43db

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.

  • revision
  • directory
  • content
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
sns.fghEval.numaug.Rd
\name{sns.fghEval.numaug}
\alias{sns.fghEval.numaug}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Utility function for augmentation of a log-density function with numerical gradient and Hessian as needed
}
\description{
Augmenting a log-density with numerical gradient and Hessian, so it can be used by \code{sns} or \code{sns.run}. This augmentation will also be done inside the function, if the value of \code{numderiv} parameter passed to \code{sns} and \code{sns.run} is \code{1} or \code{2}. The advantage of using \code{sns.fghEval.numaug} outside these functions is efficiency, since the agumentation code will not have to be executed in every function call. Users must set \code{numderiv} to \code{0} when calling \code{sns} or \code{sns.run} if calling \code{sns.fghEval.numaug} first. See example.
}
\usage{
sns.fghEval.numaug(fghEval, numderiv = 0
  , numderiv.method = c("Richardson", "simple")
  , numderiv.args = list())
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{fghEval}{Log-density to be sampled from. A valid log-density can have one of 3 forms: 1) return log-density, but no gradient or Hessian, 2) return a list of \code{f} and \code{g} for log-density and its gradient vector, respectively, 3) return a list of \code{f}, \code{g}, and \code{h} for log-density, gradient vector, and Hessian matrix. Missing derivatives are computed numerically.}
  \item{numderiv}{This must be matched with \code{fghEval}: Integer with value from the set \code{0,1,2}. If \code{0}, no numerical differentiation is performed, and thus \code{fghEval} is expected to supply \code{f}, \code{g} and \code{h}. If \code{1}, we expect \code{fghEval} to provide \code{f} amd \code{g}, and Hessian will be calculated numerically. If \code{2}, \code{fghEval} only returns log-density, and numerical differentiation is needed to calculate gradient and Hessian.}
  \item{numderiv.method}{Method used for numeric differentiation. This is passed to the \code{grad} and \code{hessian} functions in \pkg{numDeriv} package. See the package documentation for details.}
  \item{numderiv.args}{Arguments to the numeric differentiation method chosen in \code{numderiv.method}, passed to \code{grad} and \code{hessian} functions in \pkg{numDeriv}. See package documentation for details.}
}

%\details{
%%  ~~ If necessary, more details than the description above ~~
%}

\value{
A function, accepting same arguments as \code{fghEval}, but guaranteed to return the original log-density, plus gradient and Hessian (both of which could possibly by numerically calculated). If \code{numderiv=0}, \code{fghEval} is returned without change. The function will return log-density, gradient and Hessian as elements \code{f}, \code{g} and \code{h} of a list.
}

\references{
Mahani A.S., Hasan A., Jiang M. &  Sharabiani M.T.A. (2016). Stochastic Newton Sampler: The R Package sns. Journal of Statistical Software, Code Snippets, 74(2), 1-33. doi:10.18637/jss.v074.c02
}

\author{
Alireza S. Mahani, Asad Hasan, Marshall Jiang, Mansour T.A. Sharabiani
}

\note{
See package vignette for more details on SNS theory, software, examples, and performance.
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
\code{\link{sns}}, \code{\link{sns.run}}
}

%\examples{
%}

% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
%\keyword{ ~kwd1 }
%\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

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