View source: R/parafac_functions.R
eem_parafac | R Documentation |
One or more PARAFAC models can be calculated depending on the number of components. The idea is to compare the different models to get the most suitable. B-mode is emmission wavelengths, C-mode is excitation wavelengths and, A-mode is the loadings of the samples. The calculation is done with parafac
, please see details there.
eem_parafac(
eem_list,
comps,
maxit = 2500,
normalise = TRUE,
const = c("nonneg", "nonneg", "nonneg"),
nstart = 30,
ctol = 10^-8,
strictly_converging = FALSE,
cores = parallel::detectCores(logical = FALSE),
verbose = FALSE,
output = "best",
...
)
eem_list |
object of class |
comps |
vector containing the desired numbers of components. For each of these numbers one model is calculated |
maxit |
maximum iterations for PARAFAC algorithm |
normalise |
state whether EEM data should be normalised in advance |
const |
constraints of PARAFAC analysis. Default is non-negative ("nonneg"), alternatively smooth and non-negative ("smonon") might be interesting for an EEM analysis. |
nstart |
number of random starts |
ctol |
Convergence tolerance (R^2 change) |
strictly_converging |
calculate nstart converging models and take the best. Please see details! |
cores |
number of parallel calculations (e.g. number of physical cores in CPU) |
verbose |
print infos |
output |
Output the |
... |
additional parameters that are passed on to |
PARAFAC models are created based on multiple random starts. In some cases, a model does not converge and the resulting model is then based on less than nstart converging models. In case you want to have nstart converging models, set strictly_converging TRUE. This calculates models stepwise until the desired number is reached but it takes more calculation time. Increasing the number of models from the beginning is much more time efficient.
object of class parafac
parafac
data(eem_list)
dim_min <- 3 # minimum number of components
dim_max <- 7 # maximum number of components
nstart <- 25 # random starts for PARAFAC analysis, models built simulanuously, best selected
# cores <- parallel::detectCores(logical=FALSE) # use all cores but do not use all threads
cores <- 2 # package checks only run with 2 cores
maxit = 2500
ctol <- 10^-7 # tolerance for parafac
pfres_comps <- eem_parafac(eem_list, comps = seq(dim_min, dim_max),
normalise = TRUE, maxit = maxit, nstart = nstart, ctol = ctol, cores = cores)
## with a defined number of converging models
#pfres_comps <- eem_parafac(eem_list, comps = seq(dim_min, dim_max),
# normalise = TRUE, maxit = maxit, nstart = nstart, ctol = ctol,
# output = "all", strictly_converging = TRUE, cores = cores, verbose = TRUE)
pfres_comps2 <- eem_parafac(eem_list, comps = seq(dim_min, dim_max),
normalise = TRUE, maxit = maxit, nstart = nstart, ctol = ctol, cores = cores, output = "all")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.