This package implements the distributed mean dimension reduction algorithm proposed by Zhu et al. (2025). One can refer to my report for more details.
The package can be installed by running the following code in your R console:
install.packages("remotes")
remotes::install_github("Chia202/DMDR")The installation is tested on Ubuntu 24.04 and R 4.3.3. Requires the following packages: Rcpp and RcppArmadillo.
library(DMDR)
set.seed(123)
p = 10 # Dimension of covariate
N = 500 # Total sample size
m = 5 # Number of machines
n = N / m # Sample size on each machine
d = 2 # Number of directions
beta = c(1, 0, 1, 0, 0, 1, 1, -1, rep(0, d * p - 8))
beta = matrix(beta, ncol = d, byrow = TRUE) # Shape (p, d)
x = matrix(rnorm(N * p), ncol = p)
y = rowSums(x %*% beta) + rnorm(N)
df = cbind(x, y)
# Dense sulotion
resDP = dmdrDense(df, m, d)
# Sparse solution
resSP = dmdrSparse(df, m, d)
# Evaluation, the smaller, the better.
cat("Correlation distance lies in [0, 1]\n")
cat(" Dense : ", trCor(beta, resDP), '\n') # 0.421
cat(" Sparse: ", trCor(beta, resSP), '\n') # 0.236-
Z. Zhu, W. Xu, and L. Zhu, “Distributed Mean Dimension Reduction Through Semi-parametric Approaches,” Statistics Sinca, 2025, doi: 10.5705/ss.202022.0157.
-
Y. Ma and L. Zhu, “A Semiparametric Approach to Dimension Reduction,” Journal of the American Statistical Association, 2012, doi: 10.1080/01621459.2011.646925.