quickfit {marcher} | R Documentation |
Quick fit of one-step migration
Description
Using k-means clustering to get quick fits of 2 or 3 cluster centers in X-Y coordinates.
Usage
quickfit(T, X, Y, dt = 1, n.clust = 2, plotme = TRUE)
Arguments
T |
time |
X |
x coordinate of movement |
Y |
y coordinate of movement |
dt |
duration of migration (arbitrarily = 1) |
n.clust |
number of clusters (2 or 3) |
plotme |
whether or not to plot the result |
Details
This function does estimates the locations and times of migration, but not the duration (dt). It is most useful for obtaining a "null" estimate for seeding the likelihood estimation.
Value
a named vector of initial estimates:
if
n.clust = 2
returnst1, dt, x1, y1, x2, y2
if
n.clust = 3
returnst1, dt1, t2, dt2, x1, y1, x2, y2, x3, y3
Examples
require(marcher)
## Load simulated data
data(SimulatedTracks)
# plot the MOU simulation
scan_track(MOU.sim)
# quick fit - setting dt = 10
(pm.0 <- with(MOU.sim, quickfit(T, X, Y, dt = 10)))
# interactive locator process
if(interactive()){
(with(MOU.sim, locate_shift(T, X, Y)))
}
# fit the model
fit <- with(MOU.sim, estimate_shift(T, X, Y))
## Three cluster example
# plot the three range shift simulation
scan_track(MOU.3range)
# quick fit
## (note - this may not always work!)
with(MOU.3range, quickfit(T, X, Y, dt = 10, n.clust = 3))
if(interactive()){
with(MOU.3range, locate_shift(T, X, Y, n.clust = 3))
}
[Package marcher version 0.0-2 Index]