mySolve {glarma}R Documentation

Matrix Inversion of the Hessian of the Log-Likelihood

Description

Inverts the second derivative matrix of the log-likelihood to obtain the estimated covariance matrix of the parameters.

Usage

mySolve(A)

Arguments

A

Matrix; the negative second derivative of the log-likelihood

Details

mySolve attempts to invert its matrix argument. If the matrix supplied is not invertible, ErrCode is set to 1.

Value

Ainv

inverse of the negative second derivative of the loglikelihood. If the inverse is unable to be obtained, returns the original negative second derivative of the log-likelihood.

ErrCode

Numeric; 0 if the inverse can be found, 1 if not.

Author(s)

"William T.M. Dunsmuir" <w.dunsmuir@unsw.edu.au>

Examples

### Using the polio data
data(Polio)
y <- Polio[, 2]
X <- as.matrix(Polio[, 3:8])

## Construct the vectors of phi lags and theta lags
theta.lags <- c(1, 2, 5)
phi.lags <- rep(0, 0)
## Construct the initial delta vector
delta <- c("Intcpt" = 0.2069383, "Trend" = -4.7986615 ,
           "CosAnnual" = -0.1487333, "SinAnnual" = -0.5318768,
           "CosSemiAnnual" = 0.1690998, "SinSemiAnnual" = -0.4321435,
           "theta_1" = 0, "theta_2"= 0, "theta_5"= 0 )

## Calculate the second derivative of the loglikelihood
glarmamod <- glarmaPoissonPearson(y, X, delta = delta, phiLags = phi.lags,
                           thetaLags = theta.lags, method = "FS")

## estimate the covariance matrix of the estimators from the second
## derivative of the loglikelihood
mySolve(-glarmamod$ll.dd)

[Package glarma version 1.6-0 Index]