calculate_continuous_X_statistics: Estimate/variance of policy evaluation via contextual...

View source: R/adaptive_utils.R

calculate_continuous_X_statisticsR Documentation

Estimate/variance of policy evaluation via contextual weighting.

Description

Computes the estimate and variance of a policy evaluation based on adaptive weights, AIPW scores, and a policy matrix.

Usage

calculate_continuous_X_statistics(h, gammahat, policy)

Arguments

h

Numeric matrix. Adaptive weights h_t(X_s), shape [A, A]. Must be a square matrix and must not contain NA values.

gammahat

Numeric matrix. AIPW scores, shape [A, K]. Must not contain NA values.

policy

Numeric matrix. Policy matrix \pi(X_t, w), shape [A, K]. Must have the same shape as gammahat and must not contain NA values.

Value

Named numeric vector with elements estimate and var, representing the estimated policy value and the variance of the estimate, respectively.

Examples

h <- matrix(c(0.4, 0.3, 0.2, 0.1,
              0.2, 0.3, 0.3, 0.2,
              0.5, 0.3, 0.2, 0.1,
              0.1, 0.2, 0.1, 0.6), ncol = 4, byrow = TRUE)
scores <- matrix(c(0.5, 0.8, 0.6, 0.3,
                   0.9, 0.2, 0.5, 0.7,
                   0.4, 0.8, 0.2, 0.6), ncol = 3, byrow = TRUE)
policy <- matrix(c(0.2, 0.3, 0.5,
                   0.6, 0.1, 0.3,
                   0.4, 0.5, 0.1,
                   0.2, 0.7, 0.1), ncol = 3, byrow = TRUE)
gammahat <- scores - policy
calculate_continuous_X_statistics(h = h, gammahat = gammahat, policy = policy)


banditsCI documentation built on April 12, 2025, 1:42 a.m.