SECR error message

21 views
Skip to first unread message

Cheryl Lohr

unread,
Jan 13, 2026, 5:35:32 PMJan 13
to secr
OFFICIAL

Dear Murray,
Hopefully a very simple question: but this is an error message I've not encountered before.

> fit5<-secr.fit(BLwarren, mask = m1, detectfn = 'HR', +               model = list(sigma~g), groups = 'Sex') Checking data Preparing detection design matrices Preparing density design matrix Finding initial parameter values... Initial values  D = 0.25578, g0 = 0.03345, sigma = 347.85941 Maximizing likelihood... Eval     Loglik              D             g0          sigma       sigma.gM sigma.gUnknown              z
Error in .localstuff$Eng[sessnum, g] <- N * meanpdot : number of items to replace is not a multiple of replacement length
All previous models in this set running very smoothly. No errors in input data. The only thing that is different is this model includes an individual grouping covariate. I'm using the same mask and detectfn. Never had a problem with this script before today. Is there a recent update issue I need to deal with?

Thanks,
Cheryl

Cheryl Lohr

Senior Research Scientist, Animal Science Program

DBCA Biodiversity and Conservation Science

Location: 37 Wildlife Pl, Woodvale, WA 6026

Mail: Woodvale Wildlife Research Centre

Locked Bag 104 Bentley Delivery Centre

WA 6983

Mob: 0407335004

 

The Department acknowledges all Aboriginal people as the traditional owners of the land and waters it manages throughout Western Australia. We pay our respects to them, their culture and to their Elders past and present. Our office is located on the lands of the Whadjuk Noongar People.

 

 


This message is confidential and is intended for the recipient named above. If you are not the intended recipient, you must not disclose, use or copy the message or any part of it. If you received this message in error, please notify the sender immediately by replying to this message, then delete it from your system.

Murray Efford

unread,
Jan 13, 2026, 9:08:57 PMJan 13
to secr
Hello Cheryl
I can't put my finger on the cause right away and I'm away from my desk for a few days. It might be informative to try the alternative conditional likelihood relative density model 
fit6 <- secr.fit(BLwarren, mask = m1, detectfn = 'HR', model = list(sigma~Sex), CL=TRUE)
(not really documented yet). I'll check this out when I get back.
Murray

K. Kilshaw

unread,
Jan 15, 2026, 4:18:10 AMJan 15
to secr
Following as having the exact same error when I try and include group.

Cheryl Lohr

unread,
Jan 18, 2026, 6:26:55 PMJan 18
to secr, K. Kilshaw
OFFICIAL

Dear Murray,
Once again thanks for being the best with your rapid responses!

It looks like CL=TRUE must be included for the script to work if it has an individual covariate.

fit6 <- secr.fit(BLwarren, mask = m1, detectfn = 'HR', model = list(sigma~Sex), CL=TRUE)#Worked
fit6 <- secr.fit(BLwarren, mask = m1, detectfn = 'HR', model = list(sigma~Sex))#Error

Error in secr.design.MS(capthist, model, timecov, sessioncov, groups, : seems you are trying to use individual covariates in a full-likelihood model

This error message is more informative than the previous error which is copied here.

fit5<-secr.fit(BLwarren, mask = m1, detectfn = 'HR', model = list(sigma~g), groups = 'Sex') #generated the following error message.

Error in .localstuff$Eng[sessnum, g] <- N * meanpdot : number of items to replace is not a multiple of replacement length

It looks like we also no longer need to explicitly define the individual covariates?? Correct?

Thanks,
Cheryl

Cheryl Lohr

Senior Research Scientist, Animal Science Program

DBCA Biodiversity and Conservation Science

Location: 37 Wildlife Pl, Woodvale, WA 6026

Mail: Woodvale Wildlife Research Centre

Locked Bag 104 Bentley Delivery Centre

WA 6983

Mob: 0407335004

 

The Department acknowledges all Aboriginal people as the traditional owners of the land and waters it manages throughout Western Australia. We pay our respects to them, their culture and to their Elders past and present. Our office is located on the lands of the Whadjuk Noongar People.

 

 



From: 'K. Kilshaw' via secr <secr...@googlegroups.com>
Sent: Thursday, January 15, 2026 5:18 PM
To: secr <secr...@googlegroups.com>
Subject: Re: SECR error message

[External Email] This email was sent from outside the department – be cautious, particularly with links and attachments.
--
You received this message because you are subscribed to the Google Groups "secr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to secrgroup+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/secrgroup/3b7d5f34-0419-4e0f-b6be-2846b8b74229n%40googlegroups.com.

Murray Efford

unread,
Jan 20, 2026, 2:30:41 AMJan 20
to secr
Yes, it's correct that you can only include individual covariates of detection in a model fitted by maximizing the conditional likelihood (CL = TRUE). This has always been the case. However, it has become possible in recent versions to also model relative (not absolute) density in CL = TRUE models. This is briefly outlined in the SECR book; also see  Efford MG 2025. Spatially explicit capture–recapture models for relative density. bioRxiv DOI: 10.1101/2025.01.22.634401.

I think your "explicitly define the individual covariate" relates to the alternative hybrid mixture approach (e.g. hcov = 'Sex', sigma~h2), which is still available.

I'll see what can be done to sharpen the error messages.

Murray
Reply all
Reply to author
Forward
0 new messages