knitr::opts_chunk$set( collapse = TRUE, comment = "#>", dpi = 300, fig.path = "man/figures/README-", out.width = "100%" )
melt provides a unified framework for data analysis with empirical likelihood methods. A collection of functions is available to perform multiple empirical likelihood tests and construct confidence intervals for various models in 'R'. melt 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 with 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). The package has a companion paper by Kim, MacEachern, and Peruggia (2024). This work was supported by the U.S. National Science Foundation under Grants No. SES-1921523 and DMS-2015552.
You can install the latest stable release of melt from CRAN.
install.packages("melt")
You can install the development version of melt from GitHub or R-universe.
# install.packages("pak") pak::pak("ropensci/melt")
install.packages("melt", repos = "https://ropensci.r-universe.dev")
melt provides an intuitive API for performing the most common data analysis tasks:
el_mean()
computes empirical likelihood for the mean.el_lm()
fits a linear model with empirical likelihood.el_glm()
fits a generalized linear model with empirical likelihood.confint()
computes confidence intervals for model parameters.confreg()
computes confidence region for model parameters.elt()
tests a hypothesis with various calibration options.elmt()
performs multiple testing simultaneously.library(melt) set.seed(971112) ## Test for the mean data("precip") (fit <- el_mean(precip, par = 30)) ## Adjusted empirical likelihood calibration elt(fit, rhs = 30, calibrate = "ael") ## Bootstrap calibration elt(fit, rhs = 30, calibrate = "boot") ## F calibration elt(fit, rhs = 30, calibrate = "f") ## Linear model data("mtcars") fit_lm <- el_lm(mpg ~ disp + hp + wt + qsec, data = mtcars) summary(fit_lm) cr <- confreg(fit_lm, parm = c("disp", "hp"), npoints = 200) plot(cr) data("clothianidin") fit2_lm <- el_lm(clo ~ -1 + trt, data = clothianidin) summary(fit2_lm) confint(fit2_lm) ## Generalized linear model data("thiamethoxam") fit_glm <- el_glm(visit ~ log(mass) + fruit + foliage + var + trt, family = quasipoisson(link = "log"), data = thiamethoxam, control = el_control(maxit = 100, tol = 1e-08, nthreads = 4) ) summary(fit_glm) ## Test of no treatment effect contrast <- c( "trtNaked - trtFungicide", "trtFungicide - trtLow", "trtLow - trtHigh" ) elt(fit2_lm, lhs = contrast) ## Multiple testing contrast2 <- rbind( c(0, 0, 0, 0, 0, 1, 0, 0), c(0, 0, 0, 0, 0, 0, 1, 0), c(0, 0, 0, 0, 0, 0, 0, 1) ) elmt(fit_glm, lhs = contrast2)
Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.