#' Estimation of information matrix
#'
#' @param x values of influental variable for the link function
#' @param theta numeric vector of length four with link function's parameters
#' @param lambda [\code{function(theta, x)}]\cr
#' link function for exponential distribution
#' @param gradient [\code{function(x, theta, ...)}]\cr
#' gradient of link function
#' @param type [\code{integer}]\cr
#' if link function is not given a collection of given link function is available, see \code{\link{linkfun}}
#' @return estimated information matrix
estI <- function(x, theta, lambda, gradient, type){
if (missing(gradient)) {
gradient <- gradLambda(type)
}
if (missing(lambda)) {
lambda <- linkfun(type)
}
## gradient of lambda
helper <- function(y, theta){
lambdaValue <- exp(lambda(x = y, theta = theta))
lambdaDot <- drop(gradient(x = y, theta = theta, lambda = lambda))
mat <- 1/lambdaValue^2 * (lambdaDot %*% t(lambdaDot))
return(mat)
}
##1/length(x) * Reduce("+", lapply(x, helper, theta = theta))
Reduce("+", lapply(x, helper, theta = theta))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.