Computes the negative exponential form of a distance function
negexp.like(
a,
dist,
covars = NULL,
w.lo = units::set_units(0, "m"),
w.hi = max(dist),
series = "cosine",
expansions = 0,
scale = TRUE,
pointSurvey = FALSE
)
A numeric vector the same length and order as dist
containing the likelihood contribution for corresponding distances in dist
.
Assuming L
is the returned vector from one of these functions, the full log likelihood of all the data is -sum(log(L), na.rm=T)
. Note that the
returned likelihood value for distances less than w.lo
or greater than w.hi
is NA
, and thus it is prudent to use na.rm=TRUE
in the
sum. If scale
= TRUE, the integral of the likelihood from w.lo
to w.hi
is 1.0. If scale
= FALSE, the integral of the likelihood is
arbitrary.
A vector of likelihood parameter values. Length and
meaning depend on series
and expansions
. If
no expansion terms were called for
(i.e., expansions = 0
), the distance likelihood
contains only one canonical parameter, which
is the first element of a
(see Details). If one
or more expansions are called for,
coefficients for the expansion terms follow
coefficients for the canonical parameter.
A numeric vector containing the observed distances.
Data frame containing values of covariates at each
observation in dist
.
Scalar value of the lowest observable distance. This is the left truncation of sighting distances in dist
. Same units as dist
.
Values less than w.lo
are allowed in dist
, but are ignored and their contribution to the likelihood is set to NA
in the output.
Scalar value of the largest observable distance. This is the right truncation of sighting distances in dist
. Same units as dist
.
Values greater than w.hi
are allowed in dist
, but are ignored and their contribution to the likelihood is set to NA
in the output.
A string specifying the type of expansion to use. Currently, valid values are 'simple', 'hermite', and 'cosine'; but, see
dfuncEstim
about defining other series.
A scalar specifying the number of terms in series
. Depending on the series, this could be 0 through 5.
The default of 0 equates to no expansion terms of any type.
Logical scalar indicating whether or not to scale the likelihood so it integrates to 1. This parameter is used to stop recursion in other functions.
If scale
equals TRUE, a numerical integration routine (integration.constant
) is called, which in turn calls this likelihood function again
with scale
= FALSE. Thus, this routine knows when its values are being used to compute the likelihood and when its value is being used to compute the
constant of integration. All user defined likelihoods must have and use this parameter.
Boolean. TRUE if dist
is point transect data, FALSE if line transect data.
The negative exponential likelihood is $$f(x|a) = \exp(-ax)$$ where \(a\) is a slope parameter to be estimated.
Expansion Terms: If the number of expansions
= k (k > 0), the expansion
function specified by series
is called (see for example
cosine.expansion
). Assuming \(h_{ij}(x)\) is
the \(j^{th}\) expansion term for the \(i^{th}\) distance and that
\(c_1, c_2, \dots, c_k\)are (estimated) coefficients for the expansion terms, the likelihood contribution for the \(i^{th}\)
distance is,
$$f(x|a,b,c_1,c_2,\dots,c_k) = f(x|a,b)(1 + \sum_{j=1}^{k} c_j h_{ij}(x)).$$
dfuncEstim
,
halfnorm.like
,
uniform.like
,
hazrate.like
,
Gamma.like
if (FALSE) {
set.seed(238642)
x <- seq(0, 100, length=100)
# Plots showing effects of changes in parameter Beta
plot(x, negexp.like(0.01, x), type="l", col="red")
plot(x, negexp.like(0.05, x), type="l", col="blue")
# Estimate 'negexp' distance function
Beta <- 0.01
x <- rexp(1000, rate=Beta)
dfunc <- dfuncEstim(x~1, likelihood="negexp")
plot(dfunc)
}
Run the code above in your browser using DataLab