Package {ife}


Type: Package
Title: Autodiff for Influence Function Based Estimates
Version: 0.2.5
Maintainer: Nicholas Williams <ntwilliams.personal@gmail.com>
Description: Implements an S7 class for estimates based on influence functions, with forward mode automatic differentiation defined for standard arithmetic operations.
License: GPL (≥ 3)
Encoding: UTF-8
URL: https://github.com/nt-williams/ife
BugReports: https://github.com/nt-williams/ife/issues
Imports: cli, collapse, generics, S7 (≥ 0.2.0)
RoxygenNote: 7.3.2
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-07-01 18:13:50 UTC; nicholaswilliams
Author: Nicholas Williams ORCID iD [aut, cre, cph]
Repository: CRAN
Date/Publication: 2026-07-02 02:30:08 UTC

Create a new 'influence_func_estimate' object

Description

Create a new 'influence_func_estimate' object

Usage

ife(
  x,
  eif,
  weights = rep(1, length(eif)),
  id = as.character(1:length(eif)),
  critical_value = qnorm(0.975)
)

influence_func_estimate(
  x,
  eif,
  weights = rep(1, length(eif)),
  id = as.character(1:length(eif)),
  critical_value = qnorm(0.975)
)

Arguments

x

[numeric(1)]
The point estimate.

eif

[numeric(n)]
The influence function.

weights

[numeric(n)]
Optional known survey sampling weights.

id

[character(n)]
Optional cluster identifiers.

critical_value

[numeric(1)]
Optional critical value for constructing confidence interval.

Details

If known survey weights are provided, the variance estimator is the sample variance of the influence function multiplied by the survey weights (see DOI: 10.1093/aje/kwu197 for more information). If there is clustering, x and eif are assumed to be on the individual-level. The individual-level influence function is then aggregated to the cluster-level and the variance estimator is the sample variance of the estimated cluster-level influence function, scaled by the number of clusters (see DOI: 10.1002/sim.9813 for more information).

Value

An 'S7' object of class influence_func_estimate.

Examples

.x <- rnorm(100)
.y <- rnorm(100)
x <- influence_func_estimate(mean(.x), .x - mean(.x))
y <- influence_func_estimate(mean(.x), .y - mean(.y))
x + y
x + 1
1 - y
x / y
x * y
tidy(x)
# Example: Confidence interval for a variance estimate
.z <- rnorm(100, 0, sqrt(4))
ife(mean(.z^2), .z^2 - mean(.z^2)) - ife(mean(.z), .z - mean(.z))^2

Objects exported from other packages

Description

These objects are imported from other packages. Follow the links below to see their documentation.

generics

tidy