lgpa | R Documentation |
We modify generalized Procrustes analysis for large-scale data by
first setting a subset of anchor points and applying the attained transformation
to the rest data. If sub.id
is a vector 1:dim(x)[1]
, it uses all
observations as anchor points, reducing to the conventional generalized Procrustes analysis.
lgpa(x, sub.id = 1:(dim(x)[1]), scale = TRUE, reflect = FALSE)
x |
a |
sub.id |
a vector of indices for defining anchor points. |
scale |
a logical; |
reflect |
a logical; |
a (k\times m\times n)
3d array of aligned samples.
Kisung You
goodall_procrustes_1991maotai
## Not run:
## This should be run if you have 'shapes' package installed.
library(shapes)
data(gorf.dat)
## apply anchor-based method and original procGPA
out.proc = shapes::procGPA(gorf.dat, scale=TRUE)$rotated # procGPA from shapes package
out.anc4 = lgpa(gorf.dat, sub.id=c(1,4,9,7), scale=TRUE) # use 4 points
out.anc7 = lgpa(gorf.dat, sub.id=1:7, scale=TRUE) # use all but 1 point as anchors
## visualize
opar = par(no.readonly=TRUE)
par(mfrow=c(3,4), pty="s")
plot(out.proc[,,1], main="procGPA No.1", pch=18)
plot(out.proc[,,2], main="procGPA No.2", pch=18)
plot(out.proc[,,3], main="procGPA No.3", pch=18)
plot(out.proc[,,4], main="procGPA No.4", pch=18)
plot(out.anc4[,,1], main="4 Anchors No.1", pch=18, col="blue")
plot(out.anc4[,,2], main="4 Anchors No.2", pch=18, col="blue")
plot(out.anc4[,,3], main="4 Anchors No.3", pch=18, col="blue")
plot(out.anc4[,,4], main="4 Anchors No.4", pch=18, col="blue")
plot(out.anc7[,,1], main="7 Anchors No.1", pch=18, col="red")
plot(out.anc7[,,2], main="7 Anchors No.2", pch=18, col="red")
plot(out.anc7[,,3], main="7 Anchors No.3", pch=18, col="red")
plot(out.anc7[,,4], main="7 Anchors No.4", pch=18, col="red")
par(opar)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.