Hi again Murray
I've been playing with the secrdesign group sims and am getting some strange results that I wanted to show you. Essentially, when I simulate two populations independently under a scenario that generates lots of data, I get unbiased performance for all parameters. But when I do the exact same thing using groups I am getting biased estimates for the detection function parameters (large positive bias in lambda0 and slight negative bias in sigma). See below:
###############################################
#simulation using 2 independent pops with same trap array
#all parameters unbiased (1% or less)
################################################
scen.testF <- make.scenarios (D = 8, lambda0 = 1.5, sigma = 30, detectfn = 'HHN', noccasions = 1)
scen.testM <- make.scenarios (D = 6, lambda0 = 1.2, sigma = 40, detectfn = 'HHN', noccasions = 1)
traps.testF <- make.grid(8,8, detector = 'count', spacing = 30)
mask.testF <- make.mask(traps.testF, buffer = 120, type = 'trapbuffer')
sims.testF.30 <- run.scenarios(100, scen.testF, trapset = traps.testF, fit = TRUE, fit.args = list(detectfn = 'HHN'), extractfn = predict, maskset = mask.testF)
sims.testM.30 <- run.scenarios(100, scen.testM, trapset = traps.testF, fit = TRUE, fit.args = list(detectfn = 'HHN'), extractfn = predict, maskset = mask.testF)
> D.ests <- select.stats(sims.testF.30, parameter = "D", statistics = c("estimate","SE.estimate","RB", "RSE", "COV","lcl","ucl"))
> L0.ests <- select.stats(sims.testF.30, parameter = "lambda0", statistics = c("estimate","SE.estimate","RB", "RSE", "COV","lcl","ucl"))
> Sig.ests <- select.stats(sims.testF.30, parameter = "sigma", statistics = c("estimate","SE.estimate","RB", "RSE", "COV","lcl","ucl"))
> summary(D.ests, dec = 6, fields = c("n", "mean", "se"), alpha = 0.05, type = "list")
OUTPUT
n mean se
estimate 100 8.056524 0.082877
SE.estimate 100 0.916811 0.005037
lcl 100 6.450952 0.073358
ucl 100 10.062951 0.092633
RB 100 0.007066 0.010360
RSE 100 0.114375 0.000584
COV 100 0.970000 0.017145
summary(L0.ests, dec = 4, fields = c("n", "mean", "se"), alpha = 0.05, type = "list")
OUTPUT
n mean se
estimate 100 1.5156 0.0111
SE.estimate 100 0.1114 0.0010
lcl 100 1.3126 0.0099
ucl 100 1.7501 0.0126
RB 100 0.0104 0.0074
RSE 100 0.0736 0.0005
COV 100 0.9500 0.0219
summary(Sig.ests, dec = 4, fields = c("n", "mean", "se"), alpha = 0.05, type = "list")
OUTPUT
n mean se
estimate 100 29.9356 0.0950
SE.estimate 100 0.9496 0.0078
lcl 100 28.1319 0.0903
ucl 100 31.8556 0.1022
RB 100 -0.0021 0.0032
RSE 100 0.0317 0.0002
COV 100 0.9500 0.0219
D.ests2 <- select.stats(sims.testM.30, parameter = "D", statistics = c("estimate","SE.estimate","RB", "RSE", "COV","lcl","ucl"))
L0.ests2 <- select.stats(sims.testM.30, parameter = "lambda0", statistics = c("estimate","SE.estimate","RB", "RSE", "COV","lcl","ucl"))
Sig.ests2 <- select.stats(sims.testM.30, parameter = "sigma", statistics = c("estimate","SE.estimate","RB", "RSE", "COV","lcl","ucl"))
summary(D.ests2, dec = 6, fields = c("n", "mean", "se"), alpha = 0.05, type = "list")
OUTPUT
n mean se
estimate 100 6.059114 0.071818
SE.estimate 100 0.719551 0.004657
lcl 100 4.805290 0.063148
ucl 100 7.641427 0.080808
RB 100 0.009852 0.011970
RSE 100 0.119529 0.000689
COV 100 0.970000 0.017145
summary(L0.ests2, dec = 4, fields = c("n", "mean", "se"), alpha = 0.05, type = "list")
OUTPUT
n mean se
estimate 100 1.1998 0.0080
SE.estimate 100 0.0869 0.0008
lcl 100 1.0412 0.0073
ucl 100 1.3827 0.0090
RB 100 -0.0002 0.0067
RSE 100 0.0725 0.0006
COV 100 0.9700 0.0171
summary(Sig.ests2, dec = 3, fields = c("n", "mean", "se"), alpha = 0.05, type = "list")
OUTPUT
n mean se
estimate 100 39.937 0.154
SE.estimate 100 1.355 0.012
lcl 100 37.369 0.143
ucl 100 42.683 0.169
RB 100 -0.002 0.004
RSE 100 0.034 0.000
COV 100 0.900 0.030
##############################
#simulation using groups
#D unbiased but large bias in lambda0 (over 100%)
#and negative bias in sigma
###############################
scen <- make.scenarios (D = 8, lambda0 = 1.5, sigma = 30, detectfn = 'HHN', noccasions = 1, groups = c('F','M'))
# replace density, lambda0 and sigma values of males
male <- scen$group == 'M'
scen$D[male] <- 6
scen$lambda0[male] <- 1.2
scen$sigma[male] <- 40
grid <- make.grid(8, 8, spacing = 30, detector = "count")