Nothing
#-----------------------------------------------------------------------------#
# #
# GENERALIZED NETWORK-BASED DIMENSIONALITY REDUCTION AND ANALYSIS (GNDA) #
# #
# Written by: Zsolt T. Kosztyan*, Marcell T. Kurbucz, Attila I. Katona, #
# Zahid Khan #
# *Department of Quantitative Methods #
# University of Pannonia, Hungary #
# kosztyan.zsolt@gtk.uni-pannon.hu #
# #
# Last modified: February 2024 #
#-----------------------------------------------------------------------------#
######## MATRIX-BASED DISTANCE COVARIANCE ########
#' @export
dCov<-function(x,y=NULL){
if (!requireNamespace("energy", quietly = TRUE)) {
stop(
"Package \"energy\" must be installed to use this function.",
call. = FALSE
)
}
if (is.null(y)){
if (is.data.frame(x)|is.matrix(x)){
dC<-matrix(0,nrow=ncol(x),ncol=ncol(x))
for (i in c(1:ncol(x))){
for (j in c(1:ncol(x))){
dC[i,j]<-energy::dcov(x[,i],x[,j])
}
}
rownames(dC)<-colnames(x)
colnames(dC)<-colnames(x)
dCov<-dC
dCov
}else{
stop("Error: x must be a matrix or a dataframe!")
dCov<-NULL
}
}else{
dCov<-energy::dcov(x,y)
dCov
}
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.