View source: R/components.iva.R
| components.iva | R Documentation |
Returns the estimated source components of object of class "iva".
components.iva(object, which.dataset = NA, ...)
object |
an object of class |
which.dataset |
positive integer. Provides the index in case the unmixing matrix only for a specific data set is desired. Default is to return all unmixing matrices. |
... |
further arguments are not used. |
Returns the estimated source components for all datasets or only for the requested dataset.
Estimated source components for requested dataset or for all datasets of the object of class "iva". If a single dataset is requested, it is an array with dimension [P, N] and if all datasets are requested, it is an array with dimension [P, N, D].
Mika Sipilä
NewtonIVA, fastIVA
if (require("LaplacesDemon")) {
# Generate sources from multivariate Laplace distribution
P <- 4; N <- 1000; D <- 4;
S <- array(NA, c(P, N, D))
for (i in 1:P) {
U <- array(rnorm(D * D), c(D, D))
Sigma <- crossprod(U)
S[i, , ] <- rmvl(N, rep(0, D), Sigma)
}
# Generate mixing matrices from standard normal distribution
A <- array(rnorm(P * P * D), c(P, P, D))
# Generate mixtures
X <- array(NaN, c(P, N, D))
for (d in 1:D) {
X[, , d] <- A[, , d] %*% S[, , d]
}
# Estimate sources and unmixing matrices
res_G <- NewtonIVA(X, source_density = "gaussian")
# Source estimates for all D datasets
components.iva(res_G)
# Source estimates for the second dataset
components.iva(res_G, 2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.