Description Usage Arguments Details Value Examples
Using k-means clustering to get quick fits of 2 or 3 cluster centers in X-Y coordinates.
1 |
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 |
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.
a named vector of initial estimates:
if n.clust = 2
returns t1, dt, x1, y1, x2, y2
if n.clust = 3
returns t1, dt1, t2, dt2, x1, y1, x2, y2, x3, y3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.