# import data
data("iris")
X <- iris[,-5]
# run ICS
out_ICS <- ICS(X)
out_ICS
summary(out_ICS)
# extract generalized eigenvalues
gen_kurtosis(out_ICS)
# Plot
screeplot(out_ICS)
# extract the components
components(out_ICS)
components(out_ICS, select = 1:2)
# Plot
plot(out_ICS)
# equivalence with previous functions
out_ics <- ics(X, S1 = cov, S2 = cov4, stdKurt = FALSE)
out_ics
out_ics2 <- ics2(X, S1 = MeanCov, S2 = Mean3Cov4)
out_ics2
out_ICS
# example using two functions
X1 <- rmvnorm(250, rep(0,8), diag(c(rep(1,6),0.04,0.04)))
X2 <- rmvnorm(50, c(rep(0,6),2,0), diag(c(rep(1,6),0.04,0.04)))
X3 <- rmvnorm(200, c(rep(0,7),2), diag(c(rep(1,6),0.04,0.04)))
X.comps <- rbind(X1,X2,X3)
A <- matrix(rnorm(64),nrow=8)
X <- X.comps %*% t(A)
ics.X.1 <- ICS(X)
summary(ics.X.1)
plot(ics.X.1)
# compare to
pairs(X)
pairs(princomp(X,cor=TRUE)$scores)
# slow:
if (require("ICSNP")) {
ics.X.2 <- ICS(X, S1 = tyler.shape, S2 = duembgen.shape,
S1_args = list(location=0))
summary(ics.X.2)
plot(ics.X.2)
# example using three pictures
library(pixmap)
fig1 <- read.pnm(system.file("pictures/cat.pgm", package = "ICS")[1],
cellres = 1)
fig2 <- read.pnm(system.file("pictures/road.pgm", package = "ICS")[1],
cellres = 1)
fig3 <- read.pnm(system.file("pictures/sheep.pgm", package = "ICS")[1],
cellres = 1)
p <- dim(fig1@grey)[2]
fig1.v <- as.vector(fig1@grey)
fig2.v <- as.vector(fig2@grey)
fig3.v <- as.vector(fig3@grey)
X <- cbind(fig1.v, fig2.v, fig3.v)
A <- matrix(rnorm(9), ncol = 3)
X.mixed <- X %*% t(A)
ICA.fig <- ICS(X.mixed)
par.old <- par()
par(mfrow=c(3,3), omi = c(0.1,0.1,0.1,0.1), mai = c(0.1,0.1,0.1,0.1))
plot(fig1)
plot(fig2)
plot(fig3)
plot(pixmapGrey(X.mixed[,1], ncol = p, cellres = 1))
plot(pixmapGrey(X.mixed[,2], ncol = p, cellres = 1))
plot(pixmapGrey(X.mixed[,3], ncol = p, cellres = 1))
plot(pixmapGrey(components(ICA.fig)[,1], ncol = p, cellres = 1))
plot(pixmapGrey(components(ICA.fig)[,2], ncol = p, cellres = 1))
plot(pixmapGrey(components(ICA.fig)[,3], ncol = p, cellres = 1))
}
Run the code above in your browser using DataLab