View source: R/integrateHalfnormPoints.R
| integrateHalfnormPoints | R Documentation |
Compute integral of the half-normal distance function for point surveys.
integrateHalfnormPoints(
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} xe^{-x^2/2\sigma_i^2} dx = 0.5\sigma_i^2(1 - e^{-w^2/2\sigma_i^2}),
where w = w.hi - w.lo and \sigma_i is the estimated half-normal
distance function parameter for the i-th observed distance.
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; integrateNegexpPoints;
integrateOneStepPoints
# Fake distance function object w/ minimum inputs for integration
d <- rep(1,4) %m%. # Only units needed, not values
obs <- factor(rep(c("obs1", "obs2"), 2))
beta <- c(3.5, -0.5)
w.hi <- 125
w.lo <- 20
ml <- list(
mf = model.frame(d ~ obs)
, par = beta
, likelihood = "halfnorm"
, w.lo = w.lo %#% "m"
, w.hi = w.hi %#% "m"
, expansions = 0
)
class(ml) <- "dfunc"
integrateHalfnormPoints(ml)
# Check: Integral of x exp(-x^2/(2*s^2)) from 0 to w = w.hi-w.lo
sigma <- exp(c(beta[1], beta[1] + beta[2]))
w <- w.hi - w.lo
intgral <- sigma^2 * (1 - exp(-w^2 / (2*sigma^2)))
intgral
# Effective detection radius
sqrt(2 * intgral)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.