negloglik.yx: Negative log-likelihood for forward distance and...

Description Usage Arguments Details Value See Also Examples

View source: R/2DLTfunctions.r

Description

Calculates the negative log-likelihood for forward distance, y, and perpendicular distance, x, for a given hazard and perpendicular density distribution.

Usage

1
negloglik.yx(pars, y, x, hr, ystart, pi.x, w, length.b = 2, debug = FALSE)

Arguments

pars

c(b,logphi); hazard rate and density log-parameters in a vector (see details).

y

scalar or vector; forward distance observations

x

scale or vector; perp. distance observations

hr

hazard rate function

ystart

max forward distance at which could possibly detect animal (see details).

pi.x

perpendicular distance density distribution

w

perpendicular truncation distance.

length.b

length of the hazard rate parameter vector

Details

Must to ensure the hazard function has decayed to (very close to) zero by ystart. The parameter vector, pars, must be passed in with two parameters for the hazard rate first, then two parameters for perpendicular density gradient π(x) i.e. c(b,logphi).

Value

negative log likelihood for forward distance, y and perpendicular distance x.

See Also

simXY

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ystart=4;w=1
hr=h2; b=log(c(0.75,1))
pi.x=pi.norm; logphi=c(0.5,log(0.2))
N=50 #true number of animals
#generate some observations
simDat=simXY(N=N,pi.x=pi.x,logphi=logphi,
hr=hr,b=b,w=w,ystart=ystart)
x=simDat$locs$x; y=simDat$locs$y 
pars=c(b,logphi)
negloglik.yx(y,x,pars,hr,ystart,pi.x,w)

david-borchers/LT2D documentation built on Aug. 17, 2020, 1:37 a.m.