Learn R Programming

Momocs (version 0.2-6)

hquant: Calculates deviations between reconstructed and best possible shapes using different distance methods.

Description

hquant is used to estimate the number of harmonics required to describe shapes with the required accuracy. So far, two different methods can be used: edm which calculates point-to-point distance and edm.nearest which calculates for every point of the reconstructed shape the nearest point in the best possible shape. The best possible shape is calculated using the highest possible number of harmonics.

Usage

hquant(Coo, method = c("efourier", "rfourier", "tfourier"),
                 id = 1, smooth.it = 0, harm.range = seq(4, 20, 4),
                 norm.centsize = TRUE,
                 dist.method = edm.nearest, dist.nbpts = 120,
                 plot = TRUE, dev.plot = TRUE, title = "Deviations along the outline",
                 legend = TRUE, legend.title = "# harmonics",
                 palette = col.summer, lineat.y = c(0.5, 0.1, 0.01))

Arguments

Coo
The Coo object
method
A character, either "efourier", "rfourier" or "tfourier" (partial matches are allowed) to use to calculate morphological that indicates which method to use.
id
integer. The id of the shape to display. A range of ids can be passed to harm.pow
smooth.it
integer. The number of smoothing iteration to perform.
harm.range
A vector of integer giving the harmonic range to calculate. See nb.h for harm.pow.
norm.centsize
logical. Whether to normalize distances by the centroid size of every outline.
dist.method
A distance method to use, e.g. either edm.nearest or edm.
dist.nbpts
integer. The number of points to sample along the outlines to calculate the deviations. It can be set to "max" and the maximum number of points will be used, e.g. twice the number of the highest possible number of harmonics on the outline(s)
plot
logical. Whether to plot or not the shape. If FALSE, only the results are returned.
dev.plot
logical. Whether to plot or not the deviation plot.
title
A title for the plot.
legend
logical. Whether to display a legend box.
legend.title
character. A title for the legend box.
palette
A color palette such those included in Momocs or produced with colorRampPalette.
lineat.y
A vector of numeric to specify where to plot dashed lines on the y-axis.

Value

  • Returns a matrix containing deviations for each harmonic and corresponding quantiles.

Examples

Run this code
data(bot)
hquant(bot)

Run the code above in your browser using DataLab