Package 'ife'

Title: Autodiff for Influence Function Based Estimates
Description: Implements an S7 class for estimates based on influence functions, with forward mode automatic differentiation defined for standard arithmetic operations.
Authors: Nicholas Williams [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-1378-4831>)
Maintainer: Nicholas Williams <[email protected]>
License: GPL (>= 3)
Version: 0.2.5
Built: 2026-07-02 21:30:05 UTC
Source: https://github.com/cran/ife

Help Index


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