Description Usage Arguments Value Author(s) Examples
Uses random directions, clustering and optimisation to obtain ICA loadings, using the m-spacing entropy estimation as the objective function to minimise.
1 2 3 | clusterICA(X, p.ica = -1, p.whiten = -1, rand.iter = -1, m = -1,
kmean.tol = 0.1, opt.maxit = 5000, opt.method = "BFGS",
fast.init = NA, compute.scores = TRUE, verbose = FALSE)
|
X |
the data to perform ICA on, ncol(x) = n, nrow(x) = p |
p.ica |
the number of ICA loadings outputted |
p.whiten |
(optional) the size of the whitened matrix, i.e. how many PCA loadings to keep in the whitening step |
rand.iter |
the number of random directions to initialise |
m |
(optional) the value of m-spacing for calculating approximate entropy, if missing(m), m <- sqrt(n) |
kmean.tol |
the tolerance used in divisive clustering, see clusterProjDivisive |
opt.maxit |
the maximum number of iterations used in the optimisation step, see optim |
opt.method |
the method used in the optimisation step, see optim |
fast.init |
if TRUE then the objective function used in the fastICA method is optimised to find an extra direction to cluster |
compute.scores |
if TRUE then scores of the whitened data are outputted |
verbose |
if TRUE then information is given on the status of the function |
An object of class ‘coords’, with the following additional components added:
X Centered data matrix
Y Whitened data matrix, found using jvcoords::whiten(x)
S Matrix of source signal estimates
W Estimated unmixing matrix, S = X t(W)
R Orthogonal rotation matrix, S = Y R
entr The m-spacing entropy of each column of S
Paul Smith, mmpws@leeds.ac.uk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #---------------------------------------------------
#Example 1: un-mixing two stratified independent normals
#---------------------------------------------------
p <- 2
n <- 10000
set.seed(1243)
x1 <- matrix(rnorm(n*p, mean = 2.5), n, p)
x1[,2] <- scale(x1[,2])
a1 <- c(0.2,1)
a1 <- a1 / sqrt(sum(a1^2))
good1 <- cos(20 * x1 %*% a1) >= 0
x1Good <- x1[which(good1),]
x2 <- matrix(rnorm(n*p, mean = -2.5), n , p)
x2[,2] <- scale(x2[,2])
good2 <- cos(20 * x2 %*% a1) >= 0
x2Good <- x2[which(good2),]
xGood <- rbind(x1Good, x2Good)
a <- clusterICA(X=xGood, p.ica=1, rand.iter=1000)
par(mfrow = c(1,3))
plot(xGood, main = "Pre-processed data")
plot(a$Y, main = "Whitened data")
plot(density(a$S, bw="sj"), main = "ICA components")
#---------------------------------------------------
#Example 2: un-mixing two mixed independent uniforms
#From fastICA man page
#---------------------------------------------------
S <- matrix(runif(10000), 5000, 2)
A <- matrix(c(1, 1, -1, 3), 2, 2, byrow = TRUE)
X <- S %*% A
a <- clusterICA(X, p.whiten=2, rand.iter=1000)
par(mfrow = c(1, 3))
plot(X, main = "Pre-processed data")
plot(a$Y, main = "Whitened data")
plot(a$S, main = "ICA components")
#---------------------------------------------------
#Example 3: un-mixing iris data
#---------------------------------------------------
a <- clusterICA(iris[,1:4])
plot(a$S, main = "ICA components")
pairs(a$S, col=iris$Species)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.