Learn R Programming

shapley (version 0.6.0)

feature.test: 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)

Value

A list with:

mean_wmshap_diff

Observed weighted mean difference (var1 - var2).

p_value

Monte Carlo permutation p-value.

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).

Examples

Run this code
if (FALSE) {
var1 <- rnorm(100)
var2 <- rnorm(100)
weights <- runif(100)
result <- shapley:::feature.test(var1, var2, weights)
result$mean_wmshap_diff
result$p_value
}

Run the code above in your browser using DataLab