TTD/Stacking/gmultmix error: initial value in 'vmmin' is not finite

139 views
Skip to first unread message

Rachel Anderson

unread,
Oct 14, 2022, 7:33:58 PM10/14/22
to unmarked
Hi all, 

I am trying to estimate marsh bird abundance using two years of time to detection data. I have 262 point count sites that were visited 3 times over both years. I am using the passive listening period (5, 1-minute intervals) of my surveys to generate encounter frequencies. I have been following the book to create an unmarkedFrameGMM() using a stacked data approach, so I'm working with a Y array of 524 rows and 90 columns.

Here is what my siteCovs look like: 
scovs <- cbind(allcovs[,c("DS_Percentage","EdgeDist", "DevDist")], date=daymat, wind=windmat, sky=skymat, temp=tempmat, observer=obsmat)

Here is my y for the first year for which I repeated for the second year and rbinded to stack my data (Ystack): 
Y <- array(NA, c(262, 3, 30))
Y[1:262, 1, 1:30] <- capCLRA21.h1
Y[1:262, 2, 1:30] <- capCLRA21.h2
Y[1:262, 3, 1:30] <- capCLRA21.h3
Ywide1 <- cbind(capCLRA21.h1, capCLRA21.h2, capCLRA21.h3)

This is how I fit the unmarkedFrameGMM:
intervalMat <- matrix(c('1','2','3','4','5'), 524, 5, byrow=TRUE)
o2y <- matrix(1,5,90)

summary(CLRA.umf <- unmarkedFrameGMM(y=Ystack, siteCovs = scovs, numPrimary=1, obsCovs= list(interval=intervalMat), piFun="crPiFun", obsToY = o2y))

If I try to run the null model: null <- gmultmix(~1, ~1, ~1, data=CLRA.umf, mixture = "P"), I get the following error:  Error in optim(starts, nll, method = method, hessian = se, ...) :
 initial value in 'vmmin' is not finite. 

If I take out siteCovs completely or try increasing K, it gives me the same error. I've read through previous posts on this error, but I'm getting nowhere. If anyone has any suggestions, I'll greatly appreciate the help. 

Best, 
Rachel 


Marc Kery

unread,
Oct 15, 2022, 5:40:28 AM10/15/22
to unmarked
Hi Rachel,

what's the meaning of the 30 columns again ?

At any rate, I think that the error message says that internally (in the function optim, with which the likelihood of the model is maximized), there was something like a division by zero right at the start of the iterative search for the MLEs. Hence, one approach would be to supply "good" starting values, i.e., which are close to the solutions.

Best regards  --- Marc


From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Rachel Anderson <rache...@gmail.com>
Sent: Saturday, October 15, 2022 00:47
To: unmarked <unma...@googlegroups.com>
Subject: [unmarked] TTD/Stacking/gmultmix error: initial value in 'vmmin' is not finite
 
--
*** Three hierarchical modeling email lists ***
(1) unmarked (this list): for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology: for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2016, 2021) and Schaub & Kéry (2022)
---
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/ece36ad6-23c5-4078-80f7-e02df68cc667n%40googlegroups.com.

Rachel Anderson

unread,
Oct 18, 2022, 11:58:07 AM10/18/22
to unmarked
Hi Marc, 

The 30 columns are the capture histories for the 5-1 minute intervals (see function below). I tried starts=(1,0) and other variations, but I am still getting the same error.  Thanks for the help! 

crPiFun <- function(p) {
  p1 <- p[,1]
  p2 <- p[,2]
  p3 <- p[,3]
  p4 <- p[,4]
  p5 <- p[,5]
 
  cbind("00001" = (1-p1) * (1-p2) * (1-p3) * (1-p4) * p5,
        "00010" = (1-p1) * (1-p2) * (1-p3) * p4 * (1-p5),
        "00100" = (1-p1) * (1-p2) * p3 * (1-p4) * (1-p5),
        "01000" = (1-p1) * p2 * (1-p3) * (1-p4) * (1-p5),
        "10000" = p1* (1-p2) * (1-p3) * (1-p4) * (1-p5),
        "10001" = p1* (1-p2) * (1-p3) * (1-p4) * p5,
        "11000" = p1* p2 * (1-p3) * (1-p4) * (1-p5),
        "10100" = p1* (1-p2) * p3 * (1-p4) * (1-p5),
        "10010" = p1* (1-p2) * (1-p3) * p4* (1-p5),
        "01100" = (1-p1) * p2 * p3 * (1-p4) * (1-p5),
        "01010" = (1-p1) * p2 * (1-p3) * p4 * (1-p5),
        "01001" = (1-p1) * p2 * (1-p3) * (1-p4) * p5,
        "00110" = (1-p1) * (1-p2) * p3 * p4* (1-p5),
        "00101" = (1-p1) * (1-p2) * p3 * (1-p4) * p5,
        "00011" = (1-p1) * (1-p2) * (1-p3) * p4 * p5,
        "11100" = p1* p2 * p3 * (1-p4) * (1-p5),
        "11010" = p1* p2 * (1-p3) * p4 * (1-p5),
        "11001" = p1* p2 * (1-p3) * (1-p4) * p5,
        "10110" = p1* (1-p2) * p3 * p4 * (1-p5),
        "10011" = p1* (1-p2) * (1-p3) * p4 * p5,
        "00111" = (1-p1)* (1-p2) * p3 * p4 * p5,
        "01011" = (1-p1)* p2 * (1-p3) * p4 * p5,
        "10101" = p1* (1-p2) * p3 * (1-p4) * p5,
        "01110" = (1-p1)* p2 * p3 * p4 * (1-p5),
        "11110" = p1* p2 * p3 * p4 * (1-p5),
        "10111" = p1* (1-p2) * p3 * p4 * p5,
        "01111" = (1-p1)* p2 * p3 * p4 * p5,
        "11011" = p1* p2 * (1-p3) * p4 * p5,
        "11101" = p1* p2 * p3 * (1-p4) * p5,
        "11111" = p1* p2 * p3* p4 * p5)
}
Reply all
Reply to author
Forward
0 new messages