Description Usage Arguments Details Value Examples
Correlated Random Walk Filter
1 2 3 4 |
d |
a data frame of observations |
subset |
a logical vector indicating the subset of data records to be filtered |
tstep |
the time step to predict to (in days) |
nu |
degrees of freedom parameter |
gamma |
the autocorrelation parameter used to estimate initial parameters |
soth |
if TRUE states occur on the hour, starting with the hour immediately preceeding the time of the first observation; if FALSE states occur relative to the time of the first observation |
common.tau |
estimate a single error sd for both longitude and latitude |
parameters |
the TMB parameter list |
optim |
numerical optimizer |
verbose |
report progress during minimization |
amf |
ARGOS error multiplication factors |
span |
the span parameter for the loess fits used to estimate initial locations |
Fit a correlated random walk to filter a track and predict locations on a regular time step.
The input track is given as a dataframe where each row is an observed location, with columns
observation time (as GMT POSIXct),
observed longitude,
observed latitude,
location class.
The TMB parameter list can be specified directly with the
parameters
argument. Otherwise suitable parameter values
are estimated from predicted locations estimated by fitting loess
smooths to the raw observations.
The filtering model assumes the errors in longitude and latitude
are proportional to scale factors determined by the location
class. The scale factors are specified through the amf
argument. By default the function uses the same scaling factors
for location accuracy as used in the R package crawl for ARGOS data.
a list with components
|
a data.frame of predicted location states |
|
a data.frame of fitted locations |
|
model parameter summmary |
|
the input data.frame |
|
the input subset vector |
|
the prediction time step |
|
has a common tau been estimated |
|
the object returned by the optimizer |
|
the TMB object |
|
the calculated Akaike Information Criterion |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Fit DCRW model for state filtering and regularization
data(ellie)
fit <- fit_ssm(ellie, tstep = 6 / 24)
## plot predicted track over observations
plot(lat ~ lon, fit$data, pch = 3, col = "firebrick")
points(lat ~ lon, fit$predicted, pch = 19, cex = 0.5, col = "dodgerblue")
## plot residuals for longitude and latitude
layout(matrix(1:2, 2, 1))
lon.res <- fit$data$lon - fit$fitted$lon
lat.res <- fit$data$lat - fit$fitted$lat
plot(fit$data$date, lon.res, xlab = "")
abline(h = 0, lty = 2, col = "red")
plot(fit$data$date, lat.res, xlab = "date")
abline(h = 0, lty = 2, col = "red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.