predLikelihood: predLikelihood - Distance function values at observations

View source: R/predLikelihood.R

predLikelihoodR Documentation

predLikelihood - Distance function values at observations

Description

An internal prediction function to predict (compute) the values of distance functions at a set of observed values. Unlike predDfuncs, which evaluates distance functions at EVERY input distance, this routine evaluates distance functions at only ONE distance. This is what's appropriate for likelihood computation. This version allows for matrix inputs and uses matrix operations, and is thus faster than earlier looping versions.

Usage

predLikelihood(object, params)

Arguments

object

An Rdistance model frame or fitted distance function, normally produced by a call to dfuncEstim.

params

A matrix of distance function parameters. Rows are observations, columns contain the set of parameters (canonical and expansion) for each observation.

Details

Assuming L is the vector returned by this function, the negative log likelihood is -sum(log(L / I), na.rm=T), where I is the integration constant, or area under the likelihood between w.lo and w.hi. Note that returned likelihood values for distances less than w.lo or greater than w.hi are NA; hence, na.rm=TRUE in the sum.

Value

A vector of distance function values, of length n = number of observed distances = length(distances(x)). Elements in distances(x) correspond, in order, to values in the returned vector.


Rdistance documentation built on April 12, 2025, 1:12 a.m.