crwMLE {crawl}R Documentation

Fit Continuous-Time Correlated Random Walk Models to Animal Telemetry Data

Description

The function uses the Kalman filter to estimate movement parameters in a state-space version of the continuous-time movement model. Separate models are specified for movement portion and the location error portion. Each model can depend on time indexed covariates. A “haul out” model where movement is allowed to completely stop, as well as, a random drift model can be fit with this function.

Usage

crwMLE(data, ...)

## Default S3 method:
crwMLE(
  data,
  mov.model = ~1,
  err.model = NULL,
  activity = NULL,
  drift = FALSE,
  coord = c("x", "y"),
  proj = NULL,
  Time.name = "time",
  time.scale = NULL,
  theta = NULL,
  fixPar = NULL,
  method = "Nelder-Mead",
  control = NULL,
  constr = list(lower = -Inf, upper = Inf),
  prior = NULL,
  need.hess = TRUE,
  initialSANN = list(maxit = 200),
  attempts = 1,
  retrySD = 1,
  skip_check = FALSE,
  ...
)

## S3 method for class 'SpatialPoints'
crwMLE(
  data,
  mov.model = ~1,
  err.model = NULL,
  activity = NULL,
  drift = FALSE,
  Time.name = "time",
  time.scale = NULL,
  theta = NULL,
  fixPar = NULL,
  method = "Nelder-Mead",
  control = NULL,
  constr = list(lower = -Inf, upper = Inf),
  prior = NULL,
  need.hess = TRUE,
  initialSANN = list(maxit = 200),
  attempts = 1,
  retrySD = 1,
  skip_check = FALSE,
  coord = NULL,
  ...
)

## S3 method for class 'sf'
crwMLE(
  data,
  mov.model = ~1,
  err.model = NULL,
  activity = NULL,
  drift = FALSE,
  Time.name = "time",
  time.scale = NULL,
  theta = NULL,
  fixPar = NULL,
  method = "Nelder-Mead",
  control = NULL,
  constr = list(lower = -Inf, upper = Inf),
  prior = NULL,
  need.hess = TRUE,
  initialSANN = list(maxit = 200),
  attempts = 1,
  retrySD = 1,
  skip_check = FALSE,
  ...
)

Arguments

data

a data set of location observations as a data.frame, tibble, SpatialPointsDataFrame ('sp' package), or a data.frame of class 'sf' that contains a geometry column of type sfc_POINT

...

further arguments passed to or from other methods

mov.model

formula object specifying the time indexed covariates for movement parameters.

err.model

A 2-element list of formula objects specifying the time indexed covariates for location error parameters.

activity

formula object giving the covariate for the activity (i.e., stopped or fully moving) portion of the model.

drift

logical indicating whether or not to include a random drift component. For most data this is usually not necessary. See northernFurSeal for an example using a drift model.

coord

A 2-vector of character values giving the names of the "X" and "Y" coordinates in data. Ignored if data inherits class 'sf' or 'sp'.

proj

A valid epsg integer code or proj4string for data that does not inherit either 'sf' or 'sp'. A valid 'crs' list is also accepted. Otherwise, ignored.

Time.name

character indicating name of the location time column. It is strongly preferred that this column be of type POSIXct and in UTC.

time.scale

character. Scale for conversion of POSIX time to numeric for modeling. Defaults to "hours" and most users will not need to change this.

theta

starting values for parameter optimization.

fixPar

Values of parameters which are held fixed to the given value.

method

Optimization method that is passed to optim.

control

Control list which is passed to optim.

constr

Named list with elements lower and upper that are vectors the same length as theta giving the box constraints for the parameters

prior

A function returning the log-density function of the parameter prior distribution. THIS MUST BE A FUNCTION OF ONLY THE FREE PARAMETERS. Any fixed parameters should not be included.

need.hess

A logical value which decides whether or not to evaluate the Hessian for parameter standard errors

initialSANN

Control list for optim when simulated annealing is used for obtaining start values. See details

attempts

The number of times likelihood optimization will be attempted in cases where the fit does not converge or is otherwise non-valid

retrySD

optional user-provided standard deviation for adjusting starting values when attempts > 1. Default value is 1.

skip_check

Skip the likelihood optimization check and return the fitted values. Can be useful for debugging problem fits.

Details

Value

A list with the following elements:

par

Parameter maximum likelihood estimates (including fixed parameters)

estPar

MLE without fixed parameters

se

Standard error of MLE

ci

95% confidence intervals for parameters

Cmat

Parameter covariance matrix

loglik

Maximized log-likelihood value

aic

Model AIC value

coord

Coordinate names provided for fitting

fixPar

Fixed parameter values provided

convergence

Indicator of convergence (0 = converged)

message

Messages given by optim during parameter optimization

activity

Model provided for stopping variable

drift

Logical value indicating random drift model

mov.model

Model description for movement component

err.model

Model description for location error component

n.par

number of parameters

nms

parameter names

n.mov

number of movement parameters

n.errX

number or location error parameters for “longitude” error model

n.errY

number or location error parameters for “latitude” error model

stop.mf

covariate for stop indication in stopping models

polar.coord

Logical indicating coordinates are polar latitude and longitude

init

Initial values for parameter optimization

data

Original data.frame used to fit the model

lower

The lower parameter bounds

upper

The upper parameter bounds

need.hess

Logical value

runTime

Time used to fit model

Author(s)

Devin S. Johnson, Josh M. London


[Package crawl version 2.3.0 Index]