Description Usage Arguments Details Value Slots Author(s) References Examples

An S4 class to enable forward differentiation of multivariate computations.
Think of ‘madness’ as ‘multivariate automatic differentiation -ness.’
There is also a constructor method for `madness`

objects, and a
wrapper method.

1 2 3 4 5 6 7 8 9 10 11 |

`.Object` |
a |

`val` |
an |

`dvdx` |
a |

`xtag` |
an optional name for the |

`vtag` |
an optional name for the |

`varx` |
an optional variance-covariance matrix of
the independent variable, |

A `madness`

object contains a (multidimensional)
value, and the derivative of that with respect to some independent
variable. The purpose is to simplify computation of multivariate
derivatives, especially for use in the Delta method. Towards this
usage, one may store the covariance of the independent variable
in the object as well, from which the approximate variance-covariance
matrix can easily be computed. See `vcov`

.

Note that derivatives are all implicitly 'flattened'. That is,
when we talk of the derivative of *i x j*
matrix *Y* with respect to *m x n*
matrix *X*, we mean the derivative of the *ij*
vector *vec(Y)* with
respect to the *mn* vector
*vec(X)*. Moreover,
derivatives follow the 'numerator layout' convention:
this derivative is a *ij x mn* matrix
whose first column is the derivative of
*vec(Y)* with respect
to *X_11*. Numerator layout feels unnatural
because it makes a gradient vector of a scalar-valued function
into a row vector. Despite this deficiency, it makes
the product rule feel more natural. (2FIX: is this so?)

An object of class `madness`

.

`val`

an

`array`

of some numeric value. (Note that`array`

includes`matrix`

as a subclass.) The numeric value can have arbitrary dimension.`dvdx`

a

`matrix`

of the derivative of (the vector of)`val`

with respect to some independent variable,*X*. A Derivative is indeed a 2-dimensional matrix. Derivatives have all been 'flattened'. See the details. If not given, defaults to the identity matrix, in which case*val = X*, which is useful to initialization. Note that the derivative is with respect to an 'unrestricted'*X*.`xtag`

an optional name for the

*X*variable. Operations between two objects of the class with distinct`xtag`

data will result in an error, since they are considered to have different independent variables.`vtag`

an optional name for the

*val*variable. This will be propagated forward.`varx`

an optional variance-covariance matrix of the independent variable,

*X*.

Steven E. Pav [email protected]

Petersen, Kaare Brandt and Pedersen, Michael Syskind. "The Matrix Cookbook." Technical University of Denmark (2012). http://www2.imm.dtu.dk/pubdb/p.php?3274

Magnus, Jan R. and Neudecker, H. "Matrix Differential Calculus with Applications in Statistics and Econometrics." 3rd Edition. Wiley Series in Probability and Statistics: Texts and References Section (2007).

1 2 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.