Numerical Estimation of Sparse Hessians

Estimates Hessian of a scalar-valued function, and returns it in a sparse Matrix format. The sparsity pattern must be known in advance. The algorithm is especially efficient for hierarchical models with a large number of heterogeneous units. See Braun, M. (2017) .


NEWS file for sparseHessianFD package


  • Fix typo in inst/doc/replication.R.


  • Replaced deprecated Matrix package functions rBind and cBind with their rbind and cbind counterparts.


  • References Journal of Statistical Software paper.


  • Modified registration of native routines in src/init.c to be compatible with new Rcpp naming convention.


  • Updated version as accepted at Journal of Statistical Software

  • Explicit registration of native routines, as required by R 3.4.0.


  • Added implementation of the complex step method.

  • Revised vignette.

  • The 'direct' argument to the sparseHessianFD initializer was removed (defunct).


  • An even more major rewrite of the package. All ACM code was removed, and replaced with original R/C++ implementations.

  • The sparseHessianFD class is now implemented as an R reference class, and not as an Rcpp module. The function is deprecated. Instead, use sparseHessianFD to initialize an object. Initialization once again takes place in a single step.

  • The 'direct' computation method has been removed. All computation uses the 'indirect' triangular substitution method. The 'direct' argument in the initializer for the sparseHessianFD class is now deprecated, and remains solely for compatibility with older versions of the package.

  • There is a new vignette with a lot more detail about what the package does and how it works.

  • New matrix helper functions and The function is deprecated. Use the spMatrix or sparseMatrix functions in the Matrix package instead.

  • With the removal of ACM-copyrighted code, this package is now licensed under the MPL 2.0.

VERSION 0.2.0 (Jan. 28, 2015)

  • Essentially a complete re-write of the package.

  • New vignette, using a binary choice model as an example. Functions for this model are in binary.R. Access sample simluated data with data(binary).

  • Documentation written using roxygen2

  • Added unit tests using testthat

  • Core class has been renamed sparseHessianFD. Construction and initialization are now two separate steps.

  • New function is a wrapper around the construction and initialization steps.

  • Deprecated functions in Version 0.2.0

    • new.sparse.hessian.object. Use instead.
    • Use instead, with option symmetric=TRUE.
    • Use the spMatrix function in the Matrix package instead.

VERSION 0.1.1 (Nov. 5, 2013)

  • Removed functions for sampling from, and computing the density of, a multivariate normal distribution. These functions are now available in the sparseMVN package.

VERSION 0.1.0 (Nov. 5, 2012)

  • Initial upload to CRAN.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("sparseHessianFD") by Michael Braun, a year ago

Browse source code at

Authors: Michael Braun [aut, cre, cph]

Documentation:   PDF Manual  

MPL (== 2.0) license

Imports Matrix, methods, Rcpp

Suggests testthat, numDeriv, scales, knitr, xtable, dplyr

Linking to Rcpp, RcppEigen

System requirements: C++11

See at CRAN