Skip to content
edzer edited this page Oct 7, 2013 · 17 revisions

Status of trajectory analysis

Oct 7, 2013

See also http://rpubs.com/edzer/

A single trip is a Track object, a set of (cohering) trips is a Tracks object, Tracks for different IDs (persons, cars, devices, individual animals) are in TracksCollection objects. Construction generates summary statistitics (length, nr of points, duration) but also segment properties (length, duration, speed, direction; TODO are acceleration, curvature)

selection on trips/tracks

What we can do:

Tr[1:2] # returns a TracksCollection, and
Tr[2] # returns a Tracks object
Tr[2][1] # selects a Track object

selects the first two IDs; what we can't do yet:

Tr[list(1:2, 2:3)] # to select the first two trips from ID1, and trip 2 and 3 from ID2.
Tr[Muenster] # select those tracks that cross (object) Muenster

For the latter, we only need the appropriate over method

over(Tr, geometry(Muenster))

to return the right indices (or indices list?).

simple manipulation of attributes

It would be convenient to manipulate attributes directly:

Tr$log_pm10 = log(Tr$pm10)

coercion:

we can now do

as(Tr, "data.frame") # convert to data.frame, trips separated by an NA record
as(Tr[1], "data.frame") # convert Tracks
as(Tr[1][1], "data.frame) # convert Track
as(Tr, "segments") # like data.frame, but record for each segment with all x0 y0 x1 y1 segments, and segment attributes

but still need:

as(Tr, "xts") # convert to time series
as(Tr, "STIDF") # convert to spatio-temporal points
as(Tr, "SpatialLines") # convert trips to SpatialLines, aggregate() would aggregate attributes
as(Tr, "SpatialPointsDataFrame") # simply "dump" as points with attributes

aggregation:

aggregate(Tr, "1 hour", mean) # compute 1-hourly mean attributes, change of geometry
aggregate(Tr, Muenster, max) # compute max of attributes, change geometry

cyclic time: diurnal pattern, weekly pattern, yearly pattern

plotting

plot(Tr)
stplot(Tr)
stplot(Tr, attr = "elevation", by = "direction")

both work, and can do sth useful, but only work for SpatialPoint geometries; if we aggregate to lines (e.g. road segments), they probably don't. TODO: all special cases, or more generic code?

Analysis

  1. interpolation: predict trajectory values e.g. at exact 1-minute or 1-hour values
  2. smoothing: predict the true location, using some error model for the GPS reading -> gives interpolation
  3. constrained smoothing: map matching
  4. sampling: random, or systematic sampling (thinning)
  5. generalization: retain a smaller number of points, loosing as little as possible information

After map matching

after map matching (matching points to road segments), do we still represent location by points, or rather by e.g. the pair (road segment ID, distance from start of this ID)

Further Analyses

  1. sparse trajectories, e.g. collected from fixed sensors (payments, traffic monitoring, etc); this requires conversion from what the sensor measures (times of passing the sensor: a marked temporal point pattern) to the path of an individual (trajectory)
  2. comparison across trajectories, (re-)identification of individuals, privacy
  3. classifying activities from movement
  4. clustering of tracks (trips), clustering of IDs (individuals)
  5. statistical models for trajectories (low-level: smoothing, high-level: identification, activity classificaiton)