#' Adjusted empirical likelihood for mean
#'
#' Adjusted empirical likelihood for mean
#'
#' @param theta a vector of parameters to be tested.
#' @param x a matrix or vector of data. Each row is an observation vector.
#' @param abstol an optional value for the absolute convergence tolerance. Defaults to 1e-8.
#' @param maxit an optional value for the maximum number of iterations. Defaults to 25.
#'
#' @return An object with S3 class "ael"
#'
#' @examples
#' theta <- 10
#' x <- rnorm(100)
#' ael.mean(theta, x)
#'
#' @import Matrix
#' @export
ael.mean <- function(theta, x, abstol = 1e-8, maxit = 25) {
## Data
x <- as.matrix(x)
if (length(theta) != ncol(x))
stop("length(theta) != ncol(x)")
if (rankMatrix(x) != ncol(x))
stop("model matrix must have full column rank")
colnames(x) <- NULL
n <- nrow(x)
# new data(for AEL)
an <- log(n) / 2
x <- rbind(x, theta - an * (colMeans(x) - theta))
## Result
el.result <- el.mean(theta, x, abstol, maxit)
result <- list()
class(result) <- "ael"
result$logLR <- el.result$logLR
result$logL <- el.result$logL
result$w <- el.result$w
result$lambda <- el.result$lambda
result$iterations <- el.result$iterations
result
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.