View source: R/integrateTriangleLines.R
| integrateTriangleLines | R Documentation |
Compute exact integral of the triangle distance function for line transects.
integrateTriangleLines(
object,
newdata = NULL,
w.lo = NULL,
w.hi = NULL,
Units = NULL
)
object |
Either an Rdistance fitted distance function
(an object that inherits from class "dfunc"; usually produced
by a call to |
newdata |
A data frame containing new values for
the distance function covariates. If NULL and
|
w.lo |
Minimum sighting distance or left-truncation value
if |
w.hi |
Maximum sighting distance or right-truncation value
if |
Units |
Physical units of sighting distances if
|
Returned integrals are
\int_0^{w} (\frac{p}{\theta_i}I(0\leq x \leq \theta_i) +
\frac{1-p}{w - \theta_i}I(\theta_i < x \leq w)) dx = \frac{\theta_i}{p},
where w = w.hi - w.lo, \theta_i is the estimated one-step
distance function
threshold for the i-th observed distance, and p is the estimated
one-step proportion.
A vector of areas under the distance functions represented in
object.
If object is a distance function and
newdata is specified, the returned vector's length is
nrow(newdata). If object is a distance function and
newdata is NULL,
returned vector's length is length(distances(object)). If
object is a matrix, return's length is
nrow(object).
Users will not normally call this function. It is called
internally by nLL and effectiveDistance.
integrateNumeric; integrateNegexpLines;
integrateHalfnormLines
w <- 250
T <- 160
p <- 0.4
obj <- matrix(c(T,p), 1, 2)
integrateTriangleLines(obj
, w.lo = units::set_units(0,"m")
, w.hi = units::set_units(w,"m")
, Units = "m")
# same
(1 + p) * T / 2 + p * (w - T)
# check by numeric integration
triLike <- function(d, T, p, wl, wh) {
y <- triangle.like(a = c(log(T), p)
, dist = d - wl
, covars = matrix(1, length(d))
, w.hi = wh - wl)$L.unscaled
y
}
integrate(triLike, lower = 0, upper = w, T = T, p = p, wl = 0, wh = w)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.