These are utility functions for math.
GaussHermiteQuadRule(N)
Hermite(x, N, prob=TRUE)
logadd(x, add=TRUE)
partial(Model, parm, Data, Interval=1e-6, Method="simple")
This required argument accepts a positive integer that indicates the number of nodes.
This is a numeric vector.
Logical. This defaults to TRUE
, in which case
\(\log(x+y)\) is performed. Otherwise,
\(\log(x-y)\) is performed.
This is a model specification function. For more
information, see LaplacesDemon
.
This is a vector parameters.
Logical. This defaults to TRUE
, which uses the
probabilist's kernel for the Hermite polynomial. Otherwise,
FALSE
uses the physicist's kernel.
This is a list of data. For more information, see
LaplacesDemon
.
This is the interval of numeric differencing.
This accepts a quoted string, and defaults to
"simple", which is finite-differencing. Alternatively
Method="Richardson"
uses Richardson extrapolation, which
is more accurate, but takes longer to calculate. Another method
called automatic differentiation is currently unsupported, but
is even more accurate, and takes even longer to calculate.
logadd
returns the result of \(\log(x+y)\) or
\(\log(x-y)\).
partial
returns a vector of partial derivatives.
The GaussHermiteQuadRule
function returns nodes and weights for
univariate Gauss-Hermite quadrature. The nodes and weights are
obtained from a tridiagonal eigenvalue problem. Weights are calculated
from the physicist's (rather than the probabilist's) kernel. This has
been adapted from the GaussHermite function in the pracma package. The
GaussHermiteCubeRule
function is a multivariate version.
This is used in the IterativeQuadrature
function.
The Hermite
function evaluates a Hermite polynomial of degree
\(N\) at \(x\), using either the probabilist's (prob=TRUE
)
or physicist's (prob=FALSE
) kernel. This function was adapted
from the hermite
function in package EQL.
The logadd
function performs addition (or subtraction) when the
terms are logarithmic. The equations are:
$$\log(x+y) = \log(x) + \log(1 + \exp(\log(y) - \log(x)))$$ $$\log(x-y) = \log(x) + \log(1 - \exp(\log(y) - \log(x)))$$
The partial
function estimates partial derivatives of
parameters in a model specification with data, using either
forward finite-differencing or Richardson extrapolation. In calculus,
a partial derivative of a function of several variables is its
derivative with respect to one of those variables, with the others
held constant. Related functions include Jacobian
which returns
a matrix of first-order partial derivatives, and Hessian
, which
returns a matrix of second-order partial derivatives of the model
specification function with respect to its parameters. The
partial
function is not intended to be called by the user, but
is used by other functions. This is essentially the grad
function in the numDeriv package, but defaulting to forward
finite-differencing with a smaller interval.
GaussHermiteCubeRule
,
Hessian
,
IterativeQuadrature
,
Jacobian
,
LaplaceApproximation
,
LaplacesDemon
, and
VariationalBayes
.