oSCR.fit: Main fitting function in 'oSCR'

oSCR.fitR Documentation

Main fitting function in oSCR

Description

Flexible likelihood analysis of the multi-session sex-structured (MSSS) spatial capture-recapture models

Usage

oSCR.fit(
  model = list(D ~ 1, p0 ~ 1, sig ~ 1, asu ~ 1),
  scrFrame,
  ssDF,
  encmod = c("B", "P", "CLOG", "M")[1],
  multicatch = FALSE,
  theta = 2,
  trimS = NULL,
  DorN = c("D", "N")[1],
  sexmod = c("constant", "session")[1],
  costDF = NULL,
  distmet = c("euc", "user", "ecol")[1],
  directions = 8,
  PROJ = NULL,
  rsfDF = NULL,
  RSF = FALSE,
  telemetry.type = c("none", "ind", "dep")[1],
  se = TRUE,
  predict = FALSE,
  start.vals = NULL,
  getStarts = FALSE,
  pxArea = 1,
  plotit = F,
  mycex = 1,
  nlmgradtol = 1e-06,
  nlmstepmax = 10,
  nlmiterlim = 200,
  smallslow = FALSE,
  print.level = 0
)

Arguments

model

A list with 4 components describing the SCR model. The model formulae desribe, in order, the density model (D~), the detection model (p0~), the sigma model (sig~) and, if required, a model for the cost surface (asu~). Cetain special characters can be used to fit inbuilt models (see Details).

scrFrame

An oSCR-specific capture history data object (see make.scrFrame).

ssDF

An oSCR-specific state space data object (see make.ssDF).

encmod

Choice of encounter model to use. Choices are binomial ("B", default), Poisson ("P"), complementary log-log ("CLOG"), or multicatch ("M") encounter model.

multicatch

Choose TRUE to fit the multinomial encounter model. NB while this will still work, it is best to use the updated enc argument: enc = "M".

theta

A non-negative power value detemining the shape of the exponential encounter model.

trimS

A non-negative value with the same distance units as traps and ssDF. Only state space pixels within trimS of individual captures are evaluated as plausible activity centers (i.e., performs local evaluation). Speeds up computation but should be >3 \times mmdm and wise to check sensitivity to trimS values.

DorN

Specify whether to fit the Poisson (D) or binomial (N) density model.

sexmod

Option to sex ratio as a single parameter fixed across sessions (constant), or allow session-specific sex ratio session.

costDF

An oSCR-specific cost surface data object.

distmet

The metric to use to measure pairwise distances. Options are euc, which is standard Euclidean distance, or ecol, which is the Ecological distance model of Royle et al. 2013 used to compute least cost paths.

directions

Number of directions used in costDistance.

PROJ

A projection string specifying the coordinate reference system for use in the costDistance function.

rsfDF

An oSCR-specific resource selection function data object. This can be the same object used for the ssDF. When specified while making the scrFrame object (see make.scrFrame), trapCovs are generated for spatial attributes in the rsfDF that are not already listed as trapCovs. Provides covariates for 3rd order resource selection.

RSF

If TRUE then telemetry data are used to fit a resource selection function when an rsfDF is provided and the telemetry option is ind or dep.

telemetry.type

Choice of telemetry integration, either none [default], ind, or dep. The latter 2 options specify whether the individuals in the telemetry and capture data sets are independent or dependent (i.e., same individuals in both). When dep is specified, the telemetry.type object in the scrFrame must contain a cap.tel object (see make.scrFrame) indicating where (i.e., row #) telemetred individuals appear in the capture history.

se

If TRUE standard errors are computed. If FALSE, standard errors or not computed, but fitting is faster.

predict

If TRUE a model is not fit and instead, the function returns estimated population size, and data objects necessary to create a map of realized density and posterior distributions of activity centers.

start.vals

A vector of starting values in the order they appear in the model. Can provide a named vector to supply values only for specific parameters.

getStarts

If TRUE, the function returns a list with two objects to help define starting values: a names objects, and a corresponding vector of default starting values.

pxArea

Not used yet.

plotit

Not used yet.

mycex

Not used.

nlmgradtol

The gradtol value passed to nlm.

nlmstepmax

The stepmax value passed to nlm.

nlmiterlim

The iterlim value passed to nlm.

smallslow

Not used yet.

print.level

The print.level value passed to nlm.

Examples

#Load the 'beardata'
library("oSCR")
data(beardata)
tdf<- cbind(1:38, beardata$trapmat, matrix(1, nrow=38, ncol=8))
edf<- beardata$edf
edf[,1]<- 1
data<- data2oscr(edf, sess.col = 1, id.col = 2, occ.col = 3, trap.col = 4, 
                 sex.col = NULL, tdf = list(tdf), K = c(8), ntraps = c(38),
                 remove.zeros = TRUE, remove.extracaps = TRUE, sex.nacode = NULL, 
                 tdf.sep = "/")
scrFrame  <- make.scrFrame(caphist=data$y3d, traps=data$traplocs, trapCovs=NULL ,
                           trapOperation=data$trapopp)
sf <- data$scrFrame
ssDF <- make.ssDF(sf, buffer=3, res = 0.5)

#fit the NULL model: 
m0 <- oSCR.fit(Model=list(D~1,p0~1,sig~1), scrFrame=sf, ssDF=ssDF)

jaroyle/oSCR documentation built on Sept. 23, 2023, 12:46 p.m.