-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Here we are simulating data with:
intercept (sigma.toa) = 0.001trap_typesony(sigma.toa) = 5
If we simulate and try to fit:
# 10 detectors, arranged in 2 rows of 5, 100m spacing
detectors <- data.frame(x = rep(seq(-200, 200, length.out=5), 2), y = c(rep(100, 5), rep(-100, 5)))
# First 5 traps (first row), sony brand, second 5 traps (second row), panasonic
trap_cov <- data.frame(trap = 1:10, trap_type = c(rep("sony", 5), rep("panasonic", 5)))
set.seed(12345)
trap_extended_data <- sim.capt(
detfn="hn",
param = list(D = 2, sigma = 100, g0 = 1, sigma.toa = log(c(0.001, 5000))),
traps = detectors,
control.mask = list(buffer=500),
trap.cov = trap_cov,
loc.cov = loc_cov,
model = list(sigma.toa = ~trap_type)
)
trap_ext.acre <- read.acre(
trap_extended_data$capt,
detectors,
control.mask = list(buffer=500),
trap.cov = trap_cov
)
trap_ext.fit <- fit.acre(
trap_ext.acre,
model = list(sigma.toa =~trap_type)
)
We get:
> summary(trap_ext.fit)
Detection function: Halfnormal
Number of sessions: 1
Information types: Times of arrival
Confidence interval method: Wald
Parameters:
Estimate Std. Error 2.5 % 97.5 %
g0 1.000000 NaN NA NA
sigma 103.722394 NaN NaN NaN
sigma.toa.(Intercept) 0.406755 NaN NaN NaN
sigma.toa.trap_typesony 0.348817 NaN NaN NaN
D 1.805549 NaN NaN NaN
Extended parameters link functions:
sigma.toa : log
Really weird, sometimes we get NaN gradient, and infinity likelihood, other we get like below:
obj <- TMB::MakeADFun(data = data, parameters = parameters, map = map, silent = (!tracing), DLL="acre")
Browse[2]> obj$par
g0 sigma sigma_toa sigma_toa D
2.944438979 5.123466964 0.039068762 0.000000000 -0.058589736
Browse[4]> obj$fn()
[1] 207.2983
Browse[4]> obj$gr()
outer mgc: 175.79967
[,1] [,2] [,3] [,4] [,5]
[1,] 1.0587695 41.75982 -175.79967 -166.77821 5.0492943e-13
Metadata
Metadata
Assignees
Labels
No labels