VPSPulse Mirrors

High-Performance Open-Source Archive

Low Dimensional Example of MultiEFM

Low Dimensional Example of MultiEFM

Ruihan Zhang and Wei Liu

2026-07-19

This vignette introduces the usage of MultiEFM for the analysis of low-dimensional multi-study multivariate data with heavy tail.

The package can be loaded with the command, and define some metric functions:

library(MultiEFM)
library(irlba)   

trace_statistic_fun <- function(H, H0){
  tr_fun <- function(x) sum(diag(x))
  mat1 <- t(H0) %*% H %*% qr.solve(t(H) %*% H) %*% t(H) %*% H0
  return(tr_fun(mat1) / tr_fun(t(H0) %*% H0))
}
trace_list_fun <- function(Hlist, H0list){
  trvec <- sapply(seq_along(Hlist), function(i) trace_statistic_fun(Hlist[[i]], H0list[[i]]))
  return(mean(trvec, na.rm = TRUE))
}

Generate simulated data

First, we generate the simulated data with heavy tail, where the error term follows from a multivariate t-distribution with degree of freedom 2.

set.seed(1)
nu <- 2 
p <- 100
nvec <- c(150, 200);  q <- 3; qs <- c(2, 2); S <- length(nvec)
sigma2_eps <- 1
datList <- gendata_simu_robust(seed=1, nvec=nvec, p=p, q=q, qs=qs, rho=c(5,5), err.type='mvt', nu=nu)
XList <- datList$Xlist

Fit the MultiEFM model

Fit the MultiEFM model using the function ‘MultiEFM()’ in the R package ‘MultiEFM’. Users can use ‘?MultiEFM’ to see the details about this function. For two matrices \(\widehat D\) and \(D\), we use trace statistic to measure their similarity. The trace statistic ranges from 0 to 1, with higher values indicating better performance.

tic <- proc.time()
res <- MultiEFM(XList, q=q, qs_vec=qs, verbose = FALSE)
toc <- proc.time()
time_use <- toc[3] - tic[3]

Performance Evaluation

We summarized the estimation accuracy metrics for MultiEFM by calculating the trace statistics for loading and factor score matrices against the true parameters.

results <- data.frame(
  Metric = c('Shared Loading (A)', 'Specific Loading (B)', 'Shared Factor (F)', 'Specific Factor (H)', 'Time (s)'),
  Value = c(trace_statistic_fun(res$A, datList$A0),
            trace_list_fun(res$B, datList$Blist0),
            trace_list_fun(res$F, datList$Flist),
            trace_list_fun(res$H, datList$Hlist),
            time_use)
)
print(results)
#>                 Metric     Value
#> 1   Shared Loading (A) 0.9988286
#> 2 Specific Loading (B) 0.9964651
#> 3    Shared Factor (F) 0.9799048
#> 4  Specific Factor (H) 0.9704276
#> 5             Time (s) 0.3400000

Select the parameters

We applied the proposed TSP method to select the number of factors. The results showed that the method has the potential to identify the true values.

hq_res <- selectFac.MultiEFM(XList, q_max=10, qs_max=5, verbose = FALSE)
message("Estimated shared q = ", hq_res$hq, " VS true q = ", q)
Session Info
sessionInfo()
#> R version 4.4.1 (2024-06-14 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 11 x64 (build 26200)
#> 
#> Matrix products: default
#> 
#> 
#> locale:
#> [1] LC_COLLATE=C                               
#> [2] LC_CTYPE=Chinese (Simplified)_China.utf8   
#> [3] LC_MONETARY=Chinese (Simplified)_China.utf8
#> [4] LC_NUMERIC=C                               
#> [5] LC_TIME=Chinese (Simplified)_China.utf8    
#> 
#> time zone: Asia/Shanghai
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] irlba_2.3.7    Matrix_1.7-0   MultiEFM_0.1.3
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.39     R6_2.6.1          fastmap_1.2.0     xfun_0.56        
#>  [5] lattice_0.22-6    cachem_1.1.0      knitr_1.51        htmltools_0.5.9  
#>  [9] rmarkdown_2.30    lifecycle_1.0.5   mvtnorm_1.4-1     cli_3.6.5        
#> [13] grid_4.4.1        sass_0.4.10       jquerylib_0.1.4   compiler_4.4.1   
#> [17] rstudioapi_0.18.0 tools_4.4.1       evaluate_1.0.5    bslib_0.10.0     
#> [21] Rcpp_1.1.1-1.1    yaml_2.3.12       otel_0.2.0        jsonlite_2.0.0   
#> [25] rlang_1.2.0       MASS_7.3-65

Need mirroring services?
Contact our team at info@vpspulse.com.

Mirror powered by VPSpulse

Infrastructure sponsored by VPSPulse & Secure Payments by ArionPay.