procGPA                package:shapes                R Documentation

_G_e_n_e_r_a_l_i_s_e_d _P_r_o_c_r_u_s_t_e_s _a_n_a_l_y_s_i_s

_D_e_s_c_r_i_p_t_i_o_n:

     Generalised Procrustes analysis to register landmark
     configurations into optimal registration using translation, 
     rotation and scaling. Reflection invariance can also be chosen,
     and registration without scaling is also an option. Also, obtains
     principal  components, and some summary statistics.

_U_s_a_g_e:

     procGPA(x, scale = TRUE, reflect = FALSE, eigen2d = TRUE, 
     tol1 = 1e-05, tol2 = tol1, approxtangent = TRUE, proc.output=FALSE, 
     distances=TRUE, pcaoutput=TRUE)

_A_r_g_u_m_e_n_t_s:

       x: Input k x m x n real array, (or k x n complex  matrix for m=2
          is OK), where k is the number of points, m  is the number of
          dimensions, and n is the sample size. 

   scale: Logical quantity indicating if scaling is required

 reflect: Logical quantity indicating if reflection  is required

 eigen2d: Logical quantity indicating if complex eigenanalysis  should
          be used to calculate Procrustes mean for 2D case when 
          scale=TRUE, reflect=FALSE

    tol1: Tolerance for optimal rotation for the iterative  algorithm:
          tolerance on the mean sum of squares  (divided by size of
          mean squared) between successive iterations

    tol2: tolerance for rescale/rotation step for the iterative 
          algorithm: tolerance on the mean sum of squares  (divided by
          size of mean squared) between successive iterations

approxtangent: Logical quantity indicating if the approximate tangent 
          coordinates (Procrustes residuals) should be given if TRUE,
          or the partial  tangent coordinates (see tan below) if FALSE

proc.output: Logical quantity indicating if printed output during the
          iterations of the Procrustes GPA algorithm should be given

distances: Logical quantity indicating if shape distances and sizes 
          should be calculated

pcaoutput: Logical quantity indicating if PCA should be carried out

_V_a_l_u_e:

     A list with components 

       k: no of landmarks

       m: no of dimensions (m-D dimension configurations)

       n: sample size

  mshape: Procrustes mean shape. Note this is unit size if complex 
          eigenanalysis used, but on the scale of the data if iterative
          GPA is used.

     tan: If approxtangent=TRUE this is the mk x n matrix of 
          Procrustes approximate tangent coordinates $X_i^P$ - Xbar ,
          where Xbar = mean($X_i^P$), which are also known as the 
          Procrustes residuals. If approxtangent=FALSE this is  the
          km-m x n matrix of partial Procrustes tangent coordinates
          with pole given by the preshape of the Procrustes mean

 rotated: the k x m x n array of full Procrustes  rotated data

    pcar: the columns are eigenvectors (PCs) of the sample  covariance
          Sv of tan

   pcasd: the square roots of eigenvalues of Sv using tan (s.d.'s of
          PCs)

 percent: the percentage of variability explained by the PCs using tan

    size: the centroid sizes of the configurations

  scores: standardised PC scores (each with unit variance) using  tan

rawscores: raw PC scores using tan

     rho: Kendall's Riemannian distance $\rho$ to the mean shape

  rmsrho: r.m.s. of rho

   rmsd1: r.m.s. of full Procrustes distances to the mean shape $d_F$

_A_u_t_h_o_r(_s):

     Ian Dryden, with input from Mohammad Faghihi and Alfred Kume

_R_e_f_e_r_e_n_c_e_s:

     Dryden, I.L. and Mardia, K.V. (1998). Statistical  Shape Analysis,
     Wiley, Chichester. 

     Goodall, C.R. (1991). Procrustes methods in the statistical
     analysis  of shape (with discussion). Journal of the Royal
     Statistical Society,  Series B, 53: 285-339. 

     Gower, J.C. (1975). Generalized Procrustes analysis,
     Psychometrika, 40, 33-50. 

     Kent, J.T. (1994). The complex Bingham distribution and shape
     analysis, Journal of the Royal Statistical Society, Series B, 56,
     285-299.

     Ten Berge, J.M.F. (1977). Orthogonal Procrustes rotation for two
     or more  matrices. Psychometrika, 42, 267-276.

_S_e_e _A_l_s_o:

     procOPA,riemdist,shapepca,testmeanshapes

_E_x_a_m_p_l_e_s:

     #2D example : female and male Gorillas (cf. Dryden and Mardia, 1998)

     data(gorf.dat)
     data(gorm.dat)

     plotshapes(gorf.dat,gorm.dat)
     n1<-dim(gorf.dat)[3]
     n2<-dim(gorm.dat)[3]
     k<-dim(gorf.dat)[1]
     m<-dim(gorf.dat)[2]
     gor.dat<-array(0,c(k,2,n1+n2))
     gor.dat[,,1:n1]<-gorf.dat
     gor.dat[,,(n1+1):(n1+n2)]<-gorm.dat

     gor<-procGPA(gor.dat)
     shapepca(gor,type="r",mag=3)
     shapepca(gor,type="v",mag=3)

     gor.gp<-c(rep("f",times=30),rep("m",times=29))
     x<-cbind(gor$size,gor$rho,gor$scores[,1:3])
     pairs(x,panel=function(x,y) text(x,y,gor.gp),
        label=c("s","rho","score 1","score 2","score 3"))

     ##########################################################
     #3D example

     data(macm.dat)
     out<-procGPA(macm.dat,scale=FALSE)

     par(mfrow=c(2,2))
     plot(out$rawscores[,1],out$rawscores[,2],xlab="PC1",ylab="PC2")
     title("PC scores")
     plot(out$rawscores[,2],out$rawscores[,3],xlab="PC2",ylab="PC3")
     plot(out$rawscores[,1],out$rawscores[,3],xlab="PC1",ylab="PC3")
     plot(out$size,out$rho,xlab="size",ylab="rho")
     title("Size versus shape distance")

