Learn R Programming

crawl (version 2.3.0)

crwPredict: Predict animal locations and velocities using a fitted CTCRW model and calculate measurement error fit statistics

Description

The crwMEfilter function uses a fitted model object from crwMLE to predict animal locations (with estimated uncertainty) at times in the original data set and supplemented by times in predTime. If speedEst is set to TRUE, then animal log-speed is also estimated. In addition, the measurement error shock detection filter of de Jong and Penzer (1998) is also calculated to provide a measure for outlier detection.

Usage

crwPredict(object.crwFit, predTime = NULL, return.type = "minimal", ...)

Value

There are three possible return types specified with return.type:

minimal

a data.frame with a minimal set of columns: date_time,mu.x,mu.y,se.mu.x,se.mu.y

flat

a data set is returned with the columns of the original data plus the state estimates, standard errors (se), and speed estimates

list

List with the following elements:

originalData

A data.frame with data merged with predTime.

alpha.hat

Predicted state

Var.hat

array where Var.hat[,,i] is the prediction covariance matrix for alpha.hat[,i].

Arguments

object.crwFit

A model object from crwMLE.

predTime

vector of desired prediction times (numeric or POSIXct). Alternatively, a character vector specifying a time interval (see Details).

return.type

character. Should be one of "minimal","flat","list" (see Details).

...

Additional arguments for testing new features

Author

Devin S. Johnson

Details

The requirements for data are the same as those for fitting the model in crwMLE.

  • ("predTime") predTime can be either passed as a separate vector of POSIXct or numeric values for all prediction times expected in the returned object. Note, previous versions of crwPredict would return both times specified via predTime as well as each original observed time. This is no longer the default (see return.type). If the original data were provided as a POSIXct type, then crwPredict can derive a sequence of regularly spaced prediction times from the original data. This is specified by providing a character string that corresponds to the by argument of the seq.POSIXt function (e.g. '1 hour', '30 mins'). crwPredict will round the first observed time up to the nearest unit (e.g. '1 hour' will round up to the nearest hour, '30 mins' will round up to the nearest minute) and start the sequence from there. The last observation time is truncated down to the nearest unit to specify the end time.

References

de Jong, P. and Penzer, J. (1998) Diagnosing shocks in time series. Journal of the American Statistical Association 93:796-806.