F.nLL {Rdistance}R Documentation

Return the negative log likelihood for a set of distance values

Description

Return value of the negative log likelihood for a vector of observed distances given a specified likelihood, number of expansion terms, and estimated parameters.

Usage

F.nLL(
  a,
  dist,
  covars = NULL,
  like,
  w.lo = 0,
  w.hi = max(dist),
  series,
  expansions = 0,
  pointSurvey,
  for.optim = F
)

Arguments

a

A vector of parameter values for the likelihood. Length of this vector must be expansions + 1 + 1*(like %in% c("hazrate", "uniform")).

dist

A vector of observed distances. All values must be between w.lo and w.hi (see below).

covars

Data frame containing values of covariates at each observation in dist.

like

String specifying the form of the likelihood. Built-in distance functions at present are "uniform", "halfnorm", "hazrate", "negexp", and "Gamma". To be valid, a function named paste(like,".like") (e.g., "uniform.like") must exist somewhere in this routine's scope. This routine finds the ".like" function and calls it with the appropriate parameters. A user-defined likelihood can be implemented by simply defining a function with the ".like" extension and giving the root name here. For example, define a function named "myLike.like" in the .GlobalEnv and set like="myLike" here. See the vignette on this topic.

w.lo

Lower or left-truncation limit of the distances. This is the minimum possible off-transect distance. Default is 0.

w.hi

Upper or right-truncation limit of the distances. This is the maximum off-transect distance that could be observed. Default is the maximum observed distance.

series

String specifying the type of expansion to use series if expansions > 0. Valid values at present are 'simple', 'hermite', and 'cosine'.

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.

pointSurvey

Boolean. TRUE if dist is point transect data, FALSE if line transect data.

for.optim

Boolean. If TRUE, values are multiplied by 10^9 to help optim converge more consistently.

Value

A scalar, the negative of the log likelihood evaluated at parameters a, including expansion terms.

See Also

See uniform.like and links there; dfuncEstim


[Package Rdistance version 3.0.0 Index]