Description Usage Arguments Details See Also Examples
Evaluates the gradient function of a distribution object and compares it to a numeric gradient computed from the log density function.
1 | check.dist.gradient(ds, x, h=1e-7)
|
ds |
A distribution object with defined log density and gradient functions. |
x |
A point inside the support of |
h |
An offset from |
check.dist.gradient
computes the numeric derivative of
ds$log.density
at x
in each of its coordinates and
compares this to the value returned by ds$grad.log.density
.
If the relative error is greater than 0.001, an error is
reported.
This function can be used when defining a distribution to ensure that the gradient function is implemented correctly.
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.