predict.dsmodel: Predictions from a fitted detection function

View source: R/predict.dsmodel.R

predict.dsmodelR Documentation

Predictions from a fitted detection function

Description

Predict detection probabilities (or effective strip widths/effective areas of detection) from a fitted distance sampling model using either the original data (i.e., "fitted" values) or using new data.

Usage

## S3 method for class 'dsmodel'
predict(
  object,
  newdata = NULL,
  compute = FALSE,
  esw = FALSE,
  se.fit = FALSE,
  ...
)

Arguments

object

ds model object.

newdata

new data.frame for prediction, this must include a column called "distance".

compute

if TRUE compute values and don't use the fitted values stored in the model object.

esw

if TRUE, returns effective strip half-width (or effective area of detection for point transect models) integral from 0 to the truncation distance (width) of p(y)dy; otherwise it returns the integral from 0 to truncation width of p(y)\pi(y) where \pi(y)=1/w for lines and \pi(y)=2r/w^2 for points.

se.fit

should standard errors on the predicted probabilities of detection (or ESW if esw=TRUE) estimated? Stored in the se.fit element

...

for S3 consistency

Details

For line transects, the effective strip half-width (esw=TRUE) is the integral of the fitted detection function over either 0 to W or the specified int.range. The predicted detection probability is the average probability which is simply the integral divided by the distance range. For point transect models, esw=TRUE calculates the effective area of detection (commonly referred to as "nu", this is the integral of 2/width^2 * r * g(r).

Fitted detection probabilities are stored in the model object and these are returned unless compute=TRUE or newdata is specified. compute=TRUE is used to estimate numerical derivatives for use in delta method approximations to the variance.

Note that the ordering of the returned results when no new data is supplied (the "fitted" values) will not necessarily be the same as the data supplied to ddf, the data (and hence results from predict) will be sorted by object ID (object).

Value

a list with a single element: fitted, a vector of average detection probabilities or esw values for each observation in the original data ornewdata. If se.fit=TRUE there is an additional element ⁠$se.fit⁠, which contains the standard errors of the probabilities of detection or ESW.

Author(s)

David L Miller


Distance documentation built on Oct. 24, 2024, 5:08 p.m.