library(SOMbrero)
data(cars, package="datasets")
names(cars)
plot(cars$speed, cars$dist)
dim(cars)
auto<- trainSOM(cars[, c(1,2)],maxit=2000, nb.save=10, dimension=c(3,3), scaling="center")
names(auto)
summary(auto)
auto$clustering; auto$parameters
plot(auto, what="energy") plot(auto, what="obs", type="hitmap") table(auto$clustering)
plot(cars$speed, cars$dist, col=auto$clustering)
par(mfrow=c(1,2)) proto<- auto$prototypes plot(auto, what="prototypes", type="color", var=1, main="prototypes - speed")
plot(auto, what="prototypes", type="color", var=2, main="prototypes - dist")
par(mfrow=c(1,1))
plot(auto, what="obs", type="lines", print.title=TRUE) plot(auto, what="prototypes", type="barplot", print.title=TRUE)
plot(iris.som, what="obs", type="radar", key.loc=c(-0.5,5), mar=c(0,10,2,0))
plot(iris.som, what="obs", type="boxplot", print.title=TRUE)
plot(iris.som, what="obs", type="names", print.title=TRUE, scale=c(0.9,0.5))
plot(iris.som, what="prototypes", type="poly.dist")
plot(iris.som, what="prototypes", type="umatrix")
plot(iris.som, what="prototypes", type="smooth.dist")
plot(auto$backup$prototypes[[10]])
dev.new();plot(auto$backup$prototypes[[1]])
cars$grupo<- factor(rep(c(1,2,3), c(20,20,10)))
id<- 1:50
g<- table(id, cars$grupo); g[1:10,]
plot(auto, what="add", type="pie", variable=iris$Species) plot(auto, what="add", type="words", variable=g) plot(auto, what="add", type="names", variable= auto$grupo)
plot(superClass(auto)) C3 <- superClass(auto, k=3) summary(C3)
plot(C3, plot.var=FALSE)
plot(C3, type="grid", plot.legend=TRUE) plot(auto, what="add", type="names", variable=rownames(cars), scale=c(0.9,0.5))
par(mfrow=c(1,2)) plot(auto, what="obs", type="color", var=1, main="valores - x1")
plot(auto, what="obs", type="color", var=2, main="valores - x2")
par(mfrow=c(1,1))
table(auto$clustering)
names(cars)
by(cars$speed, summary)
mean(proto[1:9,2])
summary(cars)
auto$backup
library(abind, pos=18)
library(e1071, pos=19)
numSummary(cars[,"dist"], statistics=c("mean", "sd", "IQR", "quantiles"), quantiles=c(0,.25,.5,.75,1))
numSummary(cars[,"speed"], statistics=c("mean", "sd", "IQR", "quantiles"), quantiles=c(0,.25,.5,.75,1))
pepe<- predict(auto, cars)
table(pepe, auto$clustering)