Hi Murray,
I'm running some simulations to test some new proposed trap layouts with different parameters for males and females. Here is my code (using the example given in the secrdesign vignette, thanks for that).
library(secrdesign)
library(rgdal)
ciArea <- readOGR("ChurchillIs_1m_elev_area.shp")
ciScenarios <- make.scenarios(D = 0.944, g0 = 0.3, sigma = 30, noccasions = c(3,4), groups = c('F', 'M'), detectfn = "HR")
male <- ciScenarios$group == 'M'
ciScenarios$D[male] <- 1.847
ciScenarios$g0[male] <- 0.4
ciScenarios$sigma[male] <- 35
ciScenarios[,1:8]
ciGrid <- read.traps("ciTraps.txt")
ciMask <- make.mask(ciGrid, buffer = 160, type = "trapbuffer", poly = ciArea)
exfn <- function(x) {
if (inherits(x, 'secr') & !is.null(x$fit)) {
pred <- predict(x)
pred[[1]][c('D','pmix'),]
}
else data.frame()
}
rawCiScen <- run.scenarios(100, ciScenarios, trapset = list(ciGrid))
summary(rawCiScen)
ciSims <- run.scenarios(100, scenarios = ciScenarios, trapset = list(ciGrid), fit = TRUE,
extractfn = exfn, fit.args = list(model = list(g0~h2, sigma~h2),
hcov = 'group'), maskset = list(ciMask))
summary(select.stats(ciSims, 'D'))$OUTPUT
summary(select.stats(ciSims, 'pmix'))$OUTPUT
And here is my OUTPUT
> summary(rawCiScen)
run.scenarios(nrepl = 100, scenarios = ciScenarios, trapset = list(ciGrid))
Replicates 100
Started 09:54:27 09 Nov 2017
Run time 1.034 minutes
Output class selectedstatistics
$constant
value
trapsindex 1
nrepeats 1
detectfn 1
recapfactor 1
popindex 1
detindex 1
fitindex 1
$varying
scenario group noccasions D g0 sigma maskindex
1 F 3 0.944 0.3 30 1
1 M 3 1.847 0.4 35 2
2 F 4 0.944 0.3 30 1
2 M 4 1.847 0.4 35 2
$detectors
trapsindex trapsname
1 traps1
OUTPUT
$1
group = F, noccasions = 3, D = 0.944, g0 = 0.3, sigma = 30, maskindex = 1 +
group = M, noccasions = 3, D = 1.847, g0 = 0.4, sigma = 35, maskindex = 2
n mean se
F.n 100 160.37000 1.14094
F.ndet 100 340.38000 2.63162
F.nmov 100 175.13000 1.59732
F.dpa 100 2.08314 0.00548
M.n 100 323.63000 1.92714
M.ndet 100 796.44000 4.84900
M.nmov 100 460.78000 2.99834
M.dpa 100 2.40987 0.00391
$2
group = F, noccasions = 4, D = 0.944, g0 = 0.3, sigma = 30, maskindex = 1 +
group = M, noccasions = 4, D = 1.847, g0 = 0.4, sigma = 35, maskindex = 2
n mean se
F.n 100 166.07000 1.35790
F.ndet 100 457.97000 3.82341
F.nmov 100 283.97000 2.54104
F.dpa 100 2.68110 0.00787
M.n 100 323.13000 1.89532
M.ndet 100 1054.04000 6.11283
M.nmov 100 711.56000 4.22846
M.dpa 100 3.15587 0.00474
Looks good but then:
> ciSims <- run.scenarios(100, scenarios = ciScenarios, trapset = list(ciGrid), fit = TRUE,
+ extractfn = exfn, fit.args = list(model = list(g0~h2, sigma~h2),
+ hcov = 'group'), maskset = list(ciMask))
Completed scenario 1
Completed scenario 2
Completed in 14.951 minutes
> summary(select.stats(ciSims, 'D'))$OUTPUT
$`1`
n mean se
estimate 0 NA NA
SE.estimate 0 NA NA
lcl 0 NA NA
ucl 0 NA NA
RB 0 NA NA
RSE 0 NA NA
COV 0 NA NA
$`2`
n mean se
estimate 0 NA NA
SE.estimate 0 NA NA
lcl 0 NA NA
ucl 0 NA NA
RB 0 NA NA
RSE 0 NA NA
COV 0 NA NA
I have attached my detector layout. I have tried it without specifying 'poly' in make.mask too but no luck.