-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into aqpdf # Conflicts: # man/profile_compare-methods.Rd
- Loading branch information
Showing
5 changed files
with
88 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,18 @@ | ||
# check results via MDS | ||
library(MASS) | ||
s <- sammon(d) | ||
s.2 <- sammon(d.2) | ||
s.10 <- sammon(d.10) | ||
s.20 <- sammon(d.20) | ||
library(aqp) | ||
library(sharpshootR) | ||
library(cluster) | ||
|
||
# check | ||
plot(s$points, axes=FALSE, xlab='', ylab='') ; box() | ||
points(s.2$points, col=2, cex=0.75) | ||
points(s.10$points, col=4, cex=0.5) | ||
points(s.20$points, col=5, cex=0.25) | ||
|
||
# convert to mostly consistent scale | ||
sp <- scale(s$points) | ||
sp.2 <- scale(s.2$points) | ||
sp.10 <- scale(s.10$points) | ||
sp.20 <- scale(s.20$points) | ||
# this has been a problem for years, alpha-sorting changes ordering | ||
set.seed(1010101) | ||
s <- union(lapply(letters[1:10], random_profile, n_prop=3, method='LPP', SPC=TRUE)) | ||
|
||
# label mid-points | ||
label.pos <- rbind( | ||
(sp.2 + sp) / 2, | ||
(sp.10 + sp.2) / 2, | ||
(sp.20 + sp.10) / 2 | ||
) | ||
pr <- princomp(horizons(s)[, c('p1', 'p2', 'p3')], cor = TRUE) | ||
s$pc.1 <- pr$scores[, 1] | ||
|
||
|
||
d <- profile_compare(s, vars=c('p1','p2', 'p3'), max_d=100, k=0, rescale.result=TRUE) | ||
hc <- diana(d) | ||
|
||
(plotProfileDendrogram(s, hc, color='pc.1', debug = TRUE, width=0.25)) | ||
|
||
# check | ||
plot(rbind(sp,sp.2,sp.10,sp.20), type='n', axes=FALSE, xlab='', ylab='') ; box() | ||
points(rbind(sp,sp.2,sp.10,sp.20), pch=15, col=rep(1:4, each=9), cex=0.75) | ||
text(label.pos, label=rep(1:3, each=9), cex=0.75, pos=1) | ||
arrows(sp[,1], sp[,2], sp.2[,1], sp.2[,2], len=0.08, col='grey') | ||
arrows(sp.2[,1], sp.2[,2], sp.10[,1], sp.10[,2], len=0.08, col='grey') | ||
arrows(sp.10[,1], sp.10[,2], sp.20[,1], sp.20[,2], len=0.08, col='grey') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters