rStats.js v1.3.0
    Preparing search index...

    Function optimHess

    • Numerically differentiated Hessian of fn at par, from central differences of the gradient (gr, or the numerical gradient of fn). Equivalent to R's optimHess(). control uses fnscale, parscale and ndeps.

      Parameters

      • par: readonly number[]
      • fn: (par: number[]) => number
      • Optionalgr: (par: number[]) => number[]
      • control: OptimControl = {}

      Returns number[][]

      optimHess([1, 2], (x) => x[0] ** 2 + 3 * x[0] * x[1] + x[1] ** 2); // [[2, 3], [3, 2]]