Repulsive force {phonR} | R Documentation |
For each point, calculates the sum of inverse squared distances to all points that are not of the same type.
repulsiveForce(x, y, type, xform=log, exclude.inf=TRUE)
repulsiveForceHeatmap(x, y, type=NULL, xform=log,
exclude.inf=TRUE, resolution=10,
colormap=NULL, fast=FALSE, ...)
repulsiveForceHeatmapLegend(x, y, labels=c("low", "high"),
pos=c(1, 3), colormap=NULL,
smoothness=50, lend=2, lwd=12, ...)
x , y |
Numeric vector of x and y values (e.g., F2 and F1 frequencies), or
in the case of |
type |
Attribute of the |
xform |
A function to apply to the calculated force values before applying
the colormap. Default is to use the |
exclude.inf |
Logical; should infinite force values be excluded? If true,
force for points with identical |
resolution |
Number of points to interpolate between each axis unit.
Higher resolution yields smoother heatmaps at the cost of
increased computational time. NOTE: in typical linguistic
usage, an appropriate |
colormap |
Colormap to use when drawing the heatmap and legend (see
|
fast |
Logical; should an interpolation algorithm be used instead of the
normal repulsive force function when assigning force values to grid
points? If |
labels |
Vector of strings (length 2); the labels to write at each end of
the force legend color bar. Ignored if |
pos |
Vector of integers (length 2); position codes for the colorbar
labels. See the |
smoothness |
Number of color steps to use when drawing the legend
colorbar. Limited by the number of colors specified in
|
lend |
End-cap style for the individual segments of the colorbar. See
|
lwd |
Width of the colorbar. See |
... |
Additional arguments passed to |
Given endpoints x
and y
, forceHeatmapLegend
draws
a colorbar legend with smoothness
number of steps using the
provided colormap (or defaults to grayscale if colormap
is
NULL
.
repulsiveForce
returns the sum of the repulsive forces calculated
at each point (x,y)
.
McCloy, Daniel drmccloy@uw.edu
Liljencrants, J., & Lindblom, B. 1972 “Numerical simulation of vowel quality systems: The role of perceptual contrast”. Language, 48(4), 839-862. http://www.jstor.org/stable/411991
McCloy, D. R., Wright, R. A., & Souza, P. E. 2014 “Talker versus dialect effects on speech intelligibility: A symmetrical study”. Language and Speech. http://dx.doi.org/10.1177/0023830914559234
Pineda, J. 1988 “A parallel algorithm for polygon rasterization”. ACM SIGGRAPH Computer Graphics, 22(4), 17-20. http://dx.doi.org/10.1145/378456.378457
require(plotrix)
data(indoVowels)
force <- with(indo[indo$subj==indo$subj[1],],
repulsiveForce(f2, f1, vowel))
colmap <- color.scale(x=0:100, cs1=c(0, 180), cs2=100,
cs3=c(25, 100), color.spec='hcl')
with(indo[indo$subj==indo$subj[1],],
repulsiveForceHeatmap(f2, f1, type=vowel, resolution=10,
colormap=colmap, add=FALSE))
xl <- rep(max(range(indo$f2)), 2)
yl <- range(indo$f1) + c(abs(diff(range(indo$f1)) / 2), 0)
repulsiveForceHeatmapLegend(xl, yl, colormap=colmap, useRaster=TRUE)