The function uses the Kalman filter to estimate movement paramters 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.
crwMLE(mov.model = ~1, err.model = NULL, activity = NULL, drift = FALSE,
data, coord = c("x", "y"), Time.name, time.scale = "hours", theta, fixPar,
method = "Nelder-Mead", control = NULL, constr = list(lower = -Inf,
upper = Inf), prior = NULL, need.hess = TRUE, initialSANN = list(maxit =
200), attempts = 1, ...)
formula object specifying the time indexed covariates for movement parameters.
A 2-element list of formula objects specifying the time indexed covariates for location error parameters.
formula object giving the covariate for the activity (i.e., stopped or fully moving) portion of the model.
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.
data.frame object containg telemetry and covariate data. A
'SpatialPointsDataFrame' object from the package 'sp' or an 'sf' object
from the 'sf' package with a geometry column of type sfc_POINT
.
'spacetime' objects were previously accepted but no longer valid.
Values for coords will be taken from
the spatial data set and ignored in the arguments. Spatial data must have a
valid proj4string or epsg and must NOT be in longlat.
A 2-vector of character values giving the names of the "X" and
"Y" coordinates in data
.
character indicating name of the location time column
character. Scale for conversion of POSIX time to numeric for modeling. Defaults to "hours".
starting values for parameter optimization.
Values of parameters which are held fixed to the given value.
Optimization method that is passed to optim
.
Control list which is passed to optim
.
Named list with elements lower
and upper
that
are vectors the same length as theta giving the box constraints for the
parameters
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.
A logical value which decides whether or not to evaluate the Hessian for parameter standard errors
Control list for optim
when simulated
annealing is used for obtaining start values. See details
The number of times likelihood optimization will be attempted
Additional arguments that are ignored.
A list with the following elements:
Parameter maximum likelihood estimates (including fixed parameters)
MLE without fixed parameters
Standard error of MLE
95% confidance intervals for parameters
Parameter covariance matrix
Maximized log-likelihood value
Model AIC value
Coordinate names provided for fitting
Fixed parameter values provided
Indicator of convergence (0 = converged)
Meesages given by optim
during parameter optimization
Model provided for stopping variable
Logical value indicating random drift model
Model description for movement component
Model description for location error component
number of parameters
parameter names
number of movement parameters
number or location error parameters for "longitude" error model
number or location error parameters for "latitude" error model
covariate for stop indication in stopping models
Logical indicating coordinates are polar latitude and longitude
Initial values for parameter optimization
Original data.frame used to fit the model
The lower parameter bounds
The upper parameter bounds
Logical value
Time used to fit model
A full model specification involves 4 components: a movement model, a
stopping model, 2 location error models, and a drift indication. The
movement model (mov.model
) specifies how the movement parameters
should vary over time. This is a function of specified, time-indexed,
covariates. The movement parameters (sigma for velocity variation and beta
for velocity autocorrelation) are both modeled with a log link as par =
exp(eta), where eta is the linear predictor based on the covariates. The
err.model
specification is a list of 2 such models, one for
“longitude” and one for “latitude” (in that order) location
error. If only one location error model is given, it is used for both
coordinates (parameter values as well). If drift.model
is set to
TRUE
, then, 2 additional parameters are estimated for the drift
process, a drift variance and a beta multiplier. If polar.coord=TRUE
then the ad-hoc logitude correction factor described by Johnson et al.
(2008) (Ecology 89:1208-1215) is used to adjust the variance scale for the
longitude mdoel.
The inital.state
is a list with the following elemets (with the exact
names):
a
A vector with initial state values. It has 4 elemets (x location at time 1, x velocity at time 1, y location at time 1,
y velocity at time 1) for
non-drift models and 6 elemets for drift models (x location at time 1,
x velocity at time 1, x drift velocity at time 1, etc...).
theta
and fixPar
are vectors with the appropriate number or
parameters. theta
contains only those paraemters which are to be
estimated, while fixPar
contains all parameter values with NA
for parameters which are to be estimated.
The data set specified by data
must contain a numeric or POSIXct column which is
used as the time index for analysis. The column name is specified by the
Time.name
argument. If a POSIXct column is used it is internally converted to a
numeric vector with units of hours. If your data are not compatible with these data structures, it is better
to convert it yourself prior to analysis with crawl. Also, for stopping models, the
stopping covariate must be between 0 and 1 inclusive, with 1 representing complete stop
of the animal (no true movement, however, location error can still occur) and 0
represent unhindered movement. The coordinate location should have NA
where no
location is recorded, but there is a change in the movment covariates.
The CTCRW models can be difficult to provide good initial values for
optimization. If initialSANN
is specified then simulated annealing is
used first to obtain starting values for the specified optimaization method.
If simulated annealing is used first, then the returned init
list of
the crwFit object will be a list with the results of the simulated annealing
optimization.