Run_real/plot_cca.R

library(corrplot)
library(CCA)
M <- cor(X[, , 3])
#corrplot(M, method = "circle")
corrplot.mixed(M)


M <- cor(Z)
#corrplot(M, method = "circle")
corrplot.mixed(M)


matcor(Z_ITG[, 1:5], Z_ITG[, 6:10])
group <- matrix(1:(p*df_beta), nrow = df_beta)

cc <- matrix(NA, nrow = Nzero_group, ncol = p - Nzero_group)
for(j in 1L:Nzero_group){
  for(i in 1L:(p - Nzero_group)){
    #cat(i, "\r\n")
    cc[j, i] <- max(cc( Z_ITG[, group[, j]], Z_ITG[, group[, Nzero_group+i]])$cor)
  }
}

rowMeans(cc)

cc2 <- matrix(NA, nrow = Nzero_group, ncol = p - Nzero_group)
for(j in 1L:Nzero_group){
  for(i in 1L:(p - Nzero_group)){
    #cat(i, "\r\n")
    cc[j, i] <- max(cc( X[, group[, j]], X[, group[, Nzero_group+i]])$cor)
  }
}

quadratic_function <- function(a, b, c){
  a <- 1
  b <- -1
  c <- 1
  pos_root <- (-b + sqrt(b^2 - 4*a*c)) / (2*a)
  
  neg_root <- (-b - sqrt((b^2) - 4ac)] / (2*a)
  
  print(pos_root)
  
  print(neg_root)
  
}
jiji6454/Rpac_compReg documentation built on May 31, 2019, 5:01 a.m.