feature.test: Weighted permutation test for paired difference of means

View source: R/feature.test.R

feature.testR Documentation

Weighted permutation test for paired difference of means

Description

Performs a weighted permutation test for the null hypothesis that the weighted mean of (var1 - var2) is zero.

Usage

feature.test(var1, var2, weights, n = 2000)

Arguments

var1

A numeric vector.

var2

A numeric vector of the same length as var1.

weights

A numeric vector of non-negative weights of the same length as var1 and var2.

n

Integer. Number of permutations (default 2000).

Value

A list with:

mean_wmshap_diff

Observed weighted mean difference (var1 - var2).

p_value

Monte Carlo permutation p-value.

Examples

## Not run: 
var1 <- rnorm(100)
var2 <- rnorm(100)
weights <- runif(100)
result <- shapley:::feature.test(var1, var2, weights)
result$mean_wmshap_diff
result$p_value

## End(Not run)

shapley documentation built on March 4, 2026, 9:06 a.m.