fitMRME {smam} | R Documentation |
Fit a Moving-Resting Model with Measurement Error
Description
'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.
Usage
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 |
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 |
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 |
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. |
method |
the method argument to feed |
optim.control |
a list of control to be passed to |
Value
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 |
data |
fitted data |
Author(s)
Chaoran Hu
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
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