# NOT RUN {
data(larvalMorph)
head.gpa <- gpagen(larvalMorph$headcoords,
curves = larvalMorph$head.sliders)
tail.gpa <- gpagen(larvalMorph$tailcoords,
curves = larvalMorph$tail.sliders)
# Combine original data without GPA (plot to see relative size of
# heads and tails)
all.lm <- combine.subsets(head = larvalMorph$headcoords,
tail = larvalMorph$tailcoords, gpa = FALSE, CS.sets = NULL)
plotAllSpecimens((all.lm$coords))
# Combine with GPA and relative centroid size
comb.lm <- combine.subsets(head = head.gpa, tail = tail.gpa, gpa = TRUE)
summary(comb.lm)
# (configurations are actual relative size)
comb.lm$coords[,,1]
# Plot all specimens and just first specimen and color code landmarks
par(mfrow = c(1,2))
plotAllSpecimens(comb.lm$coords)
plot(comb.lm$coords[,,1], pch = 21, bg = c(rep(1,26),
rep(2,64)), asp = 1)
# Override relative centroid size
comb.lm <- combine.subsets(head = head.gpa$coords,
tail = tail.gpa$coords, gpa = FALSE, CS.sets = NULL)
par(mfrow = c(1,2))
plotAllSpecimens(comb.lm$coords)
plot(comb.lm$coords[,,1], pch = 21, bg = c(rep(1,26),
rep(2,64)), asp = 1)
# Note the head is as large as the tail, which is quite unnatural.
## Normalizing centroid size
comb.lm <- combine.subsets(head = head.gpa,
tail = tail.gpa, gpa = TRUE, norm.CS = TRUE)
summary(comb.lm)
par(mfrow = c(1,2))
plotAllSpecimens(comb.lm$coords)
plot(comb.lm$coords[,,1], pch = 21, bg = c(rep(1,26),
rep(2,64)), asp = 1)
par(mfrow = c(1,1))
# Note that the head is too large, compared to a real specimen.
# This option focuses on average distance of points to centroid,
# but ignores the number of landmarks.
# Consequently,the density of landmarks in the head and tail are
# irrelevant and the head size is inflated because of the fewer
# landmarks in the configuration.
## Weighting centroid size
comb.lm <- combine.subsets(head = head.gpa,
tail = tail.gpa, gpa = TRUE, norm.CS = FALSE, weights = c(0.3, 0.7))
summary(comb.lm)
par(mfrow = c(1,2))
plotAllSpecimens(comb.lm$coords)
plot(comb.lm$coords[,,1], pch = 21, bg = c(rep(1,26),
rep(2,64)), asp = 1)
par(mfrow = c(1,1))
# Note that the head is way too small, compared to a real specimen.
# This option allows one to dictate the relative sizes of subsets
# as portions of the combined set. An option like this should be
# used with caution, but can help overcome issues caused by landmark
# density.
# }
Run the code above in your browser using DataLab