SpAbundance - msNMix model fit errors

36 views
Skip to first unread message

Todd Lewis

unread,
Aug 9, 2024, 2:38:49 PMAug 9
to spOccupancy and spAbundance users
Dear Jeffrey

I am working with an MSc student here at UWE Bristol on a multi species msNMix model using SpAbundance. We are using basic Temperature and Precipitation variables on 16 species. For context we have 16 species, 155 sampling occasions and 1 site.

We have templated up your online example and it runs great. We then placed our data into the code with default criteria and it creates a nice model. However, we are having a dreadful time with some of the model fit commands and predict functions (see below) post model creation.

Do you recognise these error codes? Are we missing something?

Thanks for your time,

Todd Lewis

######################################################################

#Chi-squared GOF - group must be 0 (raw data), 1 (sites), or 2 (replicates)
> ppc.ms.out = ppcAbund(out.ms, fit.stat= 'chi-squared', group = 0)
Error in apply(y[1, , ], 1, function(a) sum(!is.na(a))) :
  dim(X) must have a positive length
> waicAbund(out.ms, by.species = F)
N.max not specified. Setting upper index of integration of N to 10 plus
the largest estimated abundance value at each site in object$N.samples
Currently on species 1 out of 16
Error in apply(y, 1, max, na.rm = TRUE) :
  dim(X) must have a positive length

> out.pred <- predict(out.ms, X.0, ignore.RE = T, type = 'abundance')
Error in t(as.matrix(X.fix[j, ])) %*% t(beta.samples[, sp.indx == i]) :
  non-conformable arguments

#######################################################################

Marc Kéry

unread,
Aug 9, 2024, 5:10:06 PMAug 9
to Todd Lewis, spOccupancy and spAbundance users
Dear Todd,

I think the problem is that you only have 1 site. Nmix and occupancy models normally require spatial replication.

I say 'normally', since people have used time-for-space substitution, e.g., when they have, say, 12 years of data from a single site and then some replicate samples within some or each year. Then, one may treat the years akin to sites and ends up with 12 "annual sites". But this does not seem to be your case.

Best regards  --- Marc

--
You received this message because you are subscribed to the Google Groups "spOccupancy and spAbundance users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spocc-spabund-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spocc-spabund-users/e92875ea-5f6c-467b-a5e0-f35156df4b9dn%40googlegroups.com.


--
______________________________________________________________
 
Marc Kéry
Tel. ++41 41 462 97 93
marc...@vogelwarte.ch
www.vogelwarte.ch
 
Swiss Ornithological Institute | Seerose 1 | CH-6204 Sempach | Switzerland
______________________________________________________________

*** Hierarchical modeling in ecology ***

Todd Lewis

unread,
Aug 9, 2024, 5:10:19 PMAug 9
to Marc Kéry, spOccupancy and spAbundance users
Hi Marc

Thanks very much for the swift reply. 

I think we may be able to add a time-for-space substitution in this model as the data was collected over 3x year periods. So we will try it and report back. 

Please could you recommend a couple of examples of such works as evidence for this acceptable solution so that we can explain in our method?

Thank you and best wishes!

Todd

Jeffrey Doser

unread,
Aug 9, 2024, 5:15:02 PMAug 9
to spOccupancy and spAbundance users
Hi Todd,

Yes, was just going to say the same thing as Marc. The functions aren't working because the package assumes there are multiple sites. I'm not sure of too many examples of the time for space substitution, but Marc and Andy Royle talk about it a bit in Section 6.12 in the first Applied Hierarchical Modeling book, and then the one example in the literature I know of is Yamaura et al. (2011): https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/j.1365-2664.2010.01922.x.

Kind regards,

Jeff
Reply all
Reply to author
Forward
0 new messages