Description Usage Arguments Details Value Caution Note Author(s)
Check the gradient provided in a covMan
object.
1 2 3 4 5 |
object |
A |
sym |
Logical. If |
x1 |
Matrix to be used as the first argument of the kernel. |
n1 |
Number of rows for the matrix |
x2 |
Matrix to be used as the second argument of the kernel. |
n2 |
Number of rows for the matrix |
XLower |
Vector of lower bounds to draw |
XUpper |
Vector of upper bounds to draw |
plot |
|
Each of the two matrices x1
and x2
with n1
and
n2
rows can be given or instead be drawn at random. The matrix
of kernel values with dimension c(n1, n2)
is computed, together
with its gradient with dimension c(n1, n2, npar)
where
npar
is the number of parameters of the kernel. A numerical
differentiation w.r.t. the kernel parameters is performed for the
kernel value at x1
and x2
, and the result is compared to
that provided by the kernel function (the function described in the
slot named "kernel"
of object
). Note that the value of
the parameter vector is the value provided by coef(object)
and
it can be changed by using the replacement method `coef<-`
if
needed.
A list of results related to the Jacobians
test
Max of the absolute difference between
the gradient obtained by numeric differentiation and the
gradient provided by the kernel object.
Jnum
, J
Jacobians (arrays) computed
with numDeriv::jacobian
and provided by the kernel
object.
x1
, x2
, K
The matrices used
for the check, and the matrix of kernel values with
dimension c(n1, n2)
. The element x2
can be
NULL
if the determination of the matrix x2
was not necessary.
For now the function only works when object
has class
"covMan"
.
As a rule of thumb, a gradient coded without error gives a value of
test
less than 1e-4
, and usually the value is much
smaller than that.
Yves Deville
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.