Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

par.secr.fit

Fit Multiple SECR Models


Description

These functions are wrappers for secr.fit, region.N and derived that allow multiple models to be fitted simultaneously on multi-core machines (but see Warning).

Usage

par.secr.fit (arglist, ncores = 1, seed = NULL, trace = TRUE, logfile = "logfile.txt", 
    prefix = "fit.", LB = FALSE, save.intermediate = FALSE)
par.derived (secrlist, ncores = 1, ...)
par.region.N (secrlist, ncores = 1, ...)

Arguments

arglist

list of argument lists for secr.fit or a character vector naming such lists

ncores

integer number of cores to be used for parallel processing

seed

integer pseudorandom number seed

trace

logical; if TRUE intermediate output may be logged

logfile

character name of file to log progress reports

prefix

character prefix for names of output

LB

logical; if TRUE then use load balancing

save.intermediate

logical; if TRUE then each fit is saved to an external file

...

other arguments passed to derived or region.N

secrlist

secrlist object

Details

From version 4.0, an arglist may specify ncores for a particular secr fit (previously ncores was ignored in arglist).

trace overrides any settings in arglist. Reporting of intermediate results is unreliable on Windows when ncores > 1.

It is convenient to provide the names of the capthist and mask arguments in each component of arglist as character values (i.e. in quotes); objects thus named are exported from the workspace to each worker process (see Examples).

Setting LB = TRUE when ncores > 1 causes the function to call clusterApplyLB instead of clusterApply. Load balancing in clusterApplyLB is likely to result in faster completion than the default if fits differ in their in execution time and ncores < length(arglist), but this cannot be guaranteed owing to the additional communication required with the worker processes. Results with LB = TRUE for a given seed may not be reproducible.

save.intermediate causes each fit to be saved to a file with extension .RData.

Value

For par.secr.fit - secrlist of model fits (see secr.fit). Names are created by prefixing prefix to the names of argslist. If trace is TRUE then the total execution time and finish time are displayed.

For par.derived - a list of dataframes output from derived, applied to each model in turn.

For par.region.N - a list of dataframes output from region.N, applied to each model in turn.

Warning

With the introduction of multi-threading in secr 4.0, par.secr.fit has lost its speed advantage.

See Also

Examples

## Not run: 

fit0 <- list(capthist = 'captdata', model = g0~1) 
fitb <- list(capthist = 'captdata', model = g0~b)
fits <- par.secr.fit (c('fit0','fitb'))
AIC(fits)

par.derived(fits, se.esa = FALSE)

par.region.N(fits)


## End(Not run)

secr

Spatially Explicit Capture-Recapture

v4.4.1
GPL (>= 2)
Authors
Murray Efford
Initial release
2021-05-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.