R/num_InfoI.R

Defines functions num.infoI

Documented in num.infoI

# compute numerical second derivatives involving integrals

num.infoI <- function(coefficients, FUN, X, data,integrate)
{
  FUN <- get(FUN, inherits = TRUE)
  values <- FUN(coefficients, X, data,integrate)
  p <- length(values)
  Info <- matrix(0, p, p)
  h <- rep(0, p)
  delta <- cbind((abs(coefficients) + 1e-012) * 0.0001, rep(1e-012, p))
  delta <- apply(delta, 1, max)
  for(i in 1:p) {
    h[i] <- delta[i]
    new.values <- FUN(coefficients + h, X, data,integrate)
    Info[, i] <- (new.values - values)/delta[i]
    h[i] <- 0
  }
  Info
}

Try the bild package in your browser

Any scripts or data that you put into this service are public.

bild documentation built on Nov. 3, 2023, 5:06 p.m.