comp.resids: Wrapper function to computing residuals from a regression...

View source: R/gcm.R

comp.residsR Documentation

Wrapper function to computing residuals from a regression method

Description

This function is used for the GCM test. Other methods can be added.

Usage

comp.resids(V, Z, regr.pars, regr.method)

Arguments

V

A (nxp)-dimensional matrix (or data frame) with n observations of p variables.

Z

A (nxp)-dimensional matrix (or data frame) with n observations of p variables.

regr.pars

Some regression methods require a list of additional options.

regr.method

A string indicating the regression method that is used. Currently implemented are "gam", "xgboost", "kernel.ridge", "nystrom". The regression is performed only if not both resid.XonZ and resid.YonZ are set to NULL.

Value

Vector of residuals.

References

Please cite the following paper. Rajen D. Shah, Jonas Peters: "The Hardness of Conditional Independence Testing and the Generalised Covariance Measure" https://arxiv.org/abs/1804.07203

Examples

set.seed(1)
n <- 250 
Z <- 4*rnorm(n) 
X <- 2*sin(Z) + rnorm(n)
res <- comp.resids(X, Z, regr.pars = list(), regr.method = "gam")


GeneralisedCovarianceMeasure documentation built on March 24, 2022, 9:05 a.m.