R/MB_Ac.R

Defines functions MB_Ac

Documented in MB_Ac

MB_Ac <-
function(pair_mat,ts){
lgmx = length(pair_mat)
lcorr= rep(NA,lgmx)
l_ts = length(ts)
for(i in 1:lgmx){
x = ts[pair_mat[[i]][1,]]
y = ts[pair_mat[[i]][2,]]
tmp = try(cor(x,y,use = 'complete.obs'),silent=TRUE)
if(inherits(tmp,'try-error')==0 && is.na(tmp)==0){
if((round(tmp,3) > -1) && (round(tmp,3) < 1)){
lcorr[i] <- tmp
}
} 
}
return(lcorr)
}

Try the ADTSA package in your browser

Any scripts or data that you put into this service are public.

ADTSA documentation built on May 29, 2024, 11:48 a.m.