View source: R/integrateOneStepPoints.R
| integrateOneStepPoints | R Documentation |
Compute integral of the one-step distance function for point-surveys.
integrateOneStepPoints(
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} x(\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}{2p}((1-p)w + \theta_i),
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; integrateOneStepNumeric;
integrateOneStepLines
fit <- dfuncEstim(thrasherDf, dist~1, likelihood = "oneStep")
integrateOneStepPoints(fit, newdata = data.frame(`(Intercept)`=1))
EDR(fit, newdata = data.frame(`(Intercept)`=1))
# Check:
Theta <- exp(fit$par[1])
Theta <- setUnits(Theta, "m")
p <- fit$par[2]
w.hi <- fit$w.hi
w.lo <- fit$w.lo
g.at0 <- w.lo
g.atT <- Theta
g.atTPlusFuzz <- (((1-p) * Theta) / ((w.hi - Theta) * p))*Theta
g.atWhi <- (((1-p) * Theta) / ((w.hi - Theta) * p))*w.hi
area.0.to.T <- (Theta - w.lo) * (g.atT - g.at0) / 2 # triangle; Theta^2/2
area.T.to.w <- (w.hi - Theta) * (g.atTPlusFuzz + g.atWhi) / 2 # trapazoid
area <- area.0.to.T + area.T.to.w
edr <- sqrt( 2*area )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.