Understanding individual human mobility patterns.Marta C. Gonzalez, Cesar A. Hidalgo & Albert-Laszlo Barabasi. 2009 Nature 1

# 研究发现

## 跳跃距离$\Delta r$的分布

1. 每个用户遵循一个跳跃距离的分布为公式1的列维飞行（假设A）
2. 观察到的分布所反映的是群体层面的异质性，这种异质性是由个体之间所固有的差异造成的（假设B)
3. 基于群体的异质性与个体层面的列维轨迹共存（假设C),这样公式1代表了假设A和B的卷积。

## 回转半径$r_g$的分布

MIT Human dynamics实验室开发了一个名为bandicoot的工具可以比较方便的使用。http://bandicoot.mit.edu/demo/，详细代码见github

pip install bandicoot

from collections import Counter
import math

"""
position : tuple
A tuple (lat, lon) with the latitude and longitude of the antenna,
encoded as floating point numbers.

Returns the radius of gyration, the *equivalent distance* of the mass from
the center of gravity, for all visited places. [GON2008]_

References
----------
.. [GON2008] Gonzalez, M. C., Hidalgo, C. A., & Barabasi, A. L. (2008).
Understanding individual human mobility patterns. Nature, 453(7196),
779-782.
"""
d = Counter(positions)
sum_weights = sum(d.values())
positions = list(d.keys())  # Unique positions

if len(positions) == 0:
return None

barycenter = [0, 0]
for pos, t in d.items():
barycenter[0] += pos[0] * t
barycenter[1] += pos[1] * t

barycenter[0] /= sum_weights
barycenter[1] /= sum_weights

r = 0.
for pos, t in d.items():
r += float(t) / sum_weights * \
great_circle_distance(barycenter, pos) ** 2
return math.sqrt(r)

def great_circle_distance(pt1, pt2):
"""
Return the great-circle distance in kilometers between two points,
defined by a tuple (lat, lon).
Examples
--------
>>> brussels = (50.8503, 4.3517)
>>> paris = (48.8566, 2.3522)
>>> great_circle_distance(brussels, paris)
263.9754164080347
"""
r = 6371.

a = math.sin(delta_latitude / 2) ** 2 + math.cos(latitude1) * math.cos(latitude2) * math.sin(delta_longitude / 2) ** 2
return r * 2. * math.asin(math.sqrt(a))


postions = [(42.366944, -71.083611),
(42.386722, -71.138778),
(42.3604, -71.087374),
(42.353917, -71.105),
(42.36, -71.12),
(42.375, -71.1),
(42.345, -71.09),
(42.39, -71.105),
(42.38, -71.09),
(42.304917, -71.147374),
(42.373917, -70.067374),
(42.313917, -71.037374),
(42.40944, -71.1),
(42.41, -71.073),
(42.44, -71.15),
(42.48, -71.23),
(42.35, -71.05),
(42.33, -71.11),
(42.36, -71.25),
(42.413, -71.143),
(42.373917, -71.215),
(43.37, -71.085),
(43.39, -71.11),
(42.29, -71.13),
(42.31, -71.16),
(42.313, -71.135),
(42.297, -71.155)]

radius_of_gyration(positions)


import folium, jinja2, vincent
from IPython.display import IFrame
from IPython.core.display import HTML
map_osm = folium.Map(location=center, zoom_start=8)
from folium.plugins import MarkerCluster

popups = ['{}'.format(loc) for loc in positions]


from folium import plugins


map_2 = folium.Map(location=center,
#tiles='Stamen Toner',
zoom_start=8)

for loc in positions:

folium.CircleMarker(center,
# 1 pixcel is 1 meter. /
# see https://github.com/python-visualization/folium/issues/415
color='red',
fill_color='red',

from folium import plugins



### 使用北京移动数据的计算结果

• user_100000170.dat

for user in users:
one_user = pd.read_csv('./data/' + user + '.dat')
positions = []
for point in one_user[['longtitude', 'latitude']].as_matrix():
if np.isnan(point[0]) != 1:
positions.append((point[0], point[1]))

from matplotlib.patches import Circle

xs, ys = np.array(positions).T
# transformation of X, Y
# the origin of coordinates was transformed from (116,39.6) to (0,0)
# the step size of coordinates measured by kilometers(km)
xs = (xs-116)*(111*cos(40 * pi / 180))
ys = (ys-39.6)*111
c = [(center[0]-116)*(111*cos(40 * pi / 180)), (center[1]-39.6)*111]

fig = plt.figure()
ax.scatter(xs, ys)
ax.scatter(c[0], c[1], color='red')
ax.set_title(user)
plt.savefig(user+'.png', dpi=200)


## 回转半径${r_g}$ 和时间 t的关系

We measured the time dependence of the radius of gyration for users whose gyration radius would be considered

• small ($r_g(T)$ <= 3 km),
• medium (20 < $r_g(T)$ <= 30 km) or
• large ($r_g(T)$ > 100 km)

at the end of our observation period (T = 6 months). The results indicate that the time dependence of the average radius of gyration of mobile phone users is better approximated by a logarithmic increase, not only a manifestly slower dependence than the one predicted by a power law but also one that may appear similar to a saturation process (Fig. 2a and Supplementary Fig. 4).

## $P(\Delta r \mid r_g)$ 和 $\Delta r$的关系

$\alpha \approx 1.2 \pm 0.1$ 而 F(x)是一个 不依赖于$r_g$的函数。这个F(x)函数在x<1时是幂律的$F(x) \sim x^{-a}$，x >1时急剧下降

first passage time probability, defined as the probability that a user returns to the position where he/she was first observed after t hours.

## 优先返回（Preferential Return）

• 在银行纸币测量中观察到的Levy统计数据捕获了等式(2)中所示的- 群体异质性与个体用户的运动的卷积。
• 个人显示出显着的规律性，因为他们回到几个经常访问的地方，如家庭或工作。
• 这种规律性不适用于钞票：票据总是遵循其当前所有者的轨迹; 也就是说，美元钞票弥漫（是散播开的），但人类没有。

Tags:

Categories:

Updated: