projcov {pgraph}R Documentation

Calculate the Projected Covariance of Two Vectors

Description

projcov calculate the projected distance covariance of two vectors given common factors.

Usage

projcov(
  x,
  y,
  b,
  method = c("lasso", "sam", "ols"),
  one.SE = TRUE,
  refit = TRUE,
  R = 199,
  randSeed = 0,
  normalized = FALSE
)

Arguments

x

first vector

y

second vector

b

factor matrix

method

projection method. Default = 'lasso'.

one.SE

whether to use the 1se rule for glmnet. Default = TRUE.

refit

whether to refit the selected model. Default = TRUE.

R

number of random permutations for the test.

randSeed

the random seed for the program. Default = 0.

normalized

whether to normalized by S2. Default = FALSE.

Value

a list.

test.pearson

pearson correlection test statistic

test.dcov

distance covariance test statistic

xeps

residual of projection of x on b

yeps

residual of projection of y on b

See Also

greg, roc, pgraph

Examples

library(splines)
set.seed(0)
K = 3
n = 100
b = matrix(rnorm(K*n),n,K)
bx = 1:3
by = c(1,2,2)
x = b%*%bx+rnorm(n)
y = b%*%by+rnorm(n)
fit1 = projcov(x, y, b, method = 'lasso')
fit2 = projcov(x, y, b, method = 'sam')

[Package pgraph version 1.6 Index]