Learn R Programming

caracas (version 2.1.1)

score_hessian: Score and Hessian matrix

Description

Compute column vector of first derivatives and matrix of second derivatives of univariate function.

Usage

score(expr, vars, simplify = TRUE)

hessian(expr, vars, simplify = TRUE)

Arguments

expr

'caracas expression'.

vars

variables to take derivative with respect to.

simplify

Try to simplify result using simplify(); may be time consuming.

See Also

jacobian(), der()

Examples

Run this code

if (has_sympy()) {
  def_sym(b0, b1, x, x0)
  f <- b0 / (1 + exp(b1*(x-x0)))
  S <- score(f, c(b0, b1))
  S
  H <- hessian(f, c(b0, b1))
  H
}

Run the code above in your browser using DataLab