fit.xy: Maximises hidden Markov line transect model likelihood.

View source: R/fitting.R

fit.xyR Documentation

Maximises hidden Markov line transect model likelihood.

Description

fit.xy A wrapper function for optim to get maximum likelihood estimates of detection hazard function paramters using forward and perpendicular distance data (and any associated covariates), using estimated Markov model or hidden Markov model availability prameters.

Usage

fit.xy(
  pars,
  xy,
  FUN,
  models = list(y = NULL, x = NULL),
  pm,
  Pi,
  delta = delta,
  theta.f = 0,
  theta.b = 90,
  W,
  ymax,
  dy,
  nx = 50,
  hessian = FALSE,
  control = list(trace = 5, reltol = 1e-06, maxit = 200),
  groupfromy = NULL
)

Arguments

pars

starting parameter values.

xy

data frame with one line per detection containing perpendicular distance ($x) and forward distance ($y) and any covariates in the model.

FUN

detection hazard functional form name (character).

models

list of characters with elements $y and $x specifying y- and x-covariate models. Either NULL or regression model format (without response on left).

pm

is a vector of state-dependent Bernoulli distribution parameters (interpretation: the probability of being available, given state).

Pi

is a Markov model transition matrix governing the transition between states. (Square matrix with each dimension equal to that of pm.)

delta

is a vector specifying the stationary distribution of the Markov model governed by Pi.

theta.f

REDUNDANT parameter determining the max forward angle in view (must=0).

theta.b

REDUNDANT parameter determining the max forward angle in view (must=90).

W

perpendicular truncation distance for fitting. Must be greater than max(xy$x).

ymax

maximum forward distance that things could be detected. Must be greater than max(xy$y).

dy

resolution of forward distances for Markov model (typically observer speed times time step size).

nx

NOT SURE - I think it is redundant - CHECK

hessian

Logical; if TRUE Hessian matrix is returned

control

list controlling optim optimisation.

groupfromy

a forward distance (y) below which all y's are grouped into a single interval in the likelihood function (i.e. exact y,s < groupfromy are combined into an interval rather than passed as exact distances).

Value

A list comprising optim ouptut plus element $par containing the estimated parameters on the same scale as input parameters pars (which are transformed before calling optim).


david-borchers/hmltm documentation built on Oct. 29, 2023, 9:07 p.m.