scalefactor {cplots} | R Documentation |
Scaling Factor
Description
The function calculates the scaling factor so that after scaling the original density curve (before transformation), the total area after transformation (excluding the reference circle) has the specified value.
Usage
scalefactor(x, radius = 0, total.area = 1, area.prop = TRUE)
Arguments
x |
a numeric vector storing the heights of a density curve or a histogram. |
radius |
the radius of the reference circle. |
total.area |
a positive number specifying the total area. |
area.prop |
logical; if |
Details
Each value in x is a density value before transformation, for points
equally-spaced on [0,2\pi)
. For a smooth density curve, use a
reasonably large number of points, equally-spaced on [0,2\pi)
.
The area under the density curve after transformation is then approximated
by that of the corresponding sectors. Note if area.prop = TRUE
,
the scale factor is simply the value of total.area
.
Value
A numerical value for the scaling factor
Author(s)
Danli Xu <dxu452@aucklanduni.ac.nz>, Yong Wang <yongwang@auckland.ac.nz>
References
Xu, D. and Wang, Y. (2020). Area-proportional Visualization for Circular Data. Journal of Computational and Graphical Statistics, 29, 351-357.
See Also
Examples
dvm = function(x, mu=0, kappa=1) # von Mises density
exp(kappa * cos(x - mu)) * (2 * pi * besselI(kappa, 0))^(-1)
x = dvm(seq(0, 2 * pi, len = 100), pi, 10)
scalefactor(x) # area-proportional transformation
scalefactor(x, area.prop = FALSE) # height-proportional transformation
scalefactor(x, total.area = 2) # total area of 2
scalefactor(x, area.prop = FALSE, total.area = 2)