Skip to content

Chia202/PCORcpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PCORcpp

This package provides a C++ implementation of Projection Correlation (PCOR) computations, leveraging Rcpp, Armadillo and OPENMP for performance optimization. An R implementation is available at PCOR.

Installation

remotes::install_github("chia202/PCORcpp")

Features

  • pcov(): Compute projection covariance between two random vectors
  • pcor(): Compute projection correlation coefficient between two random vectors
  • pcov.test(): Perform projection covariance independence test
  • pcor.test(): Perform projection correlation independence test

Usage Example

library(PCORcpp)

set.seed(123)
X <- matrix(rnorm(100 * 5), 100, 5)
Y <- matrix(rnorm(100 * 3), 100, 3)

# Compute projection covariance
result <- pcov(X, Y, n.threads = 4)
print(result)

# Compute projection correlation coefficient
result <- pcor(X, Y, estimation.method = "u", n.threads = 4)
print(result)

# Perform independence test
pcov.test_result <- pcov.test(X, Y, times = 199, n.threads = 4)
print(pcov.test_result)
pcor.test_result <- pcor.test(X, Y, times = 199, n.threads = 4)
print(pcor.test_result)

Parameters

  • estimation.method: Estimation method, "u" for U-statistic, "v" for V-statistic
  • times: Number of permutations for permutation test
  • n.threads: Number of threads for parallel computation

Reference

  1. L. Zhu, K. Xu, R. Li, W. Zhong (2017). Projection correlation between two random vectors. Biometrika, 104, 829-843.

About

A C++ implementation of projection correlation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors