Math {LaplacesDemon}  R Documentation 
Math Utility Functions
Description
These are utility functions for math.
Usage
GaussHermiteQuadRule(N)
Hermite(x, N, prob=TRUE)
logadd(x, add=TRUE)
partial(Model, parm, Data, Interval=1e6, Method="simple")
Arguments
N 
This required argument accepts a positive integer that indicates the number of nodes. 
x 
This is a numeric vector. 
add 
Logical. This defaults to 
Model 
This is a model specification function. For more
information, see 
parm 
This is a vector parameters. 
prob 
Logical. This defaults to 
Data 
This is a list of data. For more information, see

Interval 
This is the interval of numeric differencing. 
Method 
This accepts a quoted string, and defaults to
"simple", which is finitedifferencing. Alternatively

Details
The GaussHermiteQuadRule
function returns nodes and weights for
univariate GaussHermite 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(xy) = \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 finitedifferencing 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 firstorder partial derivatives, and Hessian
, which
returns a matrix of secondorder 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
finitedifferencing with a smaller interval.
Value
logadd
returns the result of \log(x+y)
or
\log(xy)
.
partial
returns a vector of partial derivatives.
Author(s)
Statisticat, LLC. software@bayesianinference.com
See Also
GaussHermiteCubeRule
,
Hessian
,
IterativeQuadrature
,
Jacobian
,
LaplaceApproximation
,
LaplacesDemon
, and
VariationalBayes
.