Click on the console window if it's not already open and type:
Then open an xterm window on the theory center
computer by:
You may have to specify your DISPLAY variable
with :
(typed into the xterm
window opened on tc).
>options(gui='motif') >help.start()
>motif() %starts a motif screen
>attach('/afs/theory.cornell.edu/user/user2/sholmes/public/.Data')
>attach('/afs/theory.cornell.edu/user/user2/sholmes/public/MASS/.Data')
help(xgobi) help(brush) help(spin) help(pairs) help(image)Some data :
help(painters) help(crabs) help(shuttle) help(birthwt) help(rock)
Looking at multivariate data graphically:
>xgobi(crabm) %Now try using the brush facility >xgobi(crabm, glyphs = crab[, 1], color =col.poss[crab[, 2]]) >xgobi(crabm,glyphs=gly.poss[crab[,1]],color =col.poss[crab[, 2]]) >xgobi(paintm,color=col.poss[codes(School)]) >xgobi()
Try using the Brush menu to change the colors persistently for each of the 4 groups created by combination of the 2 grouping variables.
Try recording the bitmaps at the optimums of the Friedman Tukey index along the graphic.
Find manually which 2-d projection separates out the groups best.
Save the coefficients of that projection to compare with our latter discriminating algorithms.
(The help facility in xgobi now works with a click on the right button)
help(dist) dist(paintm) round(dist2full(dist(paintm[1:10,])))
ir_rbind(iris[,,1], iris[,,2], iris[,,3])
tree <- mstree(i)
plot(tree, type="n")
text(tree, label=c(rep(1, 50), rep(2, 50), rep(3, 50)))
# get the absolute value stress e
distp <- dist(i)
dist2 <- dist(cbind(tree$x, tree$y))
e <- sum(abs(distp - dist2))/sum(distp)
help(hclust)
sums <- apply(author.count,1,sum)
adjusted <- sweep(author.count,1,sums,"/")
par(mar=c(18,4,4,1))
plclust(hclust(dist(adjusted)),label=dimnames(author.count)[[1]])
title("Clustering of Books Based on Letter Frequency")
h<-hclust(dist(paintm))
plclust(h,labels=School.lab)
x <- hclust(dist(paintm),method='ave')
plclust(x, label = FALSE) # plot without labels
xy <- plclust(x, plot = FALSE)
identify(xy,labels=dimnames(painters)[[1]])
Note: To stop identifying you have to click on the middle
button.
irismean <- t(apply(iris, c(2, 3), 'mean'))
x <- rbind(iris[,,1], iris[,,2], iris[,,3])
km <- kmeans(x, irismean)
wrong <- km$cluster!=rep(1:3, c(50, 50, 50))
spin(x, highlight=wrong)
plot(x[,2], x[,3], type="n")
text(x[!wrong, 2], x[!wrong, 3], km$cluster)
# identify cluster membership that is correct
points(x[wrong, 2], x[wrong, 3], pch=15)
# boxes for points in error
title(main="K-Means Clustering of the Iris Data")
help(lda)
tr <- sample(1:50,25)
train <- rbind(iris[tr,,1],iris[tr,,2],iris[tr,,3])
test <- rbind(iris[-tr,,1],iris[-tr,,2],iris[-tr,,3])
cl <- factor(c(rep("s",25),rep("c",25), rep("v",25)))
z <- lda(train, cl)
predict(z,test)$class
help(supersmu)
help(lowess)
help(spline)
help(smooth)
pairs(vinm[,1:5],panel=function(x,y){ points(x,y); lines(lowess(x,y))})