Fit the fARMA(p,q) model.

farma_fit(
  Xt,
  dt,
  order,
  drift = c("linear", "none", "quadratic"),
  vcov = TRUE,
  ad_only = TRUE
)

Arguments

Xt

Matrix of trajectory positions, where each row is an observation and each column is a measurement coordinate. The trajectory is assumed to be sampled at a constant frequency.

dt

Interobservation time \(\Delta t\) = 1/fps (positive scalar).

order

A specification of the farma model: the two integer components (p, q) are the AR order and the MA order.

drift

Character string specifying one of the preset drift types "linear", "none", or "quadratic". Custom drift functions are not supported through this simplified interface. See csi_model for details.

vcov

Logical; if TRUE, also estimate the variance matrix.

ad_only

Whether to return estimates of (alpha, log(D)) only, or the entire parameter vector omega in the computational basis.

Value

A vector of estimated parameters on the transformed scale. If vcov == TRUE, a list with components:

coef

A vector of estimated parameters on transformed scale.

vcov

A matrix of estimated covariance of parameters on transformed scale.

If ad_only == TRUE, instead of the transformed scale parameters, returns an estimate (and possibly the estimated convariance) of (alpha, D).

See also

farma_model, the class definition for the fARMA(p,q) model.

Examples

# simulate data from a farma(1,1) model
alpha <- .8
phi <- .1
rho <- .1

dt <- 1/60
N <- 1800
ndim <- 2

Xt <- csi_sim(drift = matrix(0, N-1, ndim),
              acf = farma_acf(alpha, phi = phi, rho = rho, dt, N-1),
              Sigma = diag(ndim),
              X0 = rep(0, ndim))


# Fit the farma(1,1) model
farma_fit(Xt, dt = dt, order = c(1,1), vcov = TRUE)
#> $coef
#>      alpha       logD 
#>  0.7431171 -0.7739260 
#> 
#> $vcov
#>             alpha        logD
#> alpha 0.004078114 0.005831055
#> logD  0.005831055 0.011943318
#>