regrXonS {kpcalg}R Documentation

Regress set of variables on its parents

Description

Uses the generalised additive model gam to non-linearly and non-parametrically regress set of variables X on a set of variables S and returns residuals of X.

Usage

regrXonS(X, S)

Arguments

X

numeric matrix, set of variables to be regressed. Each column represents separate variable

S

numeric matrix, set of variables we will regress on. Each column represents separate variable

Details

If the number of variables in S is \leq 5 we use frml.full.smooth as formula for gam to regress X on S, otherwise we use frml.additive.smooth.

Value

regrXonS() returns the residuals of X regressed on S.

Author(s)

Petras Verbyla (petras.verbyla@mrc-bsu.cam.ac.uk)

See Also

kernelCItest

Examples

set.seed(10)
library(energy)
z <- 10*runif(300)
w <- 10*runif(300)
x <- sin(z) + runif(300)
y <- cos(z) + runif(300)
data <- cbind(x,y,z,w)

hsic.gamma(x,y)
hsic.perm(x,y)
dcov.test(x,y)

resid <- regrXonS(cbind(x,y),cbind(z,w))

hsic.gamma(resid[,1],resid[,2])
hsic.perm(resid[,1],resid[,2])
dcov.test(resid[,1],resid[,2])

[Package kpcalg version 1.0.1 Index]