error in optim when fitting model in unmarkedframeoccumulti

850 views
Skip to first unread message

Rachel Townsend

unread,
May 21, 2020, 8:28:02 PM5/21/20
to unmarked
Hi,

This is my first post -I couldn't find anything exactly like my issue so hopefully this is OK. I am analyzing wildlife camera data for my master's thesis. I have 3 years of data and am looking at it by season to see if there are seasonal differences among three potentially competing meso-carnivores (bobcat, grey fox, coyote). I have utilized Ken Kellner's script for the rota analysis in unmarked and run my occupancy outputs in the unmarkedframeoccumulti. I have gotten results for 7 of my 12 seasons, however for five of them I get an error message. I noticed that these with the error message had differing counts of NAs which shouldn't happen so I went through the spreadsheets and corrected them - however I still get this message (the 7 seasons that worked didn't have differing number of NAs). Here are the last lines of my script but if this isn't enough I can attach full script and a season of data. Thank you so much for any suggestions you may have.

camtrapdata = unmarkedFrameOccuMulti(y=yy,siteCovs=occu_covs,obsCovs=c(tr_cov))
# create unmarked frame for prediction
#rotadata2 = unmarkedFrameOccuMulti(y=yy,siteCovs=occu_covs2,obsCovs=c(dd_cov,tr_cov))
#rotadata2 = unmarkedFrameOccuMulti(y=yy,siteCovs=occu_covs2,obsCovs=c(tr_cov))
head(camtrapdata)
# Formulas for state and detection processes

# Length should match number/order of columns in fDesign
#occFormulas <- c('~hike+lati+long+lbyl','~hden+lati+long+lbyl','~hden+lati+long+lbyl','~hike+lati+long+lbyl','~d5km','~hden','~hden','~d5km','~hden','~d5km','~0','~0','~0','~0','~0')
#occFormulas <- c('~hike+trail','~hike+trail','~hike+trail','~1','~1','~1','~0')
occFormulas <- c('~hike','~hike','~hike','~1','~1','~1','~0')
#Length should match number/order of species in data@ylist
#detFormulas <- c('~dd1+tr1','~dd2+tr2','~dd3+tr3','~dd4+tr4')
detFormulas <- c('~1','~1','~1')

fit4 <- occuMulti(detFormulas,occFormulas,camtrapdata)
fit4

Error in optim(starts, nll, method = method, hessian = se, ...) : 
  non-finite finite-difference value [2]

Ken Kellner

unread,
May 21, 2020, 9:19:46 PM5/21/20
to unmarked
Hi Rachel,

Can you expand on what you mean by "different numbers of NAs"? what message about missing values did you get exactly? 

By default unmarked uses the BFGS algorithm to optimize the likelihood function for the model. Something about the likelihood calculation using those specific seasons of data is causing BFGS issues. It's hard to say what exactly the problem is.

I would start by setting all your occupancy formulas to intercept-only to see if the model runs, if it does, slowly add back complexity until you know what specific formula causes the issues.

Another thing to try would be to change the optimization algorithm used, for example:

fit4 <- occuMulti(detFormulas,occFormulas,camtrapdata, method="Nelder-Mead")

Ken

Rachel Townsend

unread,
May 22, 2020, 7:13:33 PM5/22/20
to unmarked
Hi Ken,

Thanks so much for your response. By differing number of NAs, I mean on my occupancy outputs - I have a spreadsheet for each species and each should have the same number of NAs (NAs are the days the camera wasn't operating). Before fixing the NAs so that each spreadsheet matched, the error message was about NaNs produced and a negative sqrt. 

I tried using your suggested optimiziation algorithm and while I did not get the error in optim, I did get the following warning (and NaNs):
Call:
occuMulti(detformulas = detFormulas, stateformulas = occFormulas, 
    data = camtrapdata, method = "Nelder-Mead")

Occupancy:
                            Estimate    SE      z  P(>|z|)
[bobcat] (Intercept)         -1.5067   NaN    NaN      NaN
[bobcat] hike                 0.1072 0.158  0.677 4.98e-01
[coyote] (Intercept)          0.6521   NaN    NaN      NaN
[coyote] hike                -0.0879 0.019 -4.628 3.69e-06
[gryfox] (Intercept)          2.5014   NaN    NaN      NaN
[gryfox] hike                 0.5439   NaN    NaN      NaN
[bobcat:coyote] (Intercept)   1.1853   NaN    NaN      NaN
[bobcat:gryfox] (Intercept)   1.1634   NaN    NaN      NaN
[coyote:gryfox] (Intercept)   2.4327   NaN    NaN      NaN

Detection:
                     Estimate     SE     z   P(>|z|)
[bobcat] (Intercept)    -3.71 0.1219 -30.4 2.17e-203
[coyote] (Intercept)    -3.40 0.0740 -46.0  0.00e+00
[gryfox] (Intercept)    -2.75 0.0572 -48.1  0.00e+00

AIC: 4927.701 
Warning messages:
1: In sqrt(diag(vcov(obj))) : NaNs produced
2: In new("standardGeneric", .Data = function (object)  :
  Model did not converge. Try providing starting values or increasing maxit control argment.

Any ideas on what I should try next? I really appreciate your input!

Rachel

Ken Kellner

unread,
May 26, 2020, 10:42:55 AM5/26/20
to unmarked
Rachel,

I would try fitting models with no covariates, to see if you get better estimates, just to help narrow down the problem. 

It looks like you have very low detection probabilities for all species (~0.05 per obs). This could make it hard to get good estimates for the occupancy portion of the model. The multispecies model is fairly data-hungry in my experience - you need a reasonable number of observations where species overlapped. If all species are very rare and are almost never detected during the same period, that's going to make it really hard to get estimates of the interactions. Since you have some seasons where you got model output, I would compare characteristics between those seasons and the ones that don't run. For example, how many detections of each species? Do the seasons where the model doesn't run have many fewer detections? Given that you have camera trap data, you might also try changing what you use as an individual observation. For example, instead of one observation unit being a single camera-day, you could try camera-week. Without knowing your experimental design it's hard to make specific suggestions.

Ken
Message has been deleted

Rachel Townsend

unread,
May 30, 2020, 6:05:20 PM5/30/20
to unmarked

Season

Year

No. Cameras

Trapnights

Coyote

(1s)

Gray fox

Bobcat

Human dr

X (MIN – MAX)

Fall

2014

127

7571

206

455

219

3.24 (0 - 39)

 

2015

118

8954

254

665

222

4.02 (0 – 50)

 

2016

84

6743

160

578

109

2.36(0 – 29)

Winter

2014

120

8913

226

442

279

3.59(0 – 43)

 

2015

110

8673

176

644

218

3.36(0 – 30)

 

2016

84

6163

147

434

126

2.21(0 – 25)

Spring

2015

119

9040

158

432

239

3.43(0 – 35)

 

2016

93

7726

104

402

150

2.73(0 – 37)

 

2017

87

6578

139

301

116

2.648(0 – 36)

Summer

2015

125

9556

244

516

194

3.73(0 – 35)

 

2016

83

6056

165

312

94

2.93(0 – 42)

 

2017

80

6181

136

200

81

2.65(0 - 36)

Rachel Townsend

unread,
May 30, 2020, 6:15:33 PM5/30/20
to unmarked
Hi Ken,

I posted a summary table of my data above - I'm not sure why Spring 2017 and Summer season was cut off so I attached it as a word file. I thought it might be the lack of number of detections that was causing the problem as well; however, it is strange that for example, that Winter 2016 worked while winter 2015 did not. I'm a bit stumped. I did try fitting the model without covariates (human detection rate and on trail/off trail) and it did work so I guess now I should try adding in one covariate at a time to see when it generates the error. Thank you again for your insight on this!
<td width="66" nowrap vali
table summaryv2 rachel 15apr20.docx

Rachel Townsend

unread,
Dec 1, 2020, 3:18:35 PM12/1/20
to unmarked
Hi Ken,

I'm retackling this issue and wonder if you could help with a few quick questions. I've run detection probability on some of the seasons that didn't work and while they are low (as low as 0.031), they do not differ much from seasons that do work (as low as 0.037). 

Does Unmarked have a threshold for how low detection probability can be to run? 

Right now my J value is high, 90 to 92, because I am using 24 hour periods and analyzing my results by seasons. Do you think it would be helpful to bin the time interval into weeks so that J would be around 12? Or would that not be a good idea because I am looking at species interactions?

Thank you so much for any insight you may have.

Rachel

Ken Kellner

unread,
Dec 2, 2020, 2:08:56 PM12/2/20
to unmarked
Rachel,

There's no specific threshold, but the lower the p the more likely you are to run into issues. I would expect that even if your model successfully converges with p~0.05, your parameter estimates may have gigantic standard errors and thus won't be particularly useful. Looking back at your previous email, did you identify specific covariates that seemed to be contributing to your problems?

I think it's probably worth trying a weekly time interval. It shouldn't greatly change inference about occupancy at the site (which is over the entire period, regardless of how you break it up into smaller pieces). Regardless, you have to be careful when thinking about what any "interactions" mean - eg even if two species seem to occupy the same sites based on your analysis, you can't necessarily say they are *directly* interacting with each other. They might be active at completely different times, etc. This model can't address those kinds of questions.

Ken

Kery Marc

unread,
Dec 2, 2020, 2:35:34 PM12/2/20
to unma...@googlegroups.com
The First Law of Capture-Recapture: when p gets low, things get bad.

;)



From: unma...@googlegroups.com [unma...@googlegroups.com] on behalf of Ken Kellner [ken.k...@gmail.com]
Sent: 02 December 2020 20:08
To: unmarked
Subject: [unmarked] Re: error in optim when fitting model in unmarkedframeoccumulti

--
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/375f535f-c537-4e24-a8c0-88b439564cc1n%40googlegroups.com.

Rachel Townsend

unread,
Dec 15, 2020, 8:11:07 PM12/15/20
to unma...@googlegroups.com
Hi Ken,

My human rates covariate was the problem. I ran the model without covariates, it worked, and then added them back in and was able to determine just one species that was causing the error. 

I'm working on converting a season to the weekly time interval now. Thanks for the tips on interactions, I am definitely keeping that in mind. 

Rachel

--
You received this message because you are subscribed to a topic in the Google Groups "unmarked" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/unmarked/mYMpF7pwxa8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to unmarked+u...@googlegroups.com.

Tanvi Gurjar

unread,
Mar 9, 2024, 10:17:29 AM3/9/24
to unmarked
Hello everyone, 

I am also trying to fit a multispecies occupancy model, and am running into the same error: 
Error in optim(starts, nll, method = method, hessian = se, ...) : formal argument "hessian" matched by multiple actual arguments

Here is the code I am using:
(I have 5 sampling occasions, and am trying to fit a 3-species occupancy model)

siteCovs <- AMPHI_COVS[58:81]
siteCovs <- subset(siteCovs, select = -c(10,11,12,13)) #removing wtemp parameters because of NAs.

obsCovs <- list(MONTH = AMPHI_COVS[29:33],
                ACCESS = AMPHI_COVS[34:38],
                HYDROP = AMPHI_COVS[39:43])

MNDHM_Y_LIST <- list(TM = as.matrix(TM),
                     WSFC = as.matrix(WSFC),
                     KM = as.matrix(KM))

MNDHM_AMPHI3 <- unmarkedFrameOccuMulti(y = MNDHM_Y_LIST , siteCovs = siteCovs, obsCovs = obsCovs)

I don't understand what this error means, and specifying Hessian =  FALSE does not work and returns the same error.
A little more information on the siteCovs, obsCovs, and the different detection histories. I would really appreciate any help!!

> str(siteCovs) tibble [88 × 20] (S3: tbl_df/tbl/data.frame) $ MANAGEMENT: num [1:88] 2 2 3 2 2 3 2 2 2 3 ... ..- attr(*, "levels")= chr [1:3] "1" "2" "3" $ AGE : chr [1:88] "Jung" "Jung" "Jung" "Jung" ... ..- attr(*, "levels")= chr [1:2] "Alt" "Jung" $ SUBSTRATE : chr [1:88] "Sand" "Sand" "Sand" "Sand" ... ..- attr(*, "levels")= chr [1:2] "Gyp" "Lim" $ FISH : chr [1:88] "A" "A" "P" "P" ... ..- attr(*, "levels")= chr [1:2] "P" "A" $ RACOON : chr [1:88] "A" "A" "A" "A" ... ..- attr(*, "levels")= chr [1:2] "P" "A" $ LATITUDE : num [1:88] 50.9 50.9 50.9 50.9 50.9 ... $ LONGITUDE : num [1:88] 6.77 6.77 6.77 6.78 6.78 ... $ size : num [1:88, 1] -0.551 -0.551 -0.551 -0.551 -0.551 ... ..- attr(*, "scaled:center")= num 219823 ..- attr(*, "scaled:scale")= num 398721 $ years : num [1:88, 1] -0.572 -0.954 -0.858 -0.189 -0.189 ... ..- attr(*, "scaled:center")= num 11 ..- attr(*, "scaled:scale")= num 10.5 $ open.water: num [1:88, 1] -2.83 0.705 -1.527 -1.155 -1.155 ... ..- attr(*, "scaled:center")= num 81.1 ..- attr(*, "scaled:scale")= num 26.9 $ woods : num [1:88, 1] -0.745 -0.593 -0.782 -0.745 -0.593 ... ..- attr(*, "scaled:center")= num 20.6 ..- attr(*, "scaled:scale")= num 26.4 $ emerse.veg: num [1:88, 1] 2.996 -0.702 1.634 1.244 1.244 ... ..- attr(*, "scaled:center")= num 18 ..- attr(*, "scaled:scale")= num 25.7 $ reed : num [1:88, 1] -0.72 -0.72 2.41 1.79 2.25 ... ..- attr(*, "scaled:center")= num 23 ..- attr(*, "scaled:scale")= num 31.9 $ rushes : num [1:88, 1] 3.199 -0.858 -0.858 -1.072 -0.858 ... ..- attr(*, "scaled:center")= num 25.1 ..- attr(*, "scaled:scale")= num 23.4 $ avg.veg.ht: num [1:88, 1] -0.5254 -0.7554 0.5097 -0.2953 -0.0653 ... ..- attr(*, "scaled:center")= num 106 ..- attr(*, "scaled:scale")= num 87 $ total.area: num [1:88, 1] 0.167 0.167 0.167 0.167 0.167 ... ..- attr(*, "scaled:center")= num 150 ..- attr(*, "scaled:scale")= num 85.7 $ ac.area : num [1:88, 1] -0.0895 -0.0895 -0.0895 -0.0895 -0.0895 ... ..- attr(*, "scaled:center")= num 42.4 ..- attr(*, "scaled:scale")= num 16.9 $ inac.area : num [1:88, 1] 0.0895 0.0895 0.0895 0.0895 0.0895 ... ..- attr(*, "scaled:center")= num 57.6 ..- attr(*, "scaled:scale")= num 16.9 $ long_temp : num [1:88, 1] 1.09 1.09 1.09 1.09 1.09 ... ..- attr(*, "scaled:center")= num 10.1 ..- attr(*, "scaled:scale")= num 0.597 $ long_prec : num [1:88, 1] 0.485 0.485 0.485 0.485 0.485 ... ..- attr(*, "scaled:center")= num 721 ..- attr(*, "scaled:scale")= num 94.8

> str(obsCovs) List of 3 $ MONTH : tibble [88 × 5] (S3: tbl_df/tbl/data.frame) ..$ MONTH1: chr [1:88] "EAp" "EAp" "EAp" "EAp" ... ..$ MONTH2: chr [1:88] "EM" "EM" "EM" "EM" ... ..$ MONTH3: chr [1:88] "EJ" "EJ" "EJ" "EJ" ... ..$ MONTH4: chr [1:88] "MJu" "MJu" "MJu" "MJu" ... ..$ MONTH5: chr [1:88] "EaAu" "EaAu" "EaAu" "EaAu" ... $ ACCESS: tibble [88 × 5] (S3: tbl_df/tbl/data.frame) ..$ Accessibility...34: chr [1:88] "EASY" "EASY" "EASY" "EASY" ... ..$ Accessibility...35: chr [1:88] "EASY" "EASY" "EASY" "EASY" ... ..$ Accessibility...36: chr [1:88] "EASY" "EASY" "EASY" "EASY" ... ..$ Accessibility...37: chr [1:88] "EASY" "EASY" "EASY" "EASY" ... ..$ Accessibility...38: chr [1:88] "EASY" "EASY" "EASY" "EASY" ... $ HYDROP: tibble [88 × 5] (S3: tbl_df/tbl/data.frame) ..$ Hydroperiod...39: chr [1:88] "WET" "WET" "WET" "WET" ... ..$ Hydroperiod...40: chr [1:88] "WET" "WET" "WET" "WET" ... ..$ Hydroperiod...41: chr [1:88] "WET" "WET" "WET" "WET" ... ..$ Hydroperiod...42: chr [1:88] "WET" "WET" "WET" "WET" ... ..$ Hydroperiod...43: chr [1:88] "WET" "WET" "WET" "WET" ...

> str(TM) tibble [88 × 5] (S3: tbl_df/tbl/data.frame) $ o1: num [1:88] 0 0 0 0 0 0 0 0 0 0 ... $ o2: num [1:88] 1 0 0 1 0 1 1 0 0 0 ... $ o3: num [1:88] 1 0 0 1 0 0 1 0 0 0 ... $ o4: num [1:88] 0 0 0 1 1 1 1 1 0 0 ... $ o5: num [1:88] 0 0 0 1 0 0 0 0 0 0 ... > str(KM) tibble [88 × 5] (S3: tbl_df/tbl/data.frame) $ o1: num [1:88] 0 0 0 0 0 0 0 0 0 0 ... $ o2: num [1:88] 0 0 0 0 0 0 0 0 0 0 ... $ o3: num [1:88] 0 0 0 0 0 0 0 0 0 0 ... $ o4: num [1:88] 0 0 0 0 0 0 0 0 0 0 ... $ o5: num [1:88] 0 0 0 0 0 0 0 0 0 0 ... > str(WSFC) tibble [88 × 5] (S3: tbl_df/tbl/data.frame) $ YEAR: num [1:88] 2022 2022 2022 2022 2022 ... $ o1 : num [1:88] 1 0 1 1 1 1 1 1 1 1 ... $ o2 : num [1:88] 0 0 1 1 1 1 1 1 1 1 ... $ o3 : num [1:88] 0 0 1 1 1 1 1 0 1 1 ... $ o4 : num [1:88] 0 0 1 1 1 1 1 1 1 1 ... Thanking you and best wishes,
Tanvi

Ken Kellner

unread,
Mar 9, 2024, 11:12:56 AM3/9/24
to unmarked
The code you've shown is for constructing the unmarkedFrame. Presumably the error appears when you actually try to run the model with occuMulti() - what is the exact code you are using to do that?

Tanvi Gurjar

unread,
Mar 9, 2024, 2:03:38 PM3/9/24
to unmarked
Dear Ken, 

Here's the code for the model:

 m0 <- occuMulti(detformulas = c('~1','~1','~1'),
                stateformulas = c('~1','~1','~1'),
                maxOrder = 1, hessian=FALSE,
                data = MNDHM_AMPHI3)

Ken Kellner

unread,
Mar 9, 2024, 2:46:34 PM3/9/24
to unma...@googlegroups.com
If you don't want to calculate the Hessian, set se = FALSE, not hessian = FALSE.
> >>>>>>> *Season*
> >>>>>>>
> >>>>>>> *Year*
> >>>>>>>
> >>>>>>> *No. Cameras*
> >>>>>>>
> >>>>>>> *Trapnights*
> >>>>>>>
> >>>>>>> *Coyote*
> >>>>>>>
> >>>>>>> *(1s)*
> >>>>>>>
> >>>>>>> *Gray fox*
> >>>>>>>
> >>>>>>> *Bobcat*
> >>>>>>>
> >>>>>>> *Human dr*
> >>>>>>>
> >>>>>>> *X (MIN – MAX)*
> >>>>>>>
> >>>>>>> *Fall*
> >>>>>>>
> >>>>>>> 2014
> >>>>>>>
> >>>>>>> 127
> >>>>>>>
> >>>>>>> 7571
> >>>>>>>
> >>>>>>> 206
> >>>>>>>
> >>>>>>> 455
> >>>>>>>
> >>>>>>> 219
> >>>>>>>
> >>>>>>> 3.24 (0 - 39)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> 2015
> >>>>>>>
> >>>>>>> 118
> >>>>>>>
> >>>>>>> 8954
> >>>>>>>
> >>>>>>> 254
> >>>>>>>
> >>>>>>> 665
> >>>>>>>
> >>>>>>> 222
> >>>>>>>
> >>>>>>> 4.02 (0 – 50)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> 2016
> >>>>>>>
> >>>>>>> 84
> >>>>>>>
> >>>>>>> 6743
> >>>>>>>
> >>>>>>> 160
> >>>>>>>
> >>>>>>> 578
> >>>>>>>
> >>>>>>> 109
> >>>>>>>
> >>>>>>> 2.36(0 – 29)
> >>>>>>>
> >>>>>>> *Winter*
> >>>>>>>
> >>>>>>> 2014
> >>>>>>>
> >>>>>>> 120
> >>>>>>>
> >>>>>>> 8913
> >>>>>>>
> >>>>>>> 226
> >>>>>>>
> >>>>>>> 442
> >>>>>>>
> >>>>>>> 279
> >>>>>>>
> >>>>>>> 3.59(0 – 43)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> 2015
> >>>>>>>
> >>>>>>> 110
> >>>>>>>
> >>>>>>> 8673
> >>>>>>>
> >>>>>>> 176
> >>>>>>>
> >>>>>>> 644
> >>>>>>>
> >>>>>>> 218
> >>>>>>>
> >>>>>>> 3.36(0 – 30)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> 2016
> >>>>>>>
> >>>>>>> 84
> >>>>>>>
> >>>>>>> 6163
> >>>>>>>
> >>>>>>> 147
> >>>>>>>
> >>>>>>> 434
> >>>>>>>
> >>>>>>> 126
> >>>>>>>
> >>>>>>> 2.21(0 – 25)
> >>>>>>>
> >>>>>>> *Spring*
> >>>>>>>
> >>>>>>> 2015
> >>>>>>>
> >>>>>>> 119
> >>>>>>>
> >>>>>>> 9040
> >>>>>>>
> >>>>>>> 158
> >>>>>>>
> >>>>>>> 432
> >>>>>>>
> >>>>>>> 239
> >>>>>>>
> >>>>>>> 3.43(0 – 35)
> >>>>>>>
> >>>>>>
> >>>>>>>
> >>>>>>> 2016
> >>>>>>>
> >>>>>>> 93
> >>>>>>>
> >>>>>>> 7726
> >>>>>>>
> >>>>>>> 104
> >>>>>>>
> >>>>>>> 402
> >>>>>>>
> >>>>>>> 150
> >>>>>>>
> >>>>>>> 2.73(0 – 37)
> >>>>>>>
> >>>>>> <td width="66" nowrap vali
> >>>>>>>
> >>>>>> --
> >>>> You received this message because you are subscribed to a topic in the
> >>>> Google Groups "unmarked" group.
> >>>> To unsubscribe from this topic, visit
> >>>> https://groups.google.com/d/topic/unmarked/mYMpF7pwxa8/unsubscribe.
> >>>> To unsubscribe from this group and all its topics, send an email to
> >>>> unmarked+u...@googlegroups.com.
> >>>
> >>>
> >>>> To view this discussion on the web visit
> >>>> https://groups.google.com/d/msgid/unmarked/375f535f-c537-4e24-a8c0-88b439564cc1n%40googlegroups.com
> >>>> <https://groups.google.com/d/msgid/unmarked/375f535f-c537-4e24-a8c0-88b439564cc1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> >>>> .
> >>>>
> >>>
>
> --
> *** 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/0390ad26-6fc8-4caa-a8db-2373a5e2f30cn%40googlegroups.com.

Tanvi Gurjar

unread,
Mar 9, 2024, 3:23:09 PM3/9/24
to unmarked
Dear Ken, 

It still returns the same error message: 
m0 <- occuMulti(detformulas = c('~1','~1','~1'), + stateformulas = c('~1','~1','~1'), + maxOrder = 1, se = FALSE, + data = MNDHM_AMPHI3) Error in optim(starts, nll, method = method, hessian = se, ...) : non-finite finite-difference value [5]

I'm afraid I still don't understand the cause of the error.

Many thanks and best wishes, 
Tanvi

Ken Kellner

unread,
Mar 9, 2024, 3:33:08 PM3/9/24
to unma...@googlegroups.com
Well, that's a different error now. Probably there is some issue with your y-matrices.

Look at the individual y-matrices you combine into MNDHM_Y_LIST. Are all of them numeric? Do they contain only values 0, 1, and NA? Do you actually have at least some detections (1) for all three species?

If you share the output of

str(MNDHM_Y_LIST) that may be helpful.

You may also start by trying to fit individual single-species occupancy models for each of the three species (using occu). That might narrow down the issue.
> To view this discussion on the web visit https://groups.google.com/d/msgid/unmarked/6797dfb3-4d54-429a-9d02-a05b3d5e133bn%40googlegroups.com.

Tanvi Gurjar

unread,
Mar 13, 2024, 12:36:21 PM3/13/24
to unmarked
Dear Ken, 

It seems that a covariate (Waterbody Age) had accidentally made it's way into the detection/non-detection matrix of one of the species, because I erroneously assigned the column numbers. 

Thank you for your time and efforts!

Many thanks and best wishes, 
Tanvi

Reply all
Reply to author
Forward
0 new messages