trajectory.analysis(f1, data = NULL, estimate.traj = TRUE,
traj.pts = NULL, iter = 99)
two.d.array
can be used to obtain a
two-dimensional data matrix from a 3D array of landmark
coordinates. It is assumed that the order of the specimens
'Y' matches the order of specimens in 'X'.
There are two primary modes of analysis through this
function. If "estimate.traj=TRUE" the function estimates
shape trajectories using the least-squares means for
groups, based on a two-factor model (e.g., Y~A+B+A:B).
Under this implementation, the last factor in 'X' must be
the interaction term, and the preceding two factors must be
the effects of interest. Covariates may be included in 'X',
and must precede the factors of interest (e.g., Y~cov+A*B).
In this implementation, 'Y' contains a matrix of landmark
coordinates. It is assumed that the landmarks have
previously been aligned using Generalized Procrustes
Analysis (GPA) [e.g., with gpagen
].
If "estimate.traj=FALSE" the trajectories are assembled
directly from the set of shapes provided in 'Y'. With this
implementation, the user must specify the number of shapes
that comprise each trajectory. This approach is useful when
the set of shapes forming each trajectory have been
quantified directly (e.g., when motion paths are compared:
see Adams and Cerney 2007). With this implementation,
variation in trajectory size, shape, and orientation are
evaluated for each term in 'X'.(see Adams and Cerney 2007).
Once the function has performed the analysis, it generates
a plot of the trajectories as visualized in the space of
principal components (PC1 vs. PC2). The first point in each
trajectory is displayed as white, the last point is black,
and any middle points on the trajectories are in gray. The
colors of trajectories follow the order in which they are
found in the dataset, using R's standard color palette:
black, red, green3, blue, cyan, magenta, yellow, and gray.#1: Estimate trajectories from LS means in 2-factor model
data(plethodon)
Y.gpa<-two.d.array(gpagen(plethodon$land)$coords)
trajectory.analysis(Y.gpa~plethodon$species*plethodon$site,iter=15)
#2: Compare motion trajectories
data(motionpaths)
#Motion paths represented by 5 time points per motion
trajectory.analysis(motionpaths$trajectories~motionpaths$groups,
estimate.traj=FALSE, traj.pts=5,iter=15)
Run the code above in your browser using DataLab