I have trouble fitting model with gdistsamp()
(package unmarked). Whenever I add more variables, I get the "non-finite finite-difference value" error:
> t1 <- proc.time()
> Sys.time()
[1] "2014-12-30 03:39:07 CET"
> g8 <- gdistsamp(~ elev_100+solrad_100+slope_mean_100+clc_112_100+clc_121_100+clc_141_100+clc_142_100+clc_311_100+clc_312_100+clc_313_100+clc_321_100+clc_322_100+clc_324_100+clc_332_100+clc_412_100+clc_512_100,
+ ~ yday + time,
+ ~ slope_mean_100+clc_112_100+clc_121_100+clc_141_100+clc_142_100+clc_311_100+clc_312_100+clc_313_100+clc_321_100+clc_322_100+clc_324_100+clc_332_100+clc_412_100+road2_100+road3_100,
+ umf, keyfun = "halfnorm", output = "abund",
+ mixture = "P", se = TRUE)
Error in optim(starts, nll, method = method, hessian = se, ...) :
non-finite finite-difference value [21]
In addition: There were 50 or more warnings (use warnings() to see the first 50)
> t2 <- proc.time()
> print(t2 - t1)
user system elapsed
1741.00 10.66 1762.13
> warnings()
Warning messages:
1: In log(cp[J + 1]) : NaNs produced
2: In log(cp[J + 1]) : NaNs produced
3: In log(cp[J + 1]) : NaNs produced
4: In log(cp[J + 1]) : NaNs produced
5: In log(cp[J + 1]) : NaNs produced
6: In log(cp[J + 1]) : NaNs produced
7: In log(cp[J + 1]) : NaNs produced
8: In log(cp[J + 1]) : NaNs produced
9: In log(cp[J + 1]) : NaNs produced
10: In log(cp[J + 1]) : NaNs produced
11: In log(cp[J + 1]) : NaNs produced
12: In log(cp[J + 1]) : NaNs produced
13: In log(cp[J + 1]) : NaNs produced
14: In log(cp[J + 1]) : NaNs produced
15: In log(cp[J + 1]) : NaNs produced
16: In log(cp[J + 1]) : NaNs produced
17: In log(cp[J + 1]) : NaNs produced
18: In log(cp[J + 1]) : NaNs produced
19: In log(cp[J + 1]) : NaNs produced
20: In log(cp[J + 1]) : NaNs produced
21: In log(cp[J + 1]) : NaNs produced
22: In log(cp[J + 1]) : NaNs produced
23: In log(cp[J + 1]) : NaNs produced
24: In log(cp[J + 1]) : NaNs produced
25: In log(cp[J + 1]) : NaNs produced
26: In log(cp[J + 1]) : NaNs produced
27: In log(cp[J + 1]) : NaNs produced
28: In log(cp[J + 1]) : NaNs produced
29: In log(cp[J + 1]) : NaNs produced
30: In log(cp[J + 1]) : NaNs produced
31: In log(cp[J + 1]) : NaNs produced
32: In log(cp[J + 1]) : NaNs produced
33: In log(cp[J + 1]) : NaNs produced
34: In log(cp[J + 1]) : NaNs produced
35: In log(cp[J + 1]) : NaNs produced
36: In log(cp[J + 1]) : NaNs produced
37: In log(cp[J + 1]) : NaNs produced
38: In log(cp[J + 1]) : NaNs produced
39: In log(cp[J + 1]) : NaNs produced
40: In log(cp[J + 1]) : NaNs produced
41: In log(cp[J + 1]) : NaNs produced
42: In log(cp[J + 1]) : NaNs produced
43: In log(cp[J + 1]) : NaNs produced
44: In log(cp[J + 1]) : NaNs produced
45: In log(cp[J + 1]) : NaNs produced
46: In log(cp[J + 1]) : NaNs produced
47: In log(cp[J + 1]) : NaNs produced
48: In log(cp[J + 1]) : NaNs produced
49: In log(cp[J + 1]) : NaNs produced
50: In log(cp[J + 1]) : NaNs produced
When I removed some variables from the detection formula, I got the model computed, but I got a warning that the model did not converge:
Call:
gdistsamp(lambdaformula = ~elev_100 + solrad_100 + slope_mean_100 +
clc_112_100 + clc_121_100 + clc_141_100 + clc_142_100 + clc_311_100 +
clc_312_100 + clc_313_100 + clc_321_100 + clc_322_100 + clc_324_100 +
clc_332_100 + clc_412_100 + clc_512_100, phiformula = ~yday +
time, pformula = ~clc_311_100 + clc_312_100 + clc_313_100,
data = umf, keyfun = "halfnorm", output = "abund", mixture = "P",
se = TRUE)
Abundance (log-scale):
Estimate SE z P(>|z|)
(Intercept) -1.892 0.1859 -10.178 2.48e-24
elev_100 -0.728 0.0732 -9.947 2.61e-23
solrad_100 0.142 0.0426 3.339 8.40e-04
slope_mean_100 0.239 0.0480 4.982 6.29e-07
clc_112_100 -0.155 0.4812 -0.323 7.47e-01
clc_121_100 -9.089 12.2398 -0.743 4.58e-01
clc_141_100 -27.653 70.7278 -0.391 6.96e-01
clc_142_100 -7.527 9.2335 -0.815 4.15e-01
clc_311_100 2.562 0.2701 9.485 2.43e-21
clc_312_100 3.144 0.2338 13.448 3.17e-41
clc_313_100 2.666 0.3466 7.691 1.46e-14
clc_321_100 2.221 0.3953 5.618 1.93e-08
clc_322_100 1.638 0.5366 3.053 2.27e-03
clc_324_100 1.842 0.3218 5.723 1.04e-08
clc_332_100 -3.326 4.1813 -0.796 4.26e-01
clc_412_100 -1.696 3.7272 -0.455 6.49e-01
clc_512_100 -3.062 2.6670 -1.148 2.51e-01
Availability (logit-scale):
Estimate SE z P(>|z|)
(Intercept) 1.152 0.427 2.70 0.006979
yday -0.622 0.167 -3.72 0.000197
time -0.199 0.122 -1.64 0.101123
Detection (log-scale):
Estimate SE z P(>|z|)
(Intercept) 3.846 0.0898 42.81 0.000000000000000
clc_311_100 -0.602 0.1190 -5.06 0.000000417315360
clc_312_100 -0.753 0.1019 -7.39 0.000000000000149
clc_313_100 -0.573 0.1561 -3.67 0.000238453876365
AIC: 6076.263
Number of sites: 938
optim convergence code: 1
optim iterations: 204
Bootstrap iterations: 0
Warning message:
In .local(object, ...) :
Model did not converge. Try providing starting values or increasing maxit control argment.
> save(g9, file = "gdistsamp-g9.Rdata")
When I make the model as simple as this:
gdistsamp(lambdaformula = ~elev_100 + solrad_100 + clc_311_100 +
clc_312_100 + clc_313_100, phiformula = ~yday + time, pformula = ~clc_311_100 +
clc_312_100 + clc_313_100 + road1_100 + road2_100, data = umf,
keyfun = "halfnorm", output = "abund", mixture = "P", se = TRUE)
it will get computed (and converges), however I still get the warnings "In log(cp[J + 1]) : NaNs produced".
Note that the variables are all normalized, except for clc variables - these are proportions (real number 0 - 1) of the area with particular habitat that sum up to 1.
Cannot figure out where exactly is the problem...
PS: I am willing to send the data to anyone interested in the problem (I don't want to just publish them on the web though)
If you're worried about the message "In log(cp[J + 1]) : NaNs produced" do be. According to Kery and Royle's "Applied hierarchical modeling in ecology" book this is related to having near 0 probability in the very last cell (individuals > xmaxdist away) and in general is not a problem.