Error in mb.gof.test and parboot NAs produced

308 views
Skip to first unread message

Aaron Johnson

unread,
Sep 23, 2020, 11:13:41 AM9/23/20
to unmarked
I am using single-season occupancy models to estimate detection and occupancy for Alligator Snapping Turtles in Louisiana. I have run my detection models with constant occupancy, and I am fitting occupancy models with the top ranked detection model. 

I am currently trying to assess the fit of my global model with the Mackenzie-Bailey GOF test in AICcmodavg, but I get the following errors:

Warning messages:
1: In rbinom(M * J, 1, prob = p) : NAs produced
2: In rbinom(M * J, 1, prob = p) : NAs produced
3: In rbinom(M * J, 1, prob = p) : NAs produced
4: In rbinom(M * J, 1, prob = p) : NAs produced
5: In rbinom(M * J, 1, prob = p) : NAs produced

I am using the most current version of AICcmodavg. I want to run the 10,000 simulations recommended, but I get the errors after 5 simulations. 

The results of the 5 simulations are:

> print(GOF_results)

MacKenzie and Bailey goodness-of-fit for single-season occupancy model

Pearson chi-square table:

       Cohort Observed Expected Chi-square
000000      0        5     5.43       0.03
000100      0        2     0.42       5.97
010000      0        1     0.41       0.85
100100      0        1     0.07      12.16
00000.      1        2     4.67       1.52
00010.      1        1     0.58       0.31
00101.      1        2     0.15      23.28
10000.      1        2     0.74       2.16
10100.      1        1     0.17       4.05
11000.      1        1     0.18       3.62
11100.      1        1     0.04      21.55
0000..      2        7     7.76       0.08
0010..      2        1     0.60       0.27
0100..      2        2     0.59       3.32
1000..      2        1     0.62       0.23
000...      3       86    80.17       0.42
001...      3        3     5.15       0.90
010...      3        1     5.24       3.43
011...      3        1     0.91       0.01
100...      3        7     5.44       0.45
101...      3        1     0.95       0.00
00....      4      115   116.47       0.02
01....      4        3     2.57       0.07
10....      4        4     2.56       0.80

Chi-square statistic = 94.5994 
Number of bootstrap samples = 5
P-value = 0.4

Quantiles of bootstrapped statistics:
  0%  25%  50%  75% 100% 
  38   43   51  109  123 

Estimate of c-hat = 1.3 





Marc J. Mazerolle

unread,
Sep 23, 2020, 11:28:30 AM9/23/20
to unmarked

Aaron,


The warning messages are associated with the NA's in your original data set. Can you run it for longer run times?


Marc


____________________
Marc J. Mazerolle
Département des sciences du bois et de la forêt
2405 rue de la Terrasse
Université Laval
Québec, Québec G1V OA6, Canada
Tel: (418) 656-2131 ext. 407120
Email: marc.ma...@sbf.ulaval.ca

De : unma...@googlegroups.com <unma...@googlegroups.com> de la part de Aaron Johnson <acj...@gmail.com>
Envoyé : 23 septembre 2020 11:09
À : unmarked
Objet : [unmarked] Error in mb.gof.test and parboot NAs produced
 
[Externe UL*]
--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unmarked/e3010c05-f994-4f9f-8ce0-61ac5f367931n%40googlegroups.com.
*ATTENTION : L’émetteur de ce courriel est externe à l’Université Laval.
Évitez de cliquer sur un hyperlien, d’ouvrir une pièce jointe ou de transmettre des informations si vous ne connaissez pas l’expéditeur du courriel. En cas de doute, contactez l’équipe de soutien informatique de votre unité ou hamec...@ulaval.ca.


Aaron Johnson

unread,
Sep 23, 2020, 12:12:10 PM9/23/20
to unmarked
I cannot. It always stops at 5 simulations no matter the number of simulations I specify. 

I thought occupancy accommodated NAs if both the survey occasion and corresponding covariates were NAs. Could this be a result of a low detection probability?

Thank you for the quick response.

Aaron

Marc J. Mazerolle

unread,
Sep 23, 2020, 12:24:43 PM9/23/20
to unmarked

Aaron,


Send me an email offlist with your code and data and I'll look at it.


Marc


____________________
Marc J. Mazerolle
Département des sciences du bois et de la forêt
2405 rue de la Terrasse
Université Laval
Québec, Québec G1V OA6, Canada
Tel: (418) 656-2131 ext. 407120
Email: marc.ma...@sbf.ulaval.ca
Envoyé : 23 septembre 2020 12:12
À : unmarked
Objet : Re: [unmarked] Error in mb.gof.test and parboot NAs produced
 
[Externe UL*]

Courtney Marneweck

unread,
Sep 7, 2021, 8:13:10 AM9/7/21
to unmarked
Hello,

Did you find a solution to this problem? I am having the same issue where I cannot successfully run the simulations as it stops after a few with the same error/warning.

Thanks,
Courtney

On Wednesday, September 23, 2020 at 6:24:43 PM UTC+2 marc.ma...@sbf.ulaval.ca wrote:

Aaron,


Send me an email offlist with your code and data and I'll look at it.


Marc


____________________
Marc J. Mazerolle
Département des sciences du bois et de la forêt
2405 rue de la Terrasse
Université Laval
Québec, Québec G1V OA6, Canada
Tel: (418) 656-2131 ext. 407120
Email: marc.ma...@sbf.ulaval.ca

marc.ma...@sbf.ulaval.ca

unread,
Sep 7, 2021, 3:08:37 PM9/7/21
to unmarked
Hi,

The issue reported by Aaron was due to not specifying correctly the nsim argument. The GOF test was restricted to 5 simulations, because the original poster used "nsims = 10000", whereas the argument name in mb.gof.test( ) is "nsim". The code should have been mb.gof.test(occ6, nsim=10000).

The warnings about missing values are normal because during the GOF test, there is a step for simulating a new data set from the model at each iteration with rbinom( ). When it encounters an NA, the simulated value for the given observation is NA. So there is no issue here.

Best,

Marc
Reply all
Reply to author
Forward
0 new messages