-------- Original Message --------
Subject: RE: procGPA
Date: Wed, 23 Sep 2009 15:38:24 -0700 (PDT)
From: Ian Dryden <[email protected]>
To: <[email protected]>
References: <[email protected]>
Dear Maarten,
These quantities are all computed inside procGPA but they are not
part of the standard output unfortunately. If you have the Procrustes
rotated data and the original data then you can work out
the ordinary Procrustes match of each individual to its
rotated version, which gives you the scale and rotation
(using procOPA). The translation is simply obtained
by centering.
Here is a bit of code that I think does what you want, although
please do check it!
Kind regards,
Ian
=============================================================
transformations<-function(Xrotated,Xoriginal){
# outputs the translations, rotations and
# scalings for ordinary Procrustes rotation
# of each individual in Xoriginal to the
# Procrustes rotated individuals in Xrotated
X1<-Xrotated
X2<-Xoriginal
n<-dim(X1)[3]
m<-dim(X1)[2]
translation<-matrix(0,m,n)
scale<-rep(0,times=n)
rotation<-array(0,c(m,m,n))
for (i in 1:n){
translation[,i]<- -apply(X2[,,i],2,mean)
ans<-procOPA(X1[,,i],X2[,,i])
scale[i]<-ans$s
rotation[,,i]<-ans$R
}
out<-list(translation=0,scale=0,rotation=0)
out$translation<-translation
out$scale<-scale
out$rotation<-rotation
out
}
#################################
library(shapes)
X<- macm.dat
k<-dim(X)[1]
tem<-procGPA(X)
X1<-tem$rotated
X2<-X
out<-transformations(X1,X2)
out
#check on the 3rd individual (expression should be zero)
tem$rotated[,,3] - (X[,,3]+rep(1,times=k)%*%t(out$translation[,3])
)%*%out$rotation[,,3]*out$scale[3]
-----Original Message-----
From: morphmet [mailto:[email protected]]
Sent: Wed 23/09/2009 5:28 PM
To: morphmet
Subject: procGPA
-------- Original Message --------
Subject: procGPA
Date: Wed, 23 Sep 2009 08:47:25 -0700 (PDT)
From: Maarten Grachten <[email protected]>
To: [email protected]
Dear all,
I am using the function procGPA (shapes package) in R to do a Procrustes
analysis on a data set. From the resulting object, I would like to
obtain the transformation parameters (rotation matrices, scaling
factors, and translations) for each of the samples, in order to
transform additional data points that were not used in the GPA. Is there
a way to do this?
Thanks in advance for any help!
Maarten Grachten
--
Replies will be sent to the list.
For more information visit http://www.morphometrics.org
This message has been checked for viruses but the contents of an
attachment may still contain software viruses, which could damage your
computer system: you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.
--
Replies will be sent to the list.
For more information visit http://www.morphometrics.org