hessian | R Documentation |
Numerical aproximation of the Hessian of a function.
hessian(f, x0, ...)
f |
(type: numeric) name of function that defines log likelihood (or negative of it). |
x0 |
(type: numeric) scalar or vector of parameters that give the point at which you want the hessian estimated (usually will be the mle). |
... |
Additional arguments to be passed to the function. |
Computes the numerical approximation of the Hessian of f
, evaluated at
x0
.
Usually needs to pass additional parameters (e.g. data). N.B. this uses no
numerical sophistication.
An n \times n
matrix of 2nd derivatives, where n
is the length of
x0
.
arima.sim
# Variance of the maximum likelihood estimator for mu parameter in
# gaussian data
loglik <- function(series, x, sd = 1) {
-sum(log(dnorm(series, mean = x, sd = sd)))
}
sqrt(c(var(malleco) / length(malleco), diag(solve(hessian(
f = loglik, x = mean(malleco), series = malleco,
sd = sd(malleco)
)))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.