Calculate the least-squares estimate of (alpha, D).

ls_fit(Xt, dt, lags, type = c("standard", "improved"), vcov = TRUE)

ls_msd_fit(
  msd,
  dt,
  lags,
  N,
  ndim,
  type = c("standard", "improved"),
  vcov = 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).

lags

Integer vector of lags to use in the fit, such that the timepoints used in the fit are tau = dt * lags.

type

Either "standard" for the usual LS estimator, or "improved" for the version of Zhang et al (2018).

vcov

If TRUE, returns an estimate of the variance matrix of (alpha, logD).

msd

Vector of empirical MSD estimates computed by msd_fit() at the values of lags.

N

Length of the particle trajectory.

ndim

Number of dimensions of the particle trajectory.

Value

If vcov = FALSE, vector of length 2 with estimates of (alpha, logD). Otherwise, a list with elements coef and vcov, where the former is the estimate and the latter is the corresponding variance estimator.

Details

ls_fit() first computes the MSD using msd_fit(Xt, dt, demean = TRUE) then passes this on to ls_msd_fit(). For finer control over the MSD or if it has been precomputed, one may interact with ls_msd_fit() directly.

Note

Uses the subdiff convention for D.

References

Zhang, K., Crizer, K.P.R., Schoenfisch, M.H., Hill, B.D., Didier, G. (2018) "Fluid heterogeneity detection based on the asymptotic distribution of the time-averaged mean squared displacement in single particle tracking experiments". Journal of Physics A: Mathematical and Theoretical, 51, pp 445601(44).