From c0ca487bcc594152c7c7b3f6ead32c960143f4a8 Mon Sep 17 00:00:00 2001 From: markean Date: Sun, 21 Jan 2024 19:17:33 -0500 Subject: [PATCH] examples expanded --- DESCRIPTION | 11 +++++------ R/etel.R | 13 ++++++++++--- R/retel.R | 15 ++++++++++++--- man/etel.Rd | 13 ++++++++++--- man/retel-package.Rd | 4 ++-- man/retel.Rd | 15 ++++++++++++--- 6 files changed, 51 insertions(+), 20 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d93d4a9..26594c9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,18 +1,17 @@ Package: retel Type: Package Title: Regularized Exponentially Tilted Empirical Likelihood -Version: 0.0.0.9704 +Version: 0.0.0.9705 Authors@R: c( person("Eunseop", "Kim", email = "markean@pm.me", - role = c("aut", "cre")), + role = c("aut", "cph", "cre")), person("Steven", "MacEachern", role = c("ctb", "ths")), person("Mario", "Peruggia", role = c("ctb", "ths")) ) Description: Implements regularized exponentially tilted empirical likelihood - for Bayesian inference. Details of the methods are given in Kim, MacEachern, - and Peruggia (2023) . This work was supported - by the U.S. National Science Foundation under Grants No. SES-1921523 and - DMS-2015552. + methods. Details of the methods are given in Kim, MacEachern, and Peruggia + (2023) . This work was supported by the U.S. + National Science Foundation under Grants No. SES-1921523 and DMS-2015552. License: GPL (>= 3) URL: https://github.com/markean/retel BugReports: https://github.com/markean/retel/issues diff --git a/R/etel.R b/R/etel.R index 48deba7..2707c66 100644 --- a/R/etel.R +++ b/R/etel.R @@ -22,13 +22,20 @@ #' "Bayesian Exponentially Tilted Empirical Likelihood." #' \emph{Biometrika}, 92, 31--46. #' @examples +#' # Generate data #' set.seed(63456) -#' f <- function(x, par) { +#' x <- rnorm(100) +#' +#' # Define an estimating function (ex. mean) +#' fn <- function(x, par) { #' x - par #' } -#' x <- rnorm(100) +#' +#' # Set parameter value #' par <- 0 -#' etel(f, x, par) +#' +#' # Call the etel function +#' etel(fn, x, par) #' @export etel <- function(fn, x, par, opts = NULL) { assert_function(fn, args = c("x", "par"), ordered = TRUE, nargs = 2L) diff --git a/R/retel.R b/R/retel.R index 17b4d25..954df2b 100644 --- a/R/retel.R +++ b/R/retel.R @@ -115,16 +115,25 @@ #' "Regularized Exponentially Tilted Empirical Likelihood for Bayesian #' Inference." \doi{10.48550/arXiv.2312.17015}. #' @examples +#' # Generate data #' set.seed(63456) -#' f <- function(x, par) { +#' x <- rnorm(100) +#' +#' # Define an estimating function (ex. mean) +#' fn <- function(x, par) { #' x - par #' } -#' x <- rnorm(100) +#' +#' # Set parameter value #' par <- 0 +#' +#' # Set regularization parameters #' mu <- 0 #' Sigma <- 1 #' tau <- 1 -#' retel(f, x, par, mu, Sigma, tau) +#' +#' # Call the retel function +#' retel(fn, x, par, mu, Sigma, tau) #' @export retel <- function(fn, x, par, mu, Sigma, tau, type = "full", opts = NULL) { assert_function(fn, args = c("x", "par"), ordered = TRUE, nargs = 2L) diff --git a/man/etel.Rd b/man/etel.Rd index 039d4aa..23a2f05 100644 --- a/man/etel.Rd +++ b/man/etel.Rd @@ -27,13 +27,20 @@ A single numeric value representing the log-likelihood ratio. Computes exponentially tilted empirical likelihood. } \examples{ +# Generate data set.seed(63456) -f <- function(x, par) { +x <- rnorm(100) + +# Define an estimating function (ex. mean) +fn <- function(x, par) { x - par } -x <- rnorm(100) + +# Set parameter value par <- 0 -etel(f, x, par) + +# Call the etel function +etel(fn, x, par) } \references{ Schennach, SM (2005). diff --git a/man/retel-package.Rd b/man/retel-package.Rd index 8a65205..1b8fbb7 100644 --- a/man/retel-package.Rd +++ b/man/retel-package.Rd @@ -5,7 +5,7 @@ \alias{retel-package} \title{retel: Regularized Exponentially Tilted Empirical Likelihood} \description{ -Implements regularized exponentially tilted empirical likelihood for Bayesian inference. Details of the methods are given in Kim, MacEachern, and Peruggia (2023) \doi{10.48550/arXiv.2312.17015}. This work was supported by the U.S. National Science Foundation under Grants No. SES-1921523 and DMS-2015552. +Implements regularized exponentially tilted empirical likelihood methods. Details of the methods are given in Kim, MacEachern, and Peruggia (2023) \doi{10.48550/arXiv.2312.17015}. This work was supported by the U.S. National Science Foundation under Grants No. SES-1921523 and DMS-2015552. } \references{ Kim E, MacEachern SN, Peruggia M (2023). @@ -22,7 +22,7 @@ Useful links: } \author{ -\strong{Maintainer}: Eunseop Kim \email{markean@pm.me} +\strong{Maintainer}: Eunseop Kim \email{markean@pm.me} [copyright holder] Other contributors: \itemize{ diff --git a/man/retel.Rd b/man/retel.Rd index 6ae5847..1aa032e 100644 --- a/man/retel.Rd +++ b/man/retel.Rd @@ -121,16 +121,25 @@ See the references below for more details on derivation, interpretation, and properties. } \examples{ +# Generate data set.seed(63456) -f <- function(x, par) { +x <- rnorm(100) + +# Define an estimating function (ex. mean) +fn <- function(x, par) { x - par } -x <- rnorm(100) + +# Set parameter value par <- 0 + +# Set regularization parameters mu <- 0 Sigma <- 1 tau <- 1 -retel(f, x, par, mu, Sigma, tau) + +# Call the retel function +retel(fn, x, par, mu, Sigma, tau) } \references{ Kim E, MacEachern SN, Peruggia M (2023).