MyNixOS website logo
Description

Weighted Generalised Covariance Measure Conditional Independence Test.

A conditional independence test that can be applied both to univariate and multivariate random variables. The test is based on a weighted form of the sample covariance of the residuals after a nonlinear regression on the conditioning variables. Details are described in Scheidegger, Hoerrmann and Buehlmann (2021) "The Weighted Generalised Covariance Measure" <arXiv:2111.04361>. The test is a generalisation of the Generalised Covariance Measure (GCM) implemented in the R package 'GeneralisedCovarianceMeasure' by Jonas Peters and Rajen D. Shah based on Shah and Peters (2020) "The Hardness of Conditional Independence Testing and the Generalised Covariance Measure" <arXiv:1804.07203>.

weightedGCM

The package weightedGCM contains two functions implementing the two versions of the Weighted Generalised Covariance Measure (WGCM) conditional independence test described in Scheidegger, Hoerrmann and Buehlmann (2021) “The Weighted Generalised Covariance Measure” \<arXiv:2111.04361>. It is a generalisation of the Generalised Covariance Measure (GCM) implemented in the package ‘GeneralisedCovarianceMeasure’ by Jonas Peters and Rajen D. Shah based on Shah and Peters (2020) “The Hardness of Conditional Independence Testing and the Generalised Covariance Measure” \<arXiv:1804.07203>.

  • wgcm.fix calculates a p-value for the null hypothesis of conditional independence based on the WGCM using several fixed weight functions.

  • wgcm.est calculates a p-value for the null hypothesis of conditional indepencence based on the WGCM using a single estimated weight function.

Installation

You can install the released version of weightedGCM from CRAN with:

install.packages("weightedGCM")

Example

We generate some data to use the two conditional independence test.

library(weightedGCM)
## Generate data
set.seed(1)
n <- 200
Z <- rnorm(n)
X <- Z + 0.3*rnorm(n)

## Y1 _||_ X | Z
Y1 <- Z + 0.3*rnorm(n)
## Y2 not _||_ X | Z
Y2 <- Z + 0.3*rnorm(n) + 0.3*X
## Y3 not _||_ X | Z
Y3 <- Z + 0.3*rnorm(n) + 0.15*X^2

## Test for conditional independence using wgcm.fix()
wgcm.fix(X, Y1, Z, regr.meth = "gam", weight.num = 7, weight.meth = "sign")
#> [1] 0.868
wgcm.fix(X, Y2, Z, regr.meth = "gam", weight.num = 7, weight.meth = "sign")
#> [1] 0.004
wgcm.fix(X, Y3, Z, regr.meth = "gam", weight.num = 7, weight.meth = "sign")
#> [1] 0.004

## Test for conditional independence using wgcm.est()
wgcm.est(X, Y1, Z, beta = 0.3, regr.meth = "gam")
#> [1] 0.2389116
wgcm.est(X, Y2, Z, beta = 0.3, regr.meth = "gam")
#> [1] 9.974068e-05
wgcm.est(X, Y3, Z, beta = 0.3, regr.meth = "gam")
#> [1] 0.004474768
Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD 13
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd13
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd13
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows