integrateOneStepNumeric: Numeric Integration of One-step Function

View source: R/integrateOneStepNumeric.R

integrateOneStepNumericR Documentation

Numeric Integration of One-step Function

Description

Compute integral of the one-step distance function using numeric integration. This function is only called for oneStep functions that contain expansion factors.

Usage

integrateOneStepNumeric(
  object,
  newdata = NULL,
  w.lo = NULL,
  w.hi = NULL,
  Units = NULL,
  expansions = NULL,
  series = NULL,
  isPoints = NULL
)

Arguments

object

Either an Rdistance fitted distance function (an object that inherits from class "dfunc"; usually produced by a call to dfuncEstim), or a matrix of canonical distance function parameters (e.g., matrix(exp(fit$par),1)). If a matrix, each row corresponds to a distance function and each column is a parameter. The first column is the parameter related to sighting covariates and must be transformed to the "real" space (i.e., inverse link, which is exp(), must be applied outside this routine). If object is a matrix, it should not have measurement units because only derived quantities (e.g., ESW) have units; Rdistance function parameters themselves never have units.

newdata

A data frame containing new values for the distance function covariates. If NULL and object is a fitted distance function, the observed covariates stored in object are used (behavior similar to predict.lm). Argument newdata is ignored if object is a matrix.

w.lo

Minimum sighting distance or left-truncation value if object is a matrix. Ignored if object is a fitted distance function. Must have physical measurement units.

w.hi

Maximum sighting distance or right-truncation value if object is a matrix. Ignored if object is a fitted distance function. Must have physical measurement units.

Units

Physical units of sighting distances if object is a matrix. Sighting distance units can differ from units of w.lo or w.hi. Ignored if object is a fitted distance function.

expansions

A scalar specifying the number of terms in series to compute. Depending on the series, this could be 0 through 5. The default of 0 equates to no expansion terms of any type. No expansion terms are allowed (i.e., expansions is forced to 0) if covariates are present in the detection function (i.e., right-hand side of formula includes something other than 1).

series

If expansions > 0, this string specifies the type of expansion to use. Valid values at present are 'simple', 'hermite', and 'cosine'.

isPoints

Boolean. TRUE if integration is for point surveys. FALSE for line-transect surveys. Line-transect surveys integrate under the distance function, g(x), while point surveys integrate under the distance function times distances, xg(x).

Details

The oneStep.like function has an extremely large discontinuity at Theta. Accurate numeric integration requires inserting Theta and Theta+ (a value just larger than Theta) into the series of points being evaluated. Because this creates un-equal intervals, the Trapazoid rule must be used. Rdistance's Simpson's rule routine (integrateNumeric) will not work for oneStep likelihoods that have expansions.

Value

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).

Note

Users will not normally call this function. It is called internally by nLL and effectiveDistance.

See Also

integrateNumeric; integrateOneStepLines; integrateOneStepPoints


Rdistance documentation built on Jan. 10, 2026, 1:07 a.m.