estimateRACVM: Estimate RACVM parameters

View source: R/estimateRACVM.R

estimateRACVMR Documentation

Estimate RACVM parameters

Description

Estimate rotational-advectice correlated velocity movement model

Usage

estimateRACVM(
  XY,
  Z = NULL,
  T,
  track = NULL,
  model = "RACVM",
  compare.models = TRUE,
  modelset = c("UCVM", "ACVM", "RCVM", "RACVM"),
  p0 = NULL,
  spline = FALSE,
  spline.res = 0.01,
  T.spline = NULL,
  time.units = "day",
  verbose = FALSE
)

Arguments

XY

XY two-column matrix

Z

optional complex location matrix

T

times of observations

track

a possible track object (i.e. data frame with columns called X, Y and Time) to provide instead of Z and T.

model

one of UCVM, RCVM, ACVM or RACVM.

compare.models

whether to compare four models: with both rotation and advection, only rotation, only advection, or neither. The comparison provides a table with the log likelihood, number of parameters, AIC, BIC, delta AIC and delta BIC values. A limited comparison set may be useful when running the fit many times (e.g. when performing change point analysis).

modelset

which models to fit and compare (if compare.models) is TRUE)

p0

optional named list of initial parameter values in the form: c(tau, eta, omega, mu.x, mu.y).

spline

whether to implement the spline correction on the positions

spline.res

resolution of spline (see getV.spline)

T.spline

new times for spline estimation (best left as NULL)

time.units

time units of calculations (e.g. "sec", "min", "hour", "day")

verbose

whether to output verbose message. defaults to FALSE#'

Details

This group of functions estimate the parameters of a rotational and advective CVM using a one-step velocity likelihood. It is best implemented on relatively high resolution data from which one can obtain good estimates of velocity. The observations can, however, be irregularly sampled.

The parameterization is: τ - characteristic time scale, μ - advective velocity, η - random rms speed, ω - angular speed.

The fitRACVM function is an (internal) helper function.

See Also

simulateRACVM

Examples

if(interactive()){
require(smoove)
ucvm <- simulateRACVM(tau = 5, eta = 2, omega = 0, mu = 0, Tmax = 100, dt = .1)
acvm <- simulateRACVM(tau = 5, eta = 2, omega = 0, mu = 2, Tmax = 100, dt = .1)
rcvm <- simulateRACVM(tau = 5, eta = 2, omega = 2, mu = 0, Tmax = 100, dt = .1)
racvm <- simulateRACVM(tau = 5, eta = 2, omega = 2, mu = 2, Tmax = 100, dt = .1)

# estimating a model with no advection
plot_track(ucvm$Z)
with(ucvm, estimateRACVM(Z=Z, T=T, model = "UCVM", compare.models=TRUE))

# estimating a model with advection
plot_track(acvm$Z)
## compare all models
with(acvm, estimateRACVM(Z=Z, T=T, compare.models=TRUE))
with(acvm, estimateRACVM(Z=Z, T=T, model = "ACVM", compare.models=FALSE))

# estimating a model with rotation
plot_track(rcvm$Z)
## compare all models
with(rcvm, estimateRACVM(Z=Z, T=T, compare.models=TRUE))
with(rcvm, estimateRACVM(Z=Z, T=T, model = "RCVM", compare.models=FALSE))

# estimating a model with both rotation and advection
plot_track(racvm$Z)
## compare all models
with(racvm, estimateRACVM(Z=Z, T=T, compare.models=TRUE))
with(racvm, estimateRACVM(Z=Z, T=T, model = "RCVM", compare.models=FALSE))

## Using the kestrel data

data(Kestrel)
K1 <- Kestrel[3360:3450,]

# 90 data points - rotational and advective

K1$Z <- K1$X + 1i*K1$Y

par(mar = c(0,2,0,0), oma = c(4,4,2,2))
with(K1, scan_track(x=X, y=Y))

(fit1 <- with(K1, estimateRACVM(Z = X + 1i*Y, T = timestamp, 
                                spline=TRUE, compare.models=TRUE, 
                                time.units = "sec")))

# Note: the rotational + advective model was selected both by BIC and AIC

(fit1 <- with(K1, estimateRACVM(Z = X + 1i*Y, T = timestamp, 
                                spline=TRUE, model = "RACVM", 
                                time.units = "sec")))


# simulate from this fit

p.fit1 <- with(fit1$results, list(eta=eta[1],
                                tau = tau[1],
                                mu = mu.x[1] + 1i*mu.y[1],
                                omega = omega[1],
                                v0 = diff(K1$Z)[1]))

K1.sim <- with(p.fit1, simulateRACVM(eta=eta, tau=tau, mu = mu, 
                                     omega=omega, Tmax = nrow(K1), v0 = v0, dt = 1))
with(K1.sim, scan_track(z=Z))


# Analyze a second portion: 

K2 <- Kestrel[3470:3590,]
K2$Z <- K2$X + 1i*K2$Y
par(mar = c(0,2,0,0), oma = c(4,4,2,2))
with(K2, scan_track(x=X, y=Y))

with(K2, estimateRACVM(Z = X + 1i*Y, T = timestamp, spline=TRUE, 
                       compare.models=TRUE, time.units = "sec"))
# Note: Here, the advective model is selected by AIC, and the simple CVM by BIC.  

}

EliGurarie/smoove documentation built on Aug. 2, 2022, 10:26 p.m.