The goal of Devariation is to construct the devariation-adjusted data by separating the observed matrix into (i) a dominant structured component and (ii) a residual component. The residual is interpreted as the devariation-adjusted data, where large-scale structured variation is removed.
You can install the development version of Devariation from GitHub with:
# install.packages("pak")
pak::pak("RuyiPan/Devariation")This is a basic example which shows you how to solve a common problem:
library(Devariation)
library(FactoMineR)
set.seed(1)
X <- matrix(rnorm(100 * 80), 100, 80)
Y <- matrix(rnorm(100 * 60), 100, 60)
#Get devariation-adjusted X and Y
dX = dev(X)
dY = dev(Y)
#Conduct RV test
out1 = coeffRV(dX[[1]], dY[[1]])
#Or using our wrapped function drv to conduct devariation RV
out2 <- drv(X, Y)
out2$drvRes
out1$p.value
out2$drvRes$p.value