fitMRME function

Fit a Moving-Resting Model with Measurement Error

Fit a Moving-Resting Model with Measurement Error

'fitMRME' fits a Moving-Resting Model with Measurement Error. The measurement error is modeled by Guassian noise. Using segment to fit part of observations to the model. A practical application of this feature is seasonal analysis.

fitMRME( data, start, segment = NULL, lower = c(1e-06, 1e-06, 1e-06, 1e-06), upper = c(10, 10, 10, 10), print_level = 3, integrControl = integr.control() ) fitMRME_naive( data, start, segment = NULL, lower = c(1e-06, 1e-06, 1e-06, 1e-06), upper = c(10, 10, 10, 10), integrControl = integr.control() ) fitMRMEapprox( data, start, segment = NULL, approx_norm_even = approxNormalOrder(5), approx_norm_odd = approxNormalOrder(6), method = "Nelder-Mead", optim.control = list(), integrControl = integr.control() )

Arguments

  • data: a data.frame whose first column is the observation time, and other columns are location coordinates. If segment is not NULL, additional column with the same name given by segment should be included. This additional column is used to indicate which part of observations shoule be used to fit model. The value of this column can be any integer with 0 means discarding this observation and non-0 means using this obversvation. Using different non-zero numbers indicate different segments. (See vignette for more details.)

  • start: starting value of the model, a vector of four components in the order of rate for moving, rate for resting, volatility, and s.d. of Guassian measurement error.

  • segment: character variable, name of the column which indicates segments, in the given data.frame. The default value, NULL, means using whole dataset to fit the model.

  • lower, upper: Lower and upper bound for optimization.

  • print_level: print_level passed to nloptr::nloptr. Possible values: 0 (default): no output; 1: show iteration number and value of objective function; 2: 1 + show value of (in)equalities; 3: 2 + show value of controls.

  • integrControl: a list of control parameters for the integrate

    function: rel.tol, abs.tol, subdivision.

  • approx_norm_even, approx_norm_odd: numeric matrixes specify the discrete distributions used to approximate standard normal distribution. The first column is support of discrete distribution and the second column is probability mass function. approx_norm_even is used to approximate even step error and approx_norm_odd is used to approximate odd step error. We mention that the supports of these two discrete distributions should not have any common elements.

  • method: the method argument to feed optim.

  • optim.control: a list of control to be passed to optim.

Returns

a list of the following components: - estimate: the esimated parameter vector

  • loglik: maximized loglikelihood or composite loglikelihood evaluated at the estimate

  • convergence: convergence code from optim

  • data: fitted data

Examples

## time consuming example #tgrid <- seq(0, 10*100, length=100) #set.seed(123) #dat <- rMRME(tgrid, 1, 0.5, 1, 0.01, "m") ## fit whole dataset to the MRME model #fit <- fitMRME(dat, start=c(1, 0.5, 1, 0.01)) #fit ## fit whole dataset to the MRME model with naive composite likelihood #fit.naive <- fitMRME_naive(dat, start=c(1, 0.5, 1, 0.01)) #fit.naive ## fit whole dataset to the MRME model with approximate error #fit.approx <- fitMRMEapprox(dat, start=c(1, 0.5, 1, 0.01)) #fit.approx ## fit part of dataset to the MR model #batch <- c(rep(0, 5), rep(1, 17), rep(0, 4), rep(2, 30), rep(0, 4), rep(3, 40)) #dat.segment <- cbind(dat, batch) #fit.segment <- fitMRME(dat.segment, start = c(1, 0.5, 1, 0.01), segment = "batch") #fit.segment.approx <- fitMRMEapprox(dat.segment, start = c(1, 0.5, 1, 0.01), segment = "batch") #head(dat.segment) #fit.segment

References

Hu, C., Elbroch, L.M., Meyer, T., Pozdnyakov, V. and Yan, J. (2021), Moving-resting process with measurement error in animal movement modeling. Methods in Ecology and Evolution. doi:10.1111/2041-210X.13694

Author(s)

Chaoran Hu

  • Maintainer: Chaoran Hu
  • License: GPL (>= 3.0)
  • Last published: 2024-01-10