# flnl: Log-likelihood computation for distance sampling data In mrds: Mark-Recapture Distance Sampling

 flnl R Documentation

## Log-likelihood computation for distance sampling data

### Description

For a specific set of parameter values, it computes and returns the negative log-likelihood for the distance sampling likelihood for distances that are unbinned, binned and a mixture of both. The function `flnl` is the function minimized using `optim` from within `ddf.ds`.

### Usage

```flnl(fpar, ddfobj, misc.options, fitting = "all")
```

### Arguments

 `fpar` parameter values for detection function at which negative log-likelihood should be evaluated `ddfobj` distance sampling object `misc.options` a `list` with the following elements: `width` transect width; `int.range` the integration range for observations; `showit` 0 to 3 controls level debug output; `integral.numeric` if `TRUE` integral is computed numerically rather than analytically; `point` is this a point transect? `fitting` character `"key"` if only fitting key function parameters, `"adjust"` if fitting adjustment parameters or `"all"` to fit both

### Details

Most of the computation is in `flpt.lnl` in which the negative log-likelihood is computed for each observation. `flnl` is a wrapper that optionally outputs intermediate results and sums the individual log-likelihood values.

`flnl` is the main routine that manipulates the parameters using `getpar` to handle fitting of key, adjustment or all of the parameters. It then calls `flpt.lnl` to do the actual computation of the likelihood. The probability density function for point counts is `fr` and for line transects is `fx`. `fx`=g(x)/mu (where g(x) is the detection function); whereas, f(r)=r*g(r)/mu where mu in both cases is the normalizing constant. Both functions are in source code file for `link{detfct}` and are called from `distpdf` and the integral calculations are made with `integratepdf`.

### Value

negative log-likelihood value at the parameter values specified in `fpar`

### Note

These are internal functions used by `ddf.ds` to fit distance sampling detection functions. It is not intended for the user to invoke these functions but they are documented here for completeness.

### Author(s)

Jeff Laake, David L Miller

`flt.var`, `detfct`