An optimized version of the LSS analysis that avoids creating large intermediate matrices, providing a significant speedup and lower memory usage for the pure R implementation.
Examples
set.seed(1)
Y <- matrix(rnorm(16), 8, 2)
X_trials <- matrix(0, 8, 2)
X_trials[2:3, 1] <- 1
X_trials[5:6, 2] <- 1
bdes <- list(
dmat_base = matrix(1, 8, 1),
dmat_ran = X_trials,
dmat_fixed = NULL,
fixed_ind = NULL
)
lss_optimized(Y, bdes, use_cpp = FALSE)
#> [,1] [,2]
#> [1,] -0.8746378 0.09179092
#> [2,] -0.7941255 -1.92937571