Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

grad

gradient function (internal function)


Description

Numerical gradient for a function at a given value (internal).

Usage

grad(func, x, ...)

Arguments

func

Function taking a vector argument x (returns a vector of length>=1)

x

vector of arguments for where the gradient is wanted.

...

other arguments to the function

Details

(func(x+delta,...)-func(x-delta,...))/(2 delta) where delta is the third root of the machine precision times pmax(1,abs(x)).

Value

A vector if func(x) has length 1, otherwise a matrix with rows for x and columns for func(x).

Author(s)

Mark Clements.

See Also

numDelta()


rstpm2

Smooth Survival Models, Including Generalized Survival Models

v1.5.2
GPL-2 | GPL-3
Authors
Mark Clements [aut, cre], Xing-Rong Liu [aut], Benjamin Christoffersen [aut], Paul Lambert [ctb], Lasse Hjort Jakobsen [ctb], Alessandro Gasparini [ctb], Gordon Smyth [cph], Patrick Alken [cph], Simon Wood [cph], Rhys Ulerich [cph]
Initial release
2021-02-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.