Re: Help with mask and model fitting

225 views
Skip to first unread message

Allan Tarugara

unread,
Apr 26, 2022, 4:05:24 AM4/26/22
to secr
Hi all

My question regards making a habitat mask. I tried using a shape file of the study area polygon but it was giving error messages and then tried another method given in the habitmasks.pdf, that is, creating a mask from a data frame of trap locations; this worked and plotted correctly (see below and attached).

> Mal_xy <- data.frame(x,y)
> str(Mal_xy)
'data.frame': 210 obs. of  2 variables:
 $ x: num  380377 381874 383690 385729 387949 ...
 $ y: num  7680086 7680245 7680002 7679496 7680458 ...
> Mal_Mask <- read.mask(data = Mal_xy, type = "polygon", poly = Mal_xy)

> plot(Mal_Mask)

Fitting models e.g. [MalHyena.0 <- secr.fit (MalHyena, model = list(g0 ~ 1), mask = Mal_Mask, details=list(fastproximity=FALSE))] returns the error message below;
Error in (function (f, p, ..., hessian = FALSE, typsize = rep(1, length(p)),  :
  missing value in parameter
In addition: Warning messages:
1: In autoini(capthist = ch, mask = msk, binomN = tempbinomN, adjustg0 = details$binomN[1] ==  :
  'autoini' failed to find g0; setting initial g0 = 0.1
2: In log(x) : NaNs produced


and the following results output;
Beta parameters (coefficients)
      beta SE.beta lcl ucl
D       NA      NA  NA  NA
g0      NA      NA  NA  NA
sigma   NA      NA  NA  NA

Variance-covariance matrix of beta parameters
NULL

Fitted (real) parameters evaluated at base levels of covariates
       link estimate SE.estimate lcl ucl
D       log       NA          NA  NA  NA
g0    logit       NA          NA  NA  NA
sigma   log       NA          NA  NA  NA


Your help is much appreciated.

Regards,
Allan.

On Tue, 5 Apr 2022 at 22:55, Murray Efford <murray...@gmail.com> wrote:
Then you may want to forget about buffers and use a predefined mask limited to the extent of the fenced reserve.
Murray

On Wednesday, April 6, 2022 at 6:43:34 AM UTC+12 allant...@gmail.com wrote:
Hi Murray

Thanks once again for the helpful response. I will refer to secr-habitatmasks.pdf for more information. Yes the game reserve is electric fenced in its entirety and generally restricts hyena movement in and out of the reserve.

Regards,
Allan.

On 05 Apr,2022, at 19:29, Murray Efford <murray...@gmail.com> wrote:

<moves.png>
CAPTURE does not have a reliable method for estimating density from your data, so the comparison is unhelpful. Your animals are very mobile so you need a large buffer unless there is a known boundary to the habitat. See secr-habitatmasks.pdf. The buffer does _not_ define an ETA.


On Tuesday, April 5, 2022 at 10:15:07 PM UTC+12 allant...@gmail.com wrote:
Hi Murray

Thanks so much for your help, very much appreciated. I reran the analysis using the code specifications you provided in your response and reproduced the same result.
However, given a study area size of 490 km2, I feel that a buffer of 20000 (i.e. 20 km) would make the effective sampled area too big resulting in an underestimate of the density. Specifying a buffer of 2000 (i.e. a strip of 2 km around the trapping array) would be more realistic but returns the following message:

Warning messages:
1: In bias. D(buffer, temptrps, detectfn = output$detectfn, detectpar = dpar,  :
  bias. D() does not allow for variable effort (detector usage)
2: In buffer bias check (output, buffer, bias Limit) :
  predicted relative bias exceeds 0.01 with buffer = 2000

A buffer of 20000 gives a density of 12.26 hyenas/100 km2 (which seems like an underestimate) while that of 2000 gives a density of 21.67 animals/100 km2, which I believe is more practical and comparable to the Program CAPTURE estimate of 23.27 hyenas/100 km2.
Does the above warning message render the result technically incorrect?

Regards,
Allan.

On Tuesday, 5 April 2022 at 04:56:26 UTC+2 murray...@gmail.com wrote:
Hello Allan

Ahh. Your R code analyses 'captdata' that is a builtin dataset with simulated animals at about 5.5/ha (see ?captdata)! I also find two probably typos in TrapSECR.txt (missing initial 3 of x-coordinates T13, T72). And you will need a much larger buffer (I suggest 20000). Then

MalHyena.0 <- secr.fit (MalHyena, model = list(g0 ~ 1), buffer = 20000, details=list(fastproximity = FALSE))
 predict(MalHyena.0)
       link     estimate  SE.estimate          lcl          ucl
D       log 1.226085e-03 2.392799e-04 8.393676e-04 1.790974e-03
g0    logit 2.665433e-02 5.931733e-03 1.719303e-02 4.110439e-02
sigma   log 5.085863e+03 6.426653e+02 3.974019e+03 6.508777e+03


I used fastproximity=FALSE as it looks like you will want to compare models with time-varying probabilities.
Murray
On Friday, April 1, 2022 at 10:28:32 PM UTC+13 allant...@gmail.com wrote:
Hello everyone

I am new to secr and would like to generate population statistics for a spotted hyena dataset collected using camera traps. I have written and run the code but my results are not intuitive or comparable to a parallel analysis I ran in Program CAPTURE. The secr analysis returns a density of 5.5 hyenas per ha which is significantly different to the 0.00233 animals per ha that I got from CAPTURE. Attached are the input files and R code that I used and a Word file with highlighted screenshots of the R output that I find need help with for your reference.

Kind regards,
Allan.

--
You received this message because you are subscribed to a topic in the Google Groups "secr" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/secrgroup/o2xzdn9zCGY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to secrgroup+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/secrgroup/861b964c-39c4-4e2c-9d68-97ecf2ee2c2cn%40googlegroups.com.
<moves.png>

--
You received this message because you are subscribed to a topic in the Google Groups "secr" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/secrgroup/o2xzdn9zCGY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to secrgroup+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/secrgroup/3facd5a8-9109-4181-aa5f-3a9a8d235b53n%40googlegroups.com.
Screenshot (23).png
Screenshot (22).png

indu...@gmail.com

unread,
Apr 26, 2022, 11:31:09 AM4/26/22
to secr
Hi Allan,

I think you want make.mask rather than read.mask. With a truncated version of your polygon and a made-up spacing, something like:

x <- c(380377,381874,383690,385729,387949,380377)
y <- c(7680086,7680245,7680002,7679496,7680458,7680086)
Mal_xy <- data.frame(x = x, y =y)
Mal_Mask <- make.mask(type = "polygon", poly = Mal_xy, spacing = 100)
plot(Mal_Mask) 

Pretty sure read.mask doesn't use polygon arguments and these are just being ignored, so the data frame with the polygon outline gets used directly as mask points - that gives the error because all the interior points are missing.

Hope that helps,
Ian

Reply all
Reply to author
Forward
0 new messages