Function to simulate covariate model of density

55 views
Skip to first unread message

mayank

unread,
Nov 16, 2017, 1:33:36 PM11/16/17
to secr
Hi Murray and Others
Could you help me how to write extractfn for covariate coefficients.
I would like to run D~elv+ruggedness model with 50 simulation/bootstrap in sim.secr function, also I would like to see the beta coefficients for each simulation. How to get that?

Murray Efford

unread,
Nov 16, 2017, 2:12:21 PM11/16/17
to secr
I often use extractfn = identity and manipulate the resulting list of lists of secr fitted models, but this takes a lot of space when nrepl is large and can test your R skills. More directly, why not use the coef function?

## a simple example
scen1
<- make.scenarios(D = c(5,10), sigma = 25, g0 = 0.2, noccasions =
                            c
(5,10))
traps1
<- make.grid()   ## default 6 x 6 trap grid
tmp1
<- run.scenarios(nrepl = 2, trapset = traps1, scenarios = scen1,
                      fit
.args = list(model=g0~b), fit = TRUE, extractfn = coef)
## selecting one coefficient (i.e. one row in coef table)
summary
(tmp1, parameter = 'g0.bTRUE')

Murray

Murray Efford

unread,
Nov 16, 2017, 2:16:26 PM11/16/17
to secr
I cut and pasted the wrong line! That should have been
summary(select.stats(tmp1, parameter='g0.bTRUE'))
Reply all
Reply to author
Forward
0 new messages