The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
matrixCorr
computes correlation and related association
matrices from small to high-dimensional data using simple, consistent
functions and sensible defaults. It includes shrinkage and robust
options for noisy or p ≥ n settings, plus convenient
print/plot methods. Performance-critical paths are implemented in C++
with BLAS/OpenMP and memory-aware symmetric updates. The API accepts
base matrices and data frames and returns standard R objects via a
consistent S3 interface.
Supported measures include Pearson, Spearman, Kendall, distance correlation, partial correlation, and robust biweight mid-correlation; agreement tools cover Bland–Altman (two-method and repeated-measures) and Lin’s concordance correlation coefficient (including repeated-measures LMM/REML extensions).
Rcpp
pearson_corr()
,
spearman_rho()
, kendall_tau()
biweight_mid_corr()
)distance_corr()
)partial_correlation()
)schafer_corr()
)bland_altman()
and
repeated-measures bland_altman_repeated()
),ccc()
, repeated-measures LMM/REML
ccc_lmm_reml()
and non-parametric
ccc_pairwise_u_stat()
)# Install from GitHub
# install.packages("devtools")
::install_github("Prof-ThiagoOliveira/matrixCorr") devtools
library(matrixCorr)
set.seed(1)
<- as.data.frame(matrix(rnorm(300 * 6), ncol = 6))
X names(X) <- paste0("V", 1:6)
<- pearson_corr(X)
R_pear <- spearman_rho(X)
R_spr <- kendall_tau(X)
R_ken
print(R_pear, digits = 2)
plot(R_spr) # heatmap
set.seed(2)
<- X
Y # inject outliers
$V1[sample.int(nrow(Y), 8)] <- Y$V1[sample.int(nrow(Y), 8)] + 8
Y
<- biweight_mid_corr(Y)
R_bicor print(R_bicor, digits = 2)
set.seed(3)
<- 60; p <- 200
n <- matrix(rnorm(n * p), n, p)
Xd colnames(Xd) <- paste0("G", seq_len(p))
<- schafer_corr(Xd)
R_shr print(R_shr, digits = 2, max_rows = 6, max_cols = 6)
<- partial_correlation(X)
R_part print(R_part, digits = 2)
<- distance_corr(X)
R_dcor print(R_dcor, digits = 2)
set.seed(4)
<- rnorm(120, 100, 10)
x <- x + 0.5 + rnorm(120, 0, 8)
y
<- bland_altman(x, y)
ba print(ba)
plot(ba)
set.seed(5)
<- 20; Tm <- 6
S <- rep(seq_len(S), each = Tm)
subj <- rep(seq_len(Tm), times = S)
time
<- rnorm(S, 50, 6)[subj] + (time - mean(time)) * 0.4
true <- true + rnorm(length(true), 0, 2)
mA <- true + 1.0 + rnorm(length(true), 0, 2.2)
mB <- 0.95 * true + rnorm(length(true), 0, 2.5)
mC
<- rbind(
dat data.frame(y = mA, subject = subj, method = "A", time = time),
data.frame(y = mB, subject = subj, method = "B", time = time),
data.frame(y = mC, subject = subj, method = "C", time = time)
)$method <- factor(dat$method, levels = c("A","B","C"))
dat
<- bland_altman_repeated(
ba_rep data = dat, response = "y", subject = "subject",
method = "method", time = "time",
include_slope = FALSE, use_ar1 = FALSE
)summary(ba_rep)
# plot(ba_rep) # faceted BA scatter by pair
# Lin's CCC for x vs y (with CI + heatmap)
cc2 <- ccc(cbind(x = x, y = y), ci = TRUE)
print(cc2)
summary(cc2)
plot(cc2, title = "Lin's CCC (two methods)")
set.seed(6)
<- 30; Tm <- 8
S <- factor(rep(seq_len(S), each = 2 * Tm))
id <- factor(rep(rep(c("A","B"), each = Tm), times = S))
method <- rep(rep(seq_len(Tm), times = 2), times = S)
time
<- rnorm(S, 0, 0.8)[as.integer(id)]
u <- rnorm(S * Tm, 0, 0.5)
g <- g[ (as.integer(id) - 1L) * Tm + as.integer(time) ]
g <- (method == "B") * 0.3 + u + g + rnorm(length(id), 0, 0.7)
y
<- data.frame(y, id, method, time)
dat_ccc
# Using non-parametric approch
<- ccc_pairwise_u_stat(
ccc_rep_u data = dat_ccc, response = "y", method = "method", time = "time",
ci = TRUE
)print(ccc_rep_u)
summary(ccc_rep_u)
plot(ccc_rep_u, title = "Repeated-measures CCC (U-statistic)")
# Using LMM approch
<- ccc_lmm_reml(dat_ccc, response = "y", rind = "id",
fit_ccc method = "method", time = "time", ci = TRUE)
summary(fit_ccc) # overall CCC, variance components, SEs/CI
Issues and pull requests are welcome. Please see
CONTRIBUTING.md
for guidelines and
cran-comments.md
/DESCRIPTION
for package
metadata.
See inst/LICENSE for the full MIT license text.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.