hessian: Hessian Matrix In LSTS: Locally Stationary Time Series

Description

Numerical aproximation of the Hessian of a function.

Usage

 1 hessian(f, x0, ...) 

Arguments

 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.

Details

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.

Value

An n \times n matrix of 2nd derivatives, where n is the length of x0.

arima.sim
 1 2 3 4 5 6 7 8 9 # 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) )))))