areaest {LeArEst} | R Documentation |
Performs area estimation of the numerically described object in plane.
Description
Use this function if you have a data set of uniformly distributed points on
an elliptical domain in the plane but captured with additive errors. The
estimation algorithm takes many horizontal and vertical, or star-shaped
slices of the object. Length estimation procedure is conducted on each slice
and in that way the set of edge points is obtained. An ellipse or a circle
is fitted to these edge points by function
EllipseDirectFit
or
CircleFitByPratt
from the package conicfit
and its semi-axes and area are returned as a result. Function optionally
plots input points, calculated edge points and the resulting ellipse or
circle.
Usage
areaest(data, nrSlices = 10, error = c("laplace", "gauss", "student"),
var.est = c("MM", "ML"), var = NULL, plot = FALSE,
parallel = FALSE, slicing = c("hv", "star"),
representation = c("ellipse", "circle"))
Arguments
data |
Two-column data matrix containing the points that describe observed object. First column represents x coordinate of the point, while second column represents y coordinate. |
nrSlices |
Number of slices applied for plain data cutting. Defaults to 10. |
error |
A character string specifying the error distribution. Must be one of "laplace", "gauss" or "student". Can be abbreviated. |
var.est |
A character string specifying the method of error variance
estimation. Must be given if |
var |
Explicit error variance. Needs to be given if |
plot |
Logical parameter (TRUE or FALSE) that determines whether to plot given object, calculated edge points and the resulting ellipse. Defaults to FALSE. |
parallel |
Logical parameter (TRUE or FALSE) that determines whether to perform estimation procedure in a parallel manner. Can shorten estimation time if many border points need to be calculated. Defaults to FALSE. |
slicing |
A character string specifying the method of slicing. Can be "hv" (horizontal and vertical slicing) or "star" (star-shaped slicing). Can be abbreviated. |
representation |
A character string specifying the shape of an observed object. Can be "ellipse" or "circle". Can be abbreviated. |
Value
List containing:
area: Estimated area of the object,
points: Set of calculated object's edge points,
semiaxes: Resulting ellipse's semi-axes or circle radius.
Examples
# load a data set representing the ellipse with additive Gaussian error,
# run area estimation on it, and plot the results
inputfile <- system.file("extdata", "ellipse_3_4_0.1_gauss.txt", package = "LeArEst")
inputdata <- read.table(inputfile)
area <- areaest(inputdata, error = "gauss", var.est = "ML", plot = TRUE,
slicing = "hv", representation = "ellipse")
# load a data set representing the ellipse with additive Laplacian error,
# run area estimation on it, and plot the results
inputfile <- system.file("extdata", "ellipse_3_4_0.1_laplace.txt", package = "LeArEst")
inputdata <- read.table(inputfile)
area <- areaest(inputdata, error = "laplace", var = 0.1, nrSlices = 5, plot = TRUE,
slicing = "star", representation = "ellipse")