View source: R/defaultextractfn.R
| defaultextractfn | R Documentation |
The function applied by run.scenarios to the result of each
replicate when extractfn is not provided. It may be called from a
user-written extract function that modifies or adds to the default output.
defaultextractfn(x, ...)
x |
object to summarise: a fitted model (class ‘secr’ or ‘ipsecr’), a list of fitted models (class ‘secrlist’), a capthist object, or a ‘try-error’ from a failed fit |
... |
other arguments, including |
The result depends on the class of x.
| fitted model | data.frame from predict(x) with attributes counts, start, method, proctime, chat, code and convergence |
| secrlist | named list of the above, one per model (see below) |
| capthist | vector of counts of the raw data |
| try-error | data.frame with no rows or columns |
If keepdensity = TRUE is passed to run.scenarios then the
simulated density surface (attribute D of the capthist object, if present) is
saved as attribute D.
With fit = "multifit", run.scenarios fits several models to each
simulated dataset and x is a secrlist. Models are named by the
names of the nested fit.args list if provided; otherwise by their
formulae if these differ, or model1, model2, etc.
A user-written extractfn for fit = "multifit"
should return a named list of data.frames of the same form
(one per model) if the results are to be summarised with
estimateSummary or countSummary.
If a fit fails in a replicate, x is a plain list that includes a ‘try-error’
and the corresponding component of the result is an empty data.frame.
See Details.
run.scenarios, estimateSummary
## Not run:
# two models fitted to each simulated dataset
fitargs <- list(
null = list(model = list(D~1, g0~1, sigma~1)),
bhv = list(model = list(D~1, g0~b, sigma~1)))
# fit.args is a nested list: one list of models for each fitindex
sims <- run.scenarios(100, scen, trps, msk, fit = "multifit", fit.args = list(fitargs))
estimateSummary(sims, "D") # all models, with a 'model' column
estimateSummary(sims, "D", model = "bhv")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.