negexp.like: Negative exponential likelihood

View source: R/negexp.like.R

negexp.likeR Documentation

Negative exponential likelihood

Description

Computes the negative exponential distance function.

Usage

negexp.like(a, dist, covars, w.hi = NULL)

Arguments

a

A vector or matrix of covariate and expansion term coefficients. If matrix, dimension is k X p, where k = nrow(a)) is the number of coefficient vectors to evaluate (cases) and p = ncol(a)) is the number of covariate and expansion coefficients in the likelihood (i.e., rows are cases and columns are covariates). If a is a dimensionless vector, it is interpreted as a single row with k = 1. Covariate coefficients in a are the first q values (q <= p), and must be on a log scale.

dist

A numeric vector of length n or a single-column matrix (dimension nX1) containing detection distances at which to evaluate the likelihood.

covars

A numeric vector of length q or a matrix of dimension nXq containing covariate values associated with distances in argument dist.

w.hi

A numeric scalar containing maximum distance. The right-hand cutoff or upper limit. Ignored by some likelihoods (such as halfnorm, negexp, and hazrate), but is a fixed parameter in other likelihoods (such as oneStep and uniform).

Details

The negative exponential likelihood is

f(x|\alpha) = \exp(-\alpha x)

where \alpha is the slope parameter.

Value

A list containing the following two components:

  • L.unscaled: A matrix of size nXk (n = length dist; k = number of cases = nrow(a)) containing likelihood values evaluated at distances in dist. Each row is associated with a single distance, and each column is associated with a single case (row of a). Values in this matrix are the distance function g(d) which generally have g(0) = 1. These values are "unscaled" likelihood values; they must be scaled (divided by) with the area under g(x) between w.lo and w.hi to form proper likelihood values.

  • params: A nXbXk array of the likelihood's (canonical) parameters in link space (i.e., on log scale; b = number of canonical parameters in the likelihood; k = number of cases). Rows correspond to distances in dist. Columns correspond to parameters (columns of a), and pages correspond to cases (rows of a).

See Also

dfuncEstim, abundEstim, other <likelihood>.like functions

Examples

d <- seq(0, 100, length=100)
covs <- matrix(1,length(d),1)
negexp.like(log(0.01), d, covs)

# Changing slope parameter
plot(d, negexp.like(log(0.1), d, covs)$L.unscaled, type="l", col="red")
lines(d, negexp.like(log(0.05), d, covs)$L.unscaled, col="blue")


Rdistance documentation built on April 23, 2026, 1:06 a.m.