View source: R/integrateOneStepLines.R
| integrateOneStepLines | R Documentation |
Compute exact integral of the one-step distance function for line transects.
integrateOneStepLines(object, newdata = 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
|
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
# A oneStep distance function on simulated data
whi <- 250
T <- 100 # true threshold
p <- 0.85 # true proportion <T
n <- 200 # num simulated points
x <- c( runif(n*p, min=0, max=T), runif(n*(1-p), min=T, max=whi))
x <- setUnits(x, "m")
tranID <- sample(rep(1:10, each=n/10), replace=FALSE)
detectDf <- data.frame(transect = tranID, dist = x)
siteDf <- data.frame(transect = 1:10
, length = rep(setUnits(10,"m"), 10))
distDf <- RdistDf(siteDf, detectDf)
# Estimation
fit <- dfuncEstim(distDf
, formula = dist ~ 1
, likelihood = "oneStep"
, w.hi = setUnits(whi, "m")
)
table(integrateOneStepLines(fit))
table(ESW(fit))
# Check:
T.hat <- exp(fit$par[1])
p.hat <- fit$par[2]
gAtT <- ((1-p.hat) * T.hat) / (p.hat * (whi - T.hat))
plot(fit)
abline(h = gAtT, col="blue")
areaLE.T <- (1.0) * T.hat
areaGT.T <- gAtT * (whi - T.hat)
areaLE.T + areaGT.T # ESW
# Equivalent
T.hat / p.hat
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.