| Title: | Multiple Empirical Likelihood Tests |
|---|---|
| Description: | Performs multiple empirical likelihood tests. It offers an easy-to-use interface and flexibility in specifying hypotheses and calibration methods, extending the framework to simultaneous inferences. The core computational routines are implemented using the 'Eigen' 'C++' library and 'RcppEigen' interface, with 'OpenMP' for parallel computation. Details of the testing procedures are provided in Kim, MacEachern, and Peruggia (2023) <doi:10.1080/10485252.2023.2206919>. A companion paper by Kim, MacEachern, and Peruggia (2024) <doi:10.18637/jss.v108.i05> is available for further information. This work was supported by the U.S. National Science Foundation under Grants No. SES-1921523 and DMS-2015552. |
| Authors: | Eunseop Kim [aut, cph, cre], Steven MacEachern [ctb, ths], Mario Peruggia [ctb, ths], Pierre Chausse [rev], Alex Stringer [rev] |
| Maintainer: | Eunseop Kim <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.11.4 |
| Built: | 2025-09-28 06:23:47 UTC |
| Source: | https://github.com/ropensci/melt |
S4 class for constrained empirical likelihood. It inherits from
EL class. Note that the optim slot has constrained
optimization results with respect to the parameters, not the Lagrange
multiplier.
Let denote minus twice the empirical log-likelihood
ratio function. We consider a linear hypothesis of the form
where the left-hand-side is a by
matrix and the right-hand-side is a -dimensional
vector. Under some regularity conditions, converges in
distribution to under the constraint of hypothesis, i.e.,
Minimization of with respect to is
computationally expensive since it implicitly involves the
evaluation step as described in EL. Further, depending on the
form of and the constraint, the optimization problem
can be nonconvex and have multiple local minima. For this reason, the
package melt only considers linear hypotheses and performs local
minimization of using projected gradient descent method.
With the orthogonal projection matrix and a step size ,
the algorithm updates as
where denotes the gradient of at
. The first order optimality condition is
, which is used as the stopping criterion.
optimA list of the following optimization results:
par A numeric vector of the solution to the constrained optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
logpA numeric vector of the log probabilities of the constrained empirical likelihood.
loglA single numeric of the constrained empirical log-likelihood.
loglrA single numeric of the constrained empirical log-likelihood ratio.
statisticA single numeric of minus twice the constrained empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightsA numeric vector of the re-scaled weights used for the model fitting.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
dataA numeric matrix of the data for the model fitting.
controlAn object of class ControlEL constructed by
el_control().
Adimari G, Guolo A (2010). “A Note on the Asymptotic Behaviour of Empirical Likelihood Statistics.” Statistical Methods & Applications, 19(4), 463–476. doi:10.1007/s10260-010-0137-9.
Qin J, Lawless J (1995). “Estimating Equations, Empirical Likelihood and Constraints on Parameters.” Canadian Journal of Statistics, 23(2), 145–159. doi:10.2307/3315441.
showClass("CEL")showClass("CEL")
Extracts the chi-square statistic from a model.
## S4 method for signature 'EL' chisq(object, ...) ## S4 method for signature 'ELMT' chisq(object, ...) ## S4 method for signature 'ELT' chisq(object, ...) ## S4 method for signature 'SummaryEL' chisq(object, ...) ## S4 method for signature 'SummaryELMT' chisq(object, ...) ## S4 method for signature 'SummaryELT' chisq(object, ...) ## S4 method for signature 'SummaryLM' chisq(object, ...)## S4 method for signature 'EL' chisq(object, ...) ## S4 method for signature 'ELMT' chisq(object, ...) ## S4 method for signature 'ELT' chisq(object, ...) ## S4 method for signature 'SummaryEL' chisq(object, ...) ## S4 method for signature 'SummaryELMT' chisq(object, ...) ## S4 method for signature 'SummaryELT' chisq(object, ...) ## S4 method for signature 'SummaryLM' chisq(object, ...)
object |
An object that contains the chi-square statistic. |
... |
Further arguments passed to methods. |
The form of the value returned by chisq() depends on the class of
its argument.
chisq(EL): Extracts the chi-square statistic.
chisq(ELMT): Extracts the vector of chi-square statistics.
chisq(ELT): Extracts the chi-square statistic.
chisq(SummaryEL): Extracts the chi-square statistic.
chisq(SummaryELMT): Extracts the vector of chi-square statistics.
chisq(SummaryELT): Extracts the chi-square statistic.
chisq(SummaryLM): Extracts the chi-square statistic for the overall test of
the model.
data("precip") fit <- el_mean(precip, par = 40) chisq(fit)data("precip") fit <- el_mean(precip, par = 40) chisq(fit)
A dataset summarizing field experiments result of seed treatments on clothianidin concentration.
data("clothianidin")data("clothianidin")
A data frame with 102 observations and 3 variables:
New blocks constructed from original data. The format is 'days post planting_original block_year'.
Seed treatment.
Log transformed clothianidin concentration (µg).
The original data is provided by Alford and Krupke (2017). Only some of the shoot region observations are taken from the original data and processed for illustration.
Alford A, Krupke CH (2017). “Translocation of the Neonicotinoid Seed Treatment Clothianidin in Maize.” PLOS ONE, 12(3), 1–19. doi:10.1371/journal.pone.0173836.
data("clothianidin") clothianidindata("clothianidin") clothianidin
Extracts the maximum empirical likelihood estimates from a model.
## S4 method for signature 'EL' coef(object, ...) ## S4 method for signature 'ELMT' coef(object, ...) ## S4 method for signature 'SummaryEL' coef(object, ...) ## S4 method for signature 'SummaryLM' coef(object, ...)## S4 method for signature 'EL' coef(object, ...) ## S4 method for signature 'ELMT' coef(object, ...) ## S4 method for signature 'SummaryEL' coef(object, ...) ## S4 method for signature 'SummaryLM' coef(object, ...)
object |
An object that contains the maximum empirical likelihood estimates. |
... |
Further arguments passed to methods. |
The form of the value returned by coef() depends on the class of
its argument.
coef(EL): Extracts the numeric vector of the maximum empirical
likelihood estimates.
coef(ELMT): Extracts the list of numeric vectors of the maximum
empirical likelihood estimates. Each element of the list corresponds to a
distinct hypothesis.
coef(SummaryEL): Extracts the numeric vector of the maximum empirical
likelihood estimates.
coef(SummaryLM): Extracts a matrix with the results of significance tests.
data("mtcars") fit <- el_lm(mpg ~ wt, data = mtcars) coef(fit)data("mtcars") fit <- el_lm(mpg ~ wt, data = mtcars) coef(fit)
Computes confidence intervals for one or more parameters in a model.
## S4 method for signature 'EL' confint(object, parm, level = 0.95, cv = NULL, control = NULL) ## S4 method for signature 'ELMT' confint(object, cv = NULL, control = NULL)## S4 method for signature 'EL' confint(object, parm, level = 0.95, cv = NULL, control = NULL) ## S4 method for signature 'ELMT' confint(object, cv = NULL, control = NULL)
object |
|
parm |
A specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered. |
level |
A single numeric for the confidence level required. Defaults to
|
cv |
A single numeric for the critical value for calibration of
empirical likelihood ratio statistic. Defaults to |
control |
An object of class ControlEL constructed by
|
A matrix with columns giving lower and upper confidence limits for
each parameter. In contrast to other methods that rely on studentization,
the lower and upper limits obtained from empirical likelihood do not
correspond to the (1 - level) / 2 and 1 - (1 - level) / 2 in %,
respectively.
Owen A (1990). “Empirical Likelihood Ratio Confidence Regions.” The Annals of Statistics, 18(1), 90–120. doi:10.1214/aos/1176347494.
EL, ELMT, confreg(), elt(),
el_control()
data("mtcars") fit <- el_lm(mpg ~ ., data = mtcars) confint(fit, parm = c(2, 3))data("mtcars") fit <- el_lm(mpg ~ ., data = mtcars) confint(fit, parm = c(2, 3))
Computes boundary points of a two-dimensional confidence region for model parameters.
## S4 method for signature 'EL' confreg(object, parm, level = 0.95, cv = NULL, npoints = 50L, control = NULL)## S4 method for signature 'EL' confreg(object, parm, level = 0.95, cv = NULL, npoints = 50L, control = NULL)
object |
An object that inherits from EL. |
parm |
A specification of which parameters are to be given a confidence
region, either a vector of numbers or a vector of names. It must be a
vector of length two of the form |
level |
A single numeric for the confidence level required. Defaults to
|
cv |
A single numeric for the critical value for calibration of
empirical likelihood ratio statistic. Defaults to NULL and set to
|
npoints |
A single integer for the number of boundary points to compute.
Defaults to |
control |
An object of class ControlEL constructed by
|
An object of class ConfregEL.
Owen A (1990). “Empirical Likelihood Ratio Confidence Regions.” The Annals of Statistics, 18(1), 90–120. doi:10.1214/aos/1176347494.
EL, confint(), elt(), plot(), el_control()
data("mtcars") fit <- el_lm(mpg ~ wt + qsec, data = mtcars) cr <- confreg(fit, parm = c(2, 3), cv = qchisq(0.90, 2)) plot(cr)data("mtcars") fit <- el_lm(mpg ~ wt + qsec, data = mtcars) cr <- confreg(fit, parm = c(2, 3), cv = qchisq(0.90, 2)) plot(cr)
S4 class for confidence region. It inherits from "matrix".
estimatesA numeric vector of length two for the parameter estimates.
levelA single numeric for the confidence level required.
cvA single numeric for the critical value for calibration of empirical likelihood ratio statistic.
pnamesA character vector of length two for the name of parameters.
showClass("ConfregEL")showClass("ConfregEL")
S4 class for computational details of empirical likelihood.
maxitA single integer for the maximum number of iterations for the
optimization with respect to .
maxit_lA single integer for the maximum number of iterations for the
optimization with respect to .
tolA single numeric for the convergence tolerance denoted by
. The iteration stops when
tol_lA single numeric for the relative convergence tolerance denoted
by . The iteration stops when
stepA single numeric for the step size for the projected
gradient descent method.
thA single numeric for the threshold for the negative empirical log-likelihood ratio.
verboseA single logical for whether to print a message on the convergence status.
keep_dataA single logical for whether to keep the data used for fitting model objects.
nthreadsA single integer for the number of threads for parallel computation via OpenMP (if available).
seedA single integer for the seed for random number generation.
anA single numeric representing the scaling factor for adjusted empirical likelihood calibration.
bA single integer for the number of bootstrap replicates.
mA single integer for the number of Monte Carlo samples.
showClass("ControlEL")showClass("ControlEL")
Extracts the convergence status from a model.
## S4 method for signature 'CEL' conv(object, ...) ## S4 method for signature 'EL' conv(object, ...) ## S4 method for signature 'ELT' conv(object, ...) ## S4 method for signature 'SummaryEL' conv(object, ...) ## S4 method for signature 'SummaryELT' conv(object, ...) ## S4 method for signature 'SummaryLM' conv(object, ...)## S4 method for signature 'CEL' conv(object, ...) ## S4 method for signature 'EL' conv(object, ...) ## S4 method for signature 'ELT' conv(object, ...) ## S4 method for signature 'SummaryEL' conv(object, ...) ## S4 method for signature 'SummaryELT' conv(object, ...) ## S4 method for signature 'SummaryLM' conv(object, ...)
object |
An object that contains the convergence status. |
... |
Further arguments passed to methods. |
A single logical.
conv(CEL): Extracts the convergence status of the model with respect to
the parameter.
conv(EL): Extracts the convergence status of the model with respect to
the Lagrange multiplier.
conv(ELT): Extracts the convergence status of the test with respect to
the parameter (or the Lagrange multiplier if the argument lhs is NULL).
conv(SummaryEL): Extracts the convergence status of the model with respect to
the Lagrange multiplier.
conv(SummaryELT): Extracts the convergence status of the test with respect to
the parameter (or the Lagrange multiplier if the argument lhs is NULL).
conv(SummaryLM): Extracts the convergence status of the model. See the
documentation of EL and CEL.
CEL, EL, ELT, getOptim()
## Convergence check for the overall model test data("mtcars") fit <- el_lm(mpg ~ ., data = mtcars) conv(fit)## Convergence check for the overall model test data("mtcars") fit <- el_lm(mpg ~ ., data = mtcars) conv(fit)
Extracts the critical value from a model.
## S4 method for signature 'ELMT' critVal(object, ...) ## S4 method for signature 'ELT' critVal(object, ...) ## S4 method for signature 'SummaryELMT' critVal(object, ...) ## S4 method for signature 'SummaryELT' critVal(object, ...)## S4 method for signature 'ELMT' critVal(object, ...) ## S4 method for signature 'ELT' critVal(object, ...) ## S4 method for signature 'SummaryELMT' critVal(object, ...) ## S4 method for signature 'SummaryELT' critVal(object, ...)
object |
An object that contains the critical value. |
... |
Further arguments passed to methods. |
A single numeric.
## F-calibrated critical value data("precip") fit <- el_mean(precip, 30) elt <- elt(fit, rhs = 34, calibrate = "f") critVal(elt)## F-calibrated critical value data("precip") fit <- el_mean(precip, 30) elt <- elt(fit, rhs = 34, calibrate = "f") critVal(elt)
Specifies computational details of (constrained) empirical likelihood.
el_control( maxit = 200L, maxit_l = 25L, tol = 1e-06, tol_l = 1e-06, step = NULL, th = NULL, verbose = FALSE, keep_data = TRUE, nthreads, seed = NULL, an = NULL, b = 10000L, m = 1000000L )el_control( maxit = 200L, maxit_l = 25L, tol = 1e-06, tol_l = 1e-06, step = NULL, th = NULL, verbose = FALSE, keep_data = TRUE, nthreads, seed = NULL, an = NULL, b = 10000L, m = 1000000L )
maxit |
A single integer for the maximum number of iterations for
constrained minimization of empirical likelihood. Defaults to |
maxit_l |
A single integer for the maximum number of iterations for
evaluation of empirical likelihood. Defaults to |
tol |
A single numeric for the convergence tolerance for the constrained
minimization. Defaults to |
tol_l |
A single numeric for the relative convergence tolerance for the
evaluation. Defaults to |
step |
A single numeric for the step size for projected gradient descent
method. Defaults to |
th |
A single numeric for the threshold for the negative empirical
log-likelihood ratio. The iteration stops if the value exceeds the
threshold. Defaults to |
verbose |
A single logical. If |
keep_data |
A single logical. If |
nthreads |
A single integer for the number of threads for parallel
computation via OpenMP (if available). Defaults to half the available
threads. For better performance, it is generally recommended in most
platforms to limit the number of threads to the number of physical cores.
Note that it applies to the following functions that involve multiple
evaluations or optimizations: |
seed |
A single integer for the seed for random number generation. It
only applies to |
an |
A single numeric representing the scaling factor for adjusted
empirical likelihood calibration. It only applies to |
b |
A single integer for the number of bootstrap replicates. It only
applies to |
m |
A single integer for the number of Monte Carlo samples. It only
applies to |
An object of class of ControlEL.
optcfg <- el_control(maxit = 300, step = 0.01, th = 200, nthreads = 1)optcfg <- el_control(maxit = 300, step = 0.01, th = 200, nthreads = 1)
Computes empirical likelihood with general estimating functions.
el_eval(g, weights = NULL, control = el_control())el_eval(g, weights = NULL, control = el_control())
g |
A numeric matrix, or an object that can be coerced to a numeric matrix. Each row corresponds to an observation of an estimating function. The number of rows must be greater than the number of columns. |
weights |
An optional numeric vector of weights to be used in the
fitting process. The length of the vector must be the same as the number of
rows in |
control |
An object of class ControlEL constructed by
|
Let be independent and identically distributed
-dimensional random variable from an unknown distribution
for . We assume that has a positive definite
covariance matrix. For a parameter of interest
, consider a -dimensional smooth
estimating function with a moment condition
We assume that there exists an unique that solves the above
equation. Given a value of , the (profile) empirical likelihood
ratio is defined by
el_mean() computes the empirical log-likelihood ratio statistic
with the by numeric matrix g,
whose th row is . Since the estimating function
can be arbitrary, el_eval() does not return an object of class
EL, and the associated generics and methods are not
applicable.
A list of the following optimization results:
optim A list with the following optimization results:
lambda A numeric vector of the Lagrange multipliers of the dual
problem.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
logp A numeric vector of the log probabilities of the empirical
likelihood.
logl A single numeric of the empirical log-likelihood.
loglr A single numeric of the empirical log-likelihood ratio.
statistic A single numeric of minus twice the empirical log-likelihood
ratio with an asymptotic chi-square distribution.
df A single integer for the degrees of freedom of the statistic.
pval A single numeric for the -value of the statistic.
nobs A single integer for the number of observations.
npar A single integer for the number of parameters.
weights A numeric vector of the re-scaled weights used for the model
fitting.
Qin J, Lawless J (1994). “Empirical Likelihood and General Estimating Equations.” The Annals of Statistics, 22(1), 300–325. doi:10.1214/aos/1176325370.
set.seed(123526) mu <- 0 sigma <- 1 x <- rnorm(100) g <- matrix(c(x - mu, (x - mu)^2 - sigma^2), ncol = 2) el_eval(g, weights = rep(c(1, 2), each = 50))set.seed(123526) mu <- 0 sigma <- 1 x <- rnorm(100) g <- matrix(c(x - mu, (x - mu)^2 - sigma^2), ncol = 2) el_eval(g, weights = rep(c(1, 2), each = 50))
Fits a generalized linear model with empirical likelihood.
el_glm( formula, family = gaussian, data, weights = NULL, na.action, start = NULL, etastart = NULL, mustart = NULL, offset, control = el_control(), ... )el_glm( formula, family = gaussian, data, weights = NULL, na.action, start = NULL, etastart = NULL, mustart = NULL, offset, control = el_control(), ... )
formula |
An object of class |
family |
A description of the error distribution and link function to be used in the model. Only the result of a call to a family function is supported. See ‘Details’. |
data |
An optional data frame, list or environment (or object coercible
by |
weights |
An optional numeric vector of weights to be used in the
fitting process. Defaults to |
na.action |
A function which indicates what should happen when the data
contain |
start |
Starting values for the parameters in the linear predictor.
Defaults to |
etastart |
Starting values for the linear predictor. Defaults to |
mustart |
Starting values for the vector of means. Defaults to |
offset |
An optional expression for specifying an a priori known
component to be included in the linear predictor during fitting. This
should be |
control |
An object of class ControlEL constructed by
|
... |
Additional arguments to be passed to |
Suppose that we observe independent random variables
from a common distribution, where
is the -dimensional covariate (including the intercept if any) and
is the response. A generalized linear model specifies that
,
, and
,
where is an unknown
-dimensional parameter, is an optional dispersion
parameter, is a known smooth link function, and is a known
variance function.
With denoting the inverse link function, define the quasi-score
Then we have the estimating equations
.
When is known, the (profile) empirical likelihood ratio for a
given is defined by
With unknown , we introduce another estimating function based on
the squared residuals. Let and
Now the empirical likelihood ratio is defined by
el_glm() first computes the parameter estimates by calling glm.fit()
(with ... if any) with the model.frame and model.matrix obtained from
the formula. Note that the maximum empirical likelihood estimator is the
same as the the quasi-maximum likelihood estimator in our model. Next, it
tests hypotheses based on asymptotic chi-square distributions of the
empirical likelihood ratio statistics. Included in the tests are overall
test with
and significance tests for each parameter with
The available families and link functions are as follows:
gaussian: "identity", "log", and "inverse".
binomial: "logit", "probit", and "log".
poisson: "log", "identity", and "sqrt".
quasipoisson: "log", "identity", and "sqrt".
An object of class of GLM.
Chen SX, Cui H (2003). “An Extended Empirical Likelihood for Generalized Linear Models.” Statistica Sinica, 13(1), 69–81.
Kolaczyk ED (1994). “Empirical Likelihood for Generalized Linear Models.” Statistica Sinica, 4(1), 199–218.
EL, GLM, el_lm(), elt(),
el_control()
data("warpbreaks") fit <- el_glm(wool ~ ., family = binomial, data = warpbreaks, weights = NULL, na.action = na.omit, start = NULL, etastart = NULL, mustart = NULL, offset = NULL ) summary(fit)data("warpbreaks") fit <- el_glm(wool ~ ., family = binomial, data = warpbreaks, weights = NULL, na.action = na.omit, start = NULL, etastart = NULL, mustart = NULL, offset = NULL ) summary(fit)
Fits a linear model with empirical likelihood.
el_lm( formula, data, weights = NULL, na.action, offset, control = el_control(), ... )el_lm( formula, data, weights = NULL, na.action, offset, control = el_control(), ... )
formula |
An object of class |
data |
An optional data frame, list or environment (or object coercible
by |
weights |
An optional numeric vector of weights to be used in the
fitting process. Defaults to |
na.action |
A function which indicates what should happen when the data
contain |
offset |
An optional expression for specifying an a priori known
component to be included in the linear predictor during fitting. This
should be |
control |
An object of class ControlEL constructed by
|
... |
Additional arguments to be passed to the low level regression fitting functions. See ‘Details’. |
Suppose that we observe independent random variables
from a common distribution, where
is the -dimensional covariate (including the intercept if any) and
is the response. We consider the following linear model:
where is an unknown
-dimensional parameter and the errors are
independent random variables that satisfy
= 0. We assume that the errors have
finite conditional variances. Then the least square estimator of
solves the following estimating equations:
Given a value of , let
and the (profile)
empirical likelihood ratio is defined by
el_lm() first computes the parameter estimates by calling lm.fit()
(with ... if any) with the model.frame and model.matrix obtained from
the formula. Note that the maximum empirical likelihood estimator is the
same as the the quasi-maximum likelihood estimator in our model. Next, it
tests hypotheses based on asymptotic chi-square distributions of the
empirical likelihood ratio statistics. Included in the tests are overall
test with
and significance tests for each parameter with
An object of class of LM.
Owen A (1991). “Empirical Likelihood for Linear Models.” The Annals of Statistics, 19(4), 1725–1747. doi:10.1214/aos/1176348368.
EL, LM, el_glm(), elt(),
el_control()
## Linear model data("thiamethoxam") fit <- el_lm(fruit ~ trt, data = thiamethoxam) summary(fit) ## Weighted data wfit <- el_lm(fruit ~ trt, data = thiamethoxam, weights = visit) summary(wfit) ## Missing data fit2 <- el_lm(fruit ~ trt + scb, data = thiamethoxam, na.action = na.omit, offset = NULL ) summary(fit2)## Linear model data("thiamethoxam") fit <- el_lm(fruit ~ trt, data = thiamethoxam) summary(fit) ## Weighted data wfit <- el_lm(fruit ~ trt, data = thiamethoxam, weights = visit) summary(wfit) ## Missing data fit2 <- el_lm(fruit ~ trt + scb, data = thiamethoxam, na.action = na.omit, offset = NULL ) summary(fit2)
Computes empirical likelihood for the mean.
el_mean(x, par, weights = NULL, control = el_control())el_mean(x, par, weights = NULL, control = el_control())
x |
A numeric matrix, or an object that can be coerced to a numeric matrix. Each row corresponds to an observation. The number of rows must be greater than the number of columns. |
par |
A numeric vector of parameter values to be tested. The length of
the vector must be the same as the number of columns in |
weights |
An optional numeric vector of weights to be used in the
fitting process. The length of the vector must be the same as the number of
rows in |
control |
An object of class ControlEL constructed by
|
Let be independent and identically distributed
-dimensional random variable from an unknown distribution
for . We assume that and that has a positive definite
covariance matrix. Given a value of , the (profile) empirical
likelihood ratio is defined by
el_mean() computes the empirical log-likelihood ratio statistic
, along with other values in EL.
An object of class EL.
Owen A (1990). “Empirical Likelihood Ratio Confidence Regions.” The Annals of Statistics, 18(1), 90–120. doi:10.1214/aos/1176347494.
EL, elt(), el_eval(), el_control()
## Scalar mean data("precip") fit <- el_mean(precip, 30) fit summary(fit) ## Vector mean data("faithful") fit2 <- el_mean(faithful, par = c(3.5, 70)) summary(fit2) ## Weighted data w <- rep(c(1, 2), each = nrow(faithful) / 2) fit3 <- el_mean(faithful, par = c(3.5, 70), weights = w) summary(fit3)## Scalar mean data("precip") fit <- el_mean(precip, 30) fit summary(fit) ## Vector mean data("faithful") fit2 <- el_mean(faithful, par = c(3.5, 70)) summary(fit2) ## Weighted data w <- rep(c(1, 2), each = nrow(faithful) / 2) fit3 <- el_mean(faithful, par = c(3.5, 70), weights = w) summary(fit3)
Computes empirical likelihood for the standard deviation.
el_sd(x, mean, sd, weights = NULL, control = el_control())el_sd(x, mean, sd, weights = NULL, control = el_control())
x |
A numeric vector, or an object that can be coerced to a numeric vector. |
mean |
A single numeric for the (known) mean value. |
sd |
A positive single numeric for the parameter value to be tested. |
weights |
An optional numeric vector of weights to be used in the
fitting process. The length of the vector must be the same as the length of
|
control |
An object of class ControlEL constructed by
|
Let be independent and identically random variable from an
unknown distribution for . We assume that
is known and that has a variance
. Given a value of , the
(profile) empirical likelihood ratio is defined by
el_sd() computes the empirical log-likelihood ratio statistic
, along with other values in SD.
An object of class SD.
EL, SD, el_mean(), elt(),
el_control()
data("women") x <- women$height w <- women$weight fit <- el_sd(x, mean = 65, sd = 5, weights = w) fit summary(fit)data("women") x <- women$height w <- women$weight fit <- el_sd(x, mean = 65, sd = 5, weights = w) fit summary(fit)
S4 class for empirical likelihood.
Let be independent and identically distributed
-dimensional random variable from an unknown distribution
for . We assume that has a positive definite
covariance matrix. For a parameter of interest
, consider a -dimensional smooth
estimating function with a moment condition
We assume that there exists an unique that solves the above
equation. Given a value of , the (profile) empirical likelihood
ratio is defined by
The Lagrange multiplier of the dual
problem leads to
where solves
Then the empirical log-likelihood ratio is given by
This problem can be efficiently solved by the Newton-Raphson method when
the zero vector is contained in the interior of the convex hull of
.
It is known that converges in
distribution to , where has a chi-square
distribution with degrees of freedom. See the references below for
more details.
optimA list of the following optimization results:
par A numeric vector of the specified parameters.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
logpA numeric vector of the log probabilities of the empirical likelihood.
loglA single numeric of the empirical log-likelihood.
loglrA single numeric of the empirical log-likelihood ratio.
statisticA single numeric of minus twice the empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightsA numeric vector of the re-scaled weights used for the model fitting.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
dataA numeric matrix of the data for the model fitting.
controlAn object of class ControlEL constructed by
el_control().
Owen A (2001). Empirical Likelihood. Chapman & Hall/CRC. doi:10.1201/9781420036152.
Qin J, Lawless J (1994). “Empirical Likelihood and General Estimating Equations.” The Annals of Statistics, 22(1), 300–325. doi:10.1214/aos/1176325370.
showClass("EL")showClass("EL")
Computes empirical likelihood displacement for model diagnostics and outlier detection.
## S4 method for signature 'EL' eld(object, control = NULL) ## S4 method for signature 'GLM' eld(object, control = NULL)## S4 method for signature 'EL' eld(object, control = NULL) ## S4 method for signature 'GLM' eld(object, control = NULL)
object |
An object that inherits from EL. |
control |
An object of class ControlEL constructed by
|
Let be the empirical log-likelihood function based
on the full sample with observations. The maximum empirical
likelihood estimate is denoted by . Consider a reduced
sample with the th observation deleted and the corresponding
estimate . The empirical likelihood displacement is
defined by
If is large, then the th observation is an
influential point and can be inspected as a possible outlier. eld
computes for .
An object of class ELD.
Lazar NA (2005). “Assessing the Effect of Individual Data Points on Inference From Empirical Likelihood.” Journal of Computational and Graphical Statistics, 14(3), 626–642. doi:10.1198/106186005X59568.
Zhu H, Ibrahim JG, Tang N, Zhang H (2008). “Diagnostic Measures for Empirical Likelihood of General Estimating Equations.” Biometrika, 95(2), 489–507. doi:10.1093/biomet/asm094.
EL, ELD, el_control(), plot()
data("precip") fit <- el_mean(precip, par = 30) eld <- eld(fit) plot(eld)data("precip") fit <- el_mean(precip, par = 30) eld <- eld(fit) plot(eld)
Tests multiple linear hypotheses simultaneously.
## S4 method for signature 'EL' elmt(object, rhs = NULL, lhs = NULL, alpha = 0.05, control = NULL)## S4 method for signature 'EL' elmt(object, rhs = NULL, lhs = NULL, alpha = 0.05, control = NULL)
object |
An object that inherits from EL. |
rhs |
A numeric vector (column matrix) or a list of numeric vectors for
the right-hand sides of hypotheses. Defaults to |
lhs |
A list or a numeric matrix for the left-hand sides of hypotheses.
For a list |
alpha |
A single numeric for the overall significance level. Defaults to
|
control |
An object of class ControlEL constructed by
|
elmt() tests multiple hypotheses simultaneously. Each hypothesis
corresponds to the constrained empirical likelihood ratio described in
CEL. rhs and lhs cannot be both NULL. The right-hand
side and left-hand side of each hypothesis must be specified as described
in elt().
For specifying linear contrasts more conveniently, rhs and lhs also
take a numeric vector and a numeric matrix, respectively. Each element of
rhs and each row of lhs correspond to a contrast (hypothesis).
The vector of empirical likelihood ratio statistics asymptotically follows
a multivariate chi-square distribution under the complete null hypothesis.
The multiple testing procedure asymptotically controls the family-wise
error rate at the level alpha. Based on the distribution of the maximum
of the test statistics, the adjusted p-values are estimated by Monte Carlo
simulation.
An object of class of ELMT.
Kim E, MacEachern SN, Peruggia M (2023). “Empirical likelihood for the analysis of experimental designs.” Journal of Nonparametric Statistics, 35(4), 709–732. doi:10.1080/10485252.2023.2206919.
Kim E, MacEachern SN, Peruggia M (2024). “melt: Multiple Empirical Likelihood Tests in R.” Journal of Statistical Software, 108(5), 1–33. doi:10.18637/jss.v108.i05.
EL, ELMT, elt(), el_control()
## Bivariate mean (list `rhs` & no `lhs`) set.seed(143) data("women") fit <- el_mean(women, par = c(65, 135)) rhs <- list(c(64, 133), c(66, 140)) elmt(fit, rhs = rhs) ## Pairwise comparison (no `rhs` & list `lhs`) data("clothianidin") fit2 <- el_lm(clo ~ -1 + trt, clothianidin) lhs2 <- list( "trtNaked - trtFungicide", "trtFungicide - trtLow", "trtLow - trtHigh" ) elmt(fit2, lhs = lhs2) ## Arbitrary hypotheses (list `rhs` & list `lhs`) data("mtcars") fit3 <- el_lm(mpg ~ wt + qsec, data = mtcars) lhs3 <- list(c(1, 4, 0), rbind(c(0, 1, 0), c(0, 0, 1))) rhs3 <- list(0, c(-6, 1)) elmt(fit3, rhs = rhs3, lhs = lhs3)## Bivariate mean (list `rhs` & no `lhs`) set.seed(143) data("women") fit <- el_mean(women, par = c(65, 135)) rhs <- list(c(64, 133), c(66, 140)) elmt(fit, rhs = rhs) ## Pairwise comparison (no `rhs` & list `lhs`) data("clothianidin") fit2 <- el_lm(clo ~ -1 + trt, clothianidin) lhs2 <- list( "trtNaked - trtFungicide", "trtFungicide - trtLow", "trtLow - trtHigh" ) elmt(fit2, lhs = lhs2) ## Arbitrary hypotheses (list `rhs` & list `lhs`) data("mtcars") fit3 <- el_lm(mpg ~ wt + qsec, data = mtcars) lhs3 <- list(c(1, 4, 0), rbind(c(0, 1, 0), c(0, 0, 1))) rhs3 <- list(0, c(-6, 1)) elmt(fit3, rhs = rhs3, lhs = lhs3)
S4 class for empirical likelihood multiple tests.
estimatesA list of numeric vectors of the estimates of the linear hypotheses.
statisticA numeric vector of minus twice the (constrained) empirical log-likelihood ratios with asymptotic chi-square distributions.
dfAn integer vector of the marginal degrees of freedom of the statistic.
pvalA numeric vector for the multiplicity adjusted -values.
cvA single numeric for the multiplicity adjusted critical value.
rhsA numeric vector for the right-hand sides of the hypotheses.
lhsA numeric matrix for the left-hand side of the hypotheses.
alphaA single numeric for the overall significance level.
calibrateA single character for the calibration method used.
weightsA numeric vector of the re-scaled weights used for the model fitting.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
dataA numeric matrix of the data for the model fitting.
controlAn object of class ControlEL constructed by
el_control().
showClass("ELMT")showClass("ELMT")
Tests a linear hypothesis with various calibration options.
## S4 method for signature 'EL' elt( object, rhs = NULL, lhs = NULL, alpha = 0.05, calibrate = "chisq", control = NULL )## S4 method for signature 'EL' elt( object, rhs = NULL, lhs = NULL, alpha = 0.05, calibrate = "chisq", control = NULL )
object |
An object that inherits from EL. |
rhs |
A numeric vector or a column matrix for the right-hand side of
hypothesis, with as many entries as the rows in |
lhs |
A numeric matrix or a vector (treated as a row matrix) for the
left-hand side of a hypothesis. Each row gives a linear combination of the
parameters in |
alpha |
A single numeric for the significance level. Defaults to |
calibrate |
A single character representing the calibration method. It
is case-insensitive and must be one of |
control |
An object of class ControlEL constructed by
|
elt() performs the constrained minimization of
described in CEL. rhs and lhs cannot be both NULL. For
non-NULL lhs, it is required that lhs have full row rank
and be equal to the number of parameters in the
object.
Depending on the specification of rhs and lhs, we have the following
three cases:
If both rhs and lhs are non-NULL, the constrained minimization
is performed with the right-hand side and the left-hand side
as
If rhs is NULL, is set to the zero vector as
.
If lhs is NULL, is set to the identity matrix and the
problem reduces to evaluating at as .
calibrate specifies the calibration method used. Four methods are
available: "ael" (adjusted empirical likelihood calibration), "boot"
(bootstrap calibration), "chisq" (chi-square calibration), and "f"
( calibration). When lhs is not NULL, only "chisq" is
available. "f" is applicable only to the mean parameter. The an slot in
control applies specifically to "ael", while the nthreads, seed,
and B slots apply to "boot".
An object of class of ELT. If lhs is non-NULL, the
optim slot corresponds to that of CEL. Otherwise, it
corresponds to that of EL.
Adimari G, Guolo A (2010). “A Note on the Asymptotic Behaviour of Empirical Likelihood Statistics.” Statistical Methods & Applications, 19(4), 463–476. doi:10.1007/s10260-010-0137-9.
Chen J, Variyath AM, Abraham B (2008). “Adjusted Empirical Likelihood and Its Properties.” Journal of Computational and Graphical Statistics, 17(2), 426–443.
Kim E, MacEachern SN, Peruggia M (2024). “melt: Multiple Empirical Likelihood Tests in R.” Journal of Statistical Software, 108(5), 1–33. doi:10.18637/jss.v108.i05.
Qin J, Lawless J (1995). “Estimating Equations, Empirical Likelihood and Constraints on Parameters.” Canadian Journal of Statistics, 23(2), 145–159. doi:10.2307/3315441.
EL, ELT, elmt(), el_control()
## Adjusted empirical likelihood calibration data("precip") fit <- el_mean(precip, 32) elt(fit, rhs = 100, calibrate = "ael") ## Bootstrap calibration elt(fit, rhs = 32, calibrate = "boot") ## F calibration elt(fit, rhs = 32, calibrate = "f") ## Test of no treatment effect data("clothianidin") contrast <- matrix(c( 1, -1, 0, 0, 0, 1, -1, 0, 0, 0, 1, -1 ), byrow = TRUE, nrow = 3) fit2 <- el_lm(clo ~ -1 + trt, clothianidin) elt(fit2, lhs = contrast) ## A symbolic description of the same hypothesis elt(fit2, lhs = c( "trtNaked - trtFungicide", "trtFungicide - trtLow", "trtLow - trtHigh" ))## Adjusted empirical likelihood calibration data("precip") fit <- el_mean(precip, 32) elt(fit, rhs = 100, calibrate = "ael") ## Bootstrap calibration elt(fit, rhs = 32, calibrate = "boot") ## F calibration elt(fit, rhs = 32, calibrate = "f") ## Test of no treatment effect data("clothianidin") contrast <- matrix(c( 1, -1, 0, 0, 0, 1, -1, 0, 0, 0, 1, -1 ), byrow = TRUE, nrow = 3) fit2 <- el_lm(clo ~ -1 + trt, clothianidin) elt(fit2, lhs = contrast) ## A symbolic description of the same hypothesis elt(fit2, lhs = c( "trtNaked - trtFungicide", "trtFungicide - trtLow", "trtLow - trtHigh" ))
S4 class for empirical likelihood test.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
logpA numeric vector of the log probabilities of the (constrained) empirical likelihood.
loglA single numeric of the (constrained) empirical log-likelihood.
loglrA single numeric of the (constrained) empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the chi-square degrees of freedom of the statistic.
pvalA single numeric for the (calibrated) -value of the
statistic.
cvA single numeric for the critical value.
rhsA numeric vector for the right-hand side of the hypothesis.
lhsA numeric matrix for the left-hand side of the hypothesis.
alphaA single numeric for the significance level.
calibrateA single character for the calibration method used.
controlAn object of class ControlEL constructed by
el_control().
showClass("ELT")showClass("ELT")
Extracts the degrees of freedom from a model.
## S4 method for signature 'EL' getDF(object) ## S4 method for signature 'ELMT' getDF(object) ## S4 method for signature 'ELT' getDF(object) ## S4 method for signature 'SummaryEL' getDF(object) ## S4 method for signature 'SummaryELMT' getDF(object) ## S4 method for signature 'SummaryLM' getDF(object)## S4 method for signature 'EL' getDF(object) ## S4 method for signature 'ELMT' getDF(object) ## S4 method for signature 'ELT' getDF(object) ## S4 method for signature 'SummaryEL' getDF(object) ## S4 method for signature 'SummaryELMT' getDF(object) ## S4 method for signature 'SummaryLM' getDF(object)
object |
An object that contains the degrees of freedom. |
An integer vector.
getDF(EL): Extracts the degrees of freedom.
getDF(ELMT): Extracts the vector of marginal degrees of freedom.
getDF(ELT): Extracts the (chi-square) degrees of freedom.
getDF(SummaryEL): Extracts the degrees of freedom.
getDF(SummaryELMT): Extracts the vector of marginal degrees of freedom.
getDF(SummaryLM): Extracts the degrees of freedom.
data("faithful") fit <- el_mean(faithful, par = c(3.5, 70)) getDF(fit)data("faithful") fit <- el_mean(faithful, par = c(3.5, 70)) getDF(fit)
Extracts the optimization results from a model.
## S4 method for signature 'EL' getOptim(object, ...) ## S4 method for signature 'ELT' getOptim(object, ...) ## S4 method for signature 'SummaryEL' getOptim(object, ...) ## S4 method for signature 'SummaryELT' getOptim(object, ...) ## S4 method for signature 'SummaryLM' getOptim(object, ...)## S4 method for signature 'EL' getOptim(object, ...) ## S4 method for signature 'ELT' getOptim(object, ...) ## S4 method for signature 'SummaryEL' getOptim(object, ...) ## S4 method for signature 'SummaryELT' getOptim(object, ...) ## S4 method for signature 'SummaryLM' getOptim(object, ...)
object |
An object that contains the optimization results. |
... |
Further arguments passed to methods. |
A list with the following optimization results:
par A numeric vector of the parameter value. See the documentation of
EL and CEL.
lambda A numeric vector of the Lagrange multipliers.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
EL, ELT, sigTests()
data("precip") fit <- el_mean(precip, par = 40) getOptim(fit)data("precip") fit <- el_mean(precip, par = 40) getOptim(fit)
S4 class for generalized linear models. It inherits from LM class.
The overall test involves a constrained optimization problem. All
the parameters except for the intercept are constrained to zero. The
optim slot contains the results. When there is no intercept, all
parameters are set to zero, and the results need to be understood in terms
of EL class since no constrained optimization is involved.
Once the solution is found, the log probabilities (logp) and the
(constrained) empirical likelihood values (logl, loglr, statistic)
readily follow, along with the degrees of freedom (df) and the
-value (pval). The significance tests for each parameter also
involve constrained optimization problems where only one parameter is
constrained to zero. The sigTests slot contains the results.
familyA family object used.
dispersionA single numeric for the estimated dispersion parameter.
sigTestsA list of the following results of significance tests:
statistic A numeric vector of minus twice the (constrained) empirical
log-likelihood ratios with asymptotic chi-square distributions.
iterations An integer vector for the number of iterations performed for
each parameter.
convergence A logical vector for the convergence status of each
parameter.
cstr A single logical for whether constrained EL optimization is
performed or not.
callA matched call.
termsA terms object used.
miscA list of various outputs obtained from the model fitting process. They are used in other generics and methods.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
logpA numeric vector of the log probabilities of the (constrained) empirical likelihood.
loglA single numeric of the (constrained) empirical log-likelihood.
loglrA single numeric of the (constrained) empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightsA numeric vector of the re-scaled weights used for the model fitting.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
dataA numeric matrix of the data for the model fitting.
controlAn object of class ControlEL constructed by
el_control().
showClass("GLM")showClass("GLM")
S4 class for linear models with empirical likelihood. It inherits from CEL class.
The overall test involves a constrained optimization problem. All
the parameters except for the intercept are constrained to zero. The
optim slot contains the results. When there is no intercept, all
parameters are set to zero, and the results need to be understood in terms
of EL class since no constrained optimization is involved.
Once the solution is found, the log probabilities (logp) and the
(constrained) empirical likelihood values (logl, loglr, statistic)
readily follow, along with the degrees of freedom (df) and the
-value (pval). The significance tests for each parameter also
involve constrained optimization problems where only one parameter is
constrained to zero. The sigTests slot contains the results.
sigTestsA list of the following results of significance tests:
statistic A numeric vector of minus twice the (constrained) empirical
log-likelihood ratios with asymptotic chi-square distributions.
iterations An integer vector for the number of iterations performed for
each parameter.
convergence A logical vector for the convergence status of each
parameter.
callA matched call.
termsA terms object used.
miscA list of various outputs obtained from the model fitting process. They are used in other generics and methods.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
logpA numeric vector of the log probabilities of the (constrained) empirical likelihood.
loglA single numeric of the (constrained) empirical log-likelihood.
loglrA single numeric of the (constrained) empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightsA numeric vector of the re-scaled weights used for the model fitting.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
dataA numeric matrix of the data for the model fitting.
controlAn object of class ControlEL constructed by
el_control().
showClass("LM")showClass("LM")
Extracts the empirical log-likelihood from a model.
## S4 method for signature 'EL' logL(object, ...) ## S4 method for signature 'ELT' logL(object, ...) ## S4 method for signature 'SummaryEL' logL(object, ...) ## S4 method for signature 'SummaryELT' logL(object, ...) ## S4 method for signature 'SummaryLM' logL(object, ...)## S4 method for signature 'EL' logL(object, ...) ## S4 method for signature 'ELT' logL(object, ...) ## S4 method for signature 'SummaryEL' logL(object, ...) ## S4 method for signature 'SummaryELT' logL(object, ...) ## S4 method for signature 'SummaryLM' logL(object, ...)
object |
An object that contains the empirical log-likelihood. |
... |
Further arguments passed to methods. |
A single numeric.
Baggerly KA (1998). “Empirical Likelihood as a Goodness-of-Fit Measure.” Biometrika, 85(3), 535–547. doi:10.1093/biomet/85.3.535.
data("precip") fit <- el_mean(precip, par = 40) logL(fit)data("precip") fit <- el_mean(precip, par = 40) logL(fit)
Extracts the empirical log-likelihood ratio from a model.
## S4 method for signature 'EL' logLR(object, ...) ## S4 method for signature 'ELT' logLR(object, ...) ## S4 method for signature 'SummaryEL' logLR(object, ...) ## S4 method for signature 'SummaryELT' logLR(object, ...) ## S4 method for signature 'SummaryLM' logLR(object, ...)## S4 method for signature 'EL' logLR(object, ...) ## S4 method for signature 'ELT' logLR(object, ...) ## S4 method for signature 'SummaryEL' logLR(object, ...) ## S4 method for signature 'SummaryELT' logLR(object, ...) ## S4 method for signature 'SummaryLM' logLR(object, ...)
object |
An object that contains the empirical log-likelihood ratio. |
... |
Further arguments passed to methods. |
A single numeric.
Baggerly KA (1998). “Empirical Likelihood as a Goodness-of-Fit Measure.” Biometrika, 85(3), 535–547. doi:10.1093/biomet/85.3.535.
data("precip") fit <- el_mean(precip, par = 40) logLR(fit)data("precip") fit <- el_mean(precip, par = 40) logLR(fit)
Extracts log probabilities of empirical likelihood from a model.
## S4 method for signature 'EL' logProb(object, ...) ## S4 method for signature 'ELT' logProb(object, ...)## S4 method for signature 'EL' logProb(object, ...) ## S4 method for signature 'ELT' logProb(object, ...)
object |
|
... |
Further arguments passed to methods. |
A numeric vector.
data("precip") fit <- el_mean(precip, par = 40) logProb(fit)data("precip") fit <- el_mean(precip, par = 40) logProb(fit)
Extracts the number of observations from a model.
## S4 method for signature 'EL' nobs(object, ...) ## S4 method for signature 'SummaryEL' nobs(object, ...) ## S4 method for signature 'SummaryLM' nobs(object, ...)## S4 method for signature 'EL' nobs(object, ...) ## S4 method for signature 'SummaryEL' nobs(object, ...) ## S4 method for signature 'SummaryLM' nobs(object, ...)
object |
An object that contains the number of observations. |
... |
Further arguments passed to methods. |
A single integer.
data("precip") fit <- el_mean(precip, par = 40) nobs(fit)data("precip") fit <- el_mean(precip, par = 40) nobs(fit)
Provides plot methods for objects.
## S4 method for signature 'ConfregEL' plot(x, y, ...) ## S4 method for signature 'EL' plot(x, y, ...) ## S4 method for signature 'ELD' plot(x, y, ...)## S4 method for signature 'ConfregEL' plot(x, y, ...) ## S4 method for signature 'EL' plot(x, y, ...) ## S4 method for signature 'ELD' plot(x, y, ...)
x |
An object to be plotted. |
y |
Not used. |
... |
Further graphical parameters (see |
No return value, called for side effects.
plot(ConfregEL): Plots a two-dimensional confidence region for model
parameters.
plot(EL): Plots empirical likelihood displacement values versus
observation index. eld() is called implicitly.
plot(ELD): Plots empirical likelihood displacement values versus
observation index.
ConfregEL, EL, ELD,
confreg(), eld()
## Model data("mtcars") fit <- el_lm(hp ~ wt, data = mtcars) ## Confidence region out1 <- confreg(fit, npoints = 500) plot(out1) ## Empirical likelihood displacement out2 <- eld(fit) plot(out2) ## A shortcut to `ELD` plot(fit)## Model data("mtcars") fit <- el_lm(hp ~ wt, data = mtcars) ## Confidence region out1 <- confreg(fit, npoints = 500) plot(out1) ## Empirical likelihood displacement out2 <- eld(fit) plot(out2) ## A shortcut to `ELD` plot(fit)
Provides print methods for objects.
## S4 method for signature 'EL' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'ELMT' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'ELT' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'LM' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'SummaryEL' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'SummaryELMT' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... ) ## S4 method for signature 'SummaryELT' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'SummaryGLM' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... ) ## S4 method for signature 'SummaryLM' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... )## S4 method for signature 'EL' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'ELMT' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'ELT' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'LM' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'SummaryEL' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'SummaryELMT' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... ) ## S4 method for signature 'SummaryELT' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S4 method for signature 'SummaryGLM' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... ) ## S4 method for signature 'SummaryLM' print( x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ... )
x |
An object to be printed. |
... |
Further arguments passed to methods. |
digits |
A single integer for the number of significant digits to be
passed to |
signif.stars |
A single logical. If |
The argument x (invisibly).
data("precip") fit <- el_mean(precip, par = 40) print(fit)data("precip") fit <- el_mean(precip, par = 40) print(fit)
-valueExtracts the -value from a model.
## S4 method for signature 'EL' pVal(object, ...) ## S4 method for signature 'ELMT' pVal(object, ...) ## S4 method for signature 'ELT' pVal(object, ...) ## S4 method for signature 'SummaryEL' pVal(object, ...) ## S4 method for signature 'SummaryELT' pVal(object, ...) ## S4 method for signature 'SummaryELMT' pVal(object, ...) ## S4 method for signature 'SummaryLM' pVal(object, ...)## S4 method for signature 'EL' pVal(object, ...) ## S4 method for signature 'ELMT' pVal(object, ...) ## S4 method for signature 'ELT' pVal(object, ...) ## S4 method for signature 'SummaryEL' pVal(object, ...) ## S4 method for signature 'SummaryELT' pVal(object, ...) ## S4 method for signature 'SummaryELMT' pVal(object, ...) ## S4 method for signature 'SummaryLM' pVal(object, ...)
object |
An object that contains the |
... |
Further arguments passed to methods. |
The form of the value returned by pVal() depends on the class of
its argument.
pVal(EL): Extracts the -value.
pVal(ELMT): Extracts the multiplicity adjusted -values.
pVal(ELT): Extracts the -value.
pVal(SummaryEL): Extracts the -value.
pVal(SummaryELT): Extracts the -value.
pVal(SummaryELMT): Extracts the multiplicity adjusted -values.
pVal(SummaryLM): Extracts the -value.
data("precip") fit <- el_mean(precip, par = 40) pVal(fit)data("precip") fit <- el_mean(precip, par = 40) pVal(fit)
S4 class for generalized linear models with quasi-likelihood methods. It inherits from GLM class.
The overall test involves a constrained optimization problem. All
the parameters except for the intercept are constrained to zero. The
optim slot contains the results. When there is no intercept, all
parameters are set to zero, and the results need to be understood in terms
of EL class since no constrained optimization is involved.
Once the solution is found, the log probabilities (logp) and the
(constrained) empirical likelihood values (logl, loglr, statistic)
readily follow, along with the degrees of freedom (df) and the
-value (pval). The significance tests for each parameter also
involve constrained optimization problems where only one parameter is
constrained to zero. The sigTests slot contains the results.
familyA family object used.
dispersionA single numeric for the estimated dispersion parameter.
sigTestsA list of the following results of significance tests:
statistic A numeric vector of minus twice the (constrained) empirical
log-likelihood ratios with asymptotic chi-square distributions.
iterations An integer vector for the number of iterations performed for
each parameter.
convergence A logical vector for the convergence status of each
parameter.
cstr A single logical for whether constrained EL optimization is
performed or not.
callA matched call.
termsA terms object used.
miscA list of various outputs obtained from the model fitting process. They are used in other generics and methods.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
logpA numeric vector of the log probabilities of the (constrained) empirical likelihood.
loglA single numeric of the (constrained) empirical log-likelihood.
loglrA single numeric of the (constrained) empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightsA numeric vector of the re-scaled weights used for the model fitting.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
dataA numeric matrix of the data for the model fitting.
controlAn object of class ControlEL constructed by
el_control().
showClass("QGLM")showClass("QGLM")
S4 class for standard deviation. It inherits from EL class.
optimA list of the following optimization results:
par A numeric vector of the specified parameters.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
logpA numeric vector of the log probabilities of the empirical likelihood.
loglA single numeric of the empirical log-likelihood.
loglrA single numeric of the empirical log-likelihood ratio.
statisticA single numeric of minus twice the empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightsA numeric vector of the re-scaled weights used for the model fitting.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
dataA numeric matrix of the data for the model fitting.
controlAn object of class ControlEL constructed by
el_control().
showClass("SD")showClass("SD")
Extracts the results of significance tests from a model.
## S4 method for signature 'LM' sigTests(object, ...)## S4 method for signature 'LM' sigTests(object, ...)
object |
An object that inherits from LM. |
... |
Further arguments passed to methods. |
The form of the value returned by sigTests() depends on the
class of its argument.
sigTests(LM): Extracts a list with the optimization results of
significance tests.
data("mtcars") fit <- el_lm(mpg ~ ., data = mtcars) sigTests(fit)data("mtcars") fit <- el_lm(mpg ~ ., data = mtcars) sigTests(fit)
Provides summary methods for objects.
## S4 method for signature 'EL' summary(object, ...) ## S4 method for signature 'ELMT' summary(object, ...) ## S4 method for signature 'ELT' summary(object, ...) ## S4 method for signature 'GLM' summary(object, ...) ## S4 method for signature 'LM' summary(object, ...) ## S4 method for signature 'QGLM' summary(object, ...)## S4 method for signature 'EL' summary(object, ...) ## S4 method for signature 'ELMT' summary(object, ...) ## S4 method for signature 'ELT' summary(object, ...) ## S4 method for signature 'GLM' summary(object, ...) ## S4 method for signature 'LM' summary(object, ...) ## S4 method for signature 'QGLM' summary(object, ...)
object |
An object for which a summary is desired. |
... |
Further arguments passed to methods. |
The form of the value returned by summary() depends on the class of
its argument.
summary(EL): Summarizes the test results of the specified parameters.
summary(ELMT): Summarizes the multiple testing results.
summary(ELT): Summarizes the hypothesis test results.
summary(GLM): Summarizes the results of the overall model test and the
significance tests for coefficients. The dispersion parameter is extracted
for display.
summary(LM): Summarizes the results of the overall model test and the
significance tests for coefficients.
summary(QGLM): Summarizes the results of the overall model test and the
significance tests for coefficients. The estimated dispersion parameter is
extracted for display.
data("faithful") fit <- el_mean(faithful, par = c(3.5, 70)) summary(fit) data("mtcars") fit2 <- el_lm(mpg ~ wt, data = mtcars) summary(fit2)data("faithful") fit <- el_mean(faithful, par = c(3.5, 70)) summary(fit) data("mtcars") fit2 <- el_lm(mpg ~ wt, data = mtcars) summary(fit2)
S4 class for a summary of EL objects.
optimA list of the following optimization results:
par A numeric vector of the specified parameters.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
loglA single numeric of the empirical log-likelihood.
loglrA single numeric of the empirical log-likelihood ratio.
statisticA single numeric of minus twice the empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightedA single logical for whether the data are weighted or not.
coefficientsA numeric vector of the maximum empirical likelihood estimates of the parameters.
methodA single character for the method dispatch in internal functions.
controlAn object of class ControlEL constructed by
el_control().
showClass("SummaryEL")showClass("SummaryEL")
S4 class for a summary of ELMT objects.
aliasedA named logical vector showing if the original coefficients are aliased.
showClass("SummaryELMT")showClass("SummaryELMT")
S4 class for a summary of ELT objects.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
loglA single numeric of the (constrained) empirical log-likelihood.
loglrA single numeric of the (constrained) empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio with an asymptotic chi-square distribution.
dfA single integer for the chi-square degrees of freedom of the statistic.
pvalA single numeric for the (calibrated) -value of the
statistic.
cvA single numeric for the critical value.
rhsA numeric vector for the right-hand side of the hypothesis.
lhsA numeric matrix for the left-hand side of the hypothesis.
alphaA single numeric for the significance level.
calibrateA single character for the calibration method used.
controlAn object of class ControlEL constructed by
el_control().
showClass("SummaryELT")showClass("SummaryELT")
S4 class for a summary of GLM objects. It inherits from SummaryLM class.
familyA family object used.
dispersionA single numeric for the estimated dispersion parameter.
coefficientsA numeric matrix of the results of significance tests.
interceptA single logical for whether the given model has an intercept term or not.
na.actionInformation returned by model.frame on the special
handling of NAs.
callA matched call.
termsA terms object used.
aliasedA named logical vector showing if the original coefficients are aliased.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
loglA single numeric of the empirical log-likelihood.
loglrA single numeric of the empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio for the overall test.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightedA single logical for whether the data are weighted or not.
methodA single character for the method dispatch in internal functions.
controlAn object of class ControlEL constructed by
el_control().
showClass("SummaryGLM")showClass("SummaryGLM")
S4 class for a summary of LM objects.
coefficientsA numeric matrix of the results of significance tests.
interceptA single logical for whether the given model has an intercept term or not.
na.actionInformation returned by model.frame on the special
handling of NAs.
callA matched call.
termsA terms object used.
aliasedA named logical vector showing if the original coefficients are aliased.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
loglA single numeric of the empirical log-likelihood.
loglrA single numeric of the empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio for the overall test.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightedA single logical for whether the data are weighted or not.
methodA single character for the method dispatch in internal functions.
controlAn object of class ControlEL constructed by
el_control().
showClass("SummaryLM")showClass("SummaryLM")
S4 class for a summary of QGLM objects. It inherits from SummaryGLM class.
familyA family object used.
dispersionA single numeric for the estimated dispersion parameter.
coefficientsA numeric matrix of the results of significance tests.
interceptA single logical for whether the given model has an intercept term or not.
na.actionInformation returned by model.frame on the special
handling of NAs.
callA matched call.
termsA terms object used.
aliasedA named logical vector showing if the original coefficients are aliased.
optimA list of the following optimization results:
par A numeric vector of the solution to the (constrained) optimization
problem.
lambda A numeric vector of the Lagrange multipliers of the dual
problem corresponding to par.
iterations A single integer for the number of iterations performed.
convergence A single logical for the convergence status.
cstr A single logical for whether constrained EL optimization is
performed or not.
loglA single numeric of the empirical log-likelihood.
loglrA single numeric of the empirical log-likelihood ratio.
statisticA single numeric of minus twice the (constrained) empirical log-likelihood ratio for the overall test.
dfA single integer for the degrees of freedom of the statistic.
pvalA single numeric for the -value of the statistic.
nobsA single integer for the number of observations.
nparA single integer for the number of parameters.
weightedA single logical for whether the data are weighted or not.
methodA single character for the method dispatch in internal functions.
controlAn object of class ControlEL constructed by
el_control().
showClass("SummaryQGLM")showClass("SummaryQGLM")
A dataset on the effect of the thiamethoxam application method and plant variety on bees.
data("thiamethoxam")data("thiamethoxam")
A data frame with 165 observations and 11 variables:
Treatment.
Variety.
Replicate.
Average fruit number per plant.
Individual Fruit mass average (g).
Fruit mass per plant (g).
Yield (4 plants).
Bee visits per plot.
Proportion of foliage consumed by striped cucumber beetle.
Striped cucumber beetle per plant.
Defoliation percentage.
Obregon D, Pederson G, Taylor A, Poveda K (2022). “The Pest Control and Pollinator Protection Dilemma: The Case of Thiamethoxam Prophylactic Applications in Squash Crops.” PLOS ONE, 17(5), 1–18. doi:10.1371/journal.pone.0267984.
data("thiamethoxam") thiamethoxamdata("thiamethoxam") thiamethoxam
Extracts weights from model objects. The weights are re-scaled to up to the total number of observations in the fitting procedure.
## S4 method for signature 'EL' weights(object, ...)## S4 method for signature 'EL' weights(object, ...)
object |
An object that inherits from EL. |
... |
Further arguments passed to methods. |
A numeric vector of the re-scaled weights.
Glenn N, Zhao Y (2007). “Weighted Empirical Likelihood Estimates and Their Robustness Properties.” Computational Statistics & Data Analysis, 51(10), 5130–5141. doi:10.1016/j.csda.2006.07.032.
data("airquality") x <- airquality$Wind w <- airquality$Day fit <- el_mean(x, par = 10, weights = w) weights(fit)data("airquality") x <- airquality$Wind w <- airquality$Day fit <- el_mean(x, par = 10, weights = w) weights(fit)