Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPD: rank_size usage in respective lectures #231

Merged
merged 2 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions source/rst/heavy_tails.rst
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ Exercise 4

Replicate the rank-size plot figure :ref:`presented above <rank_size_fig1>`.

If you like you can use the function ``qe.rank_size_plot`` from the ``quantecon`` library to generate the plots.
If you like you can use the function ``qe.rank_size`` from the ``quantecon`` library to generate the plots.

Use ``np.random.seed(13)`` to set the seed.

Expand Down Expand Up @@ -597,7 +597,12 @@ Now we plot the data:

for data, label, ax in zip(data_list, labels, axes):

qe.rank_size_plot(data, ax, label=label)
rank_data, size_data = qe.rank_size(data)

ax.loglog(rank_data, size_data, 'o', markersize=3.0, alpha=0.5, label=label)
ax.set_xlabel("log rank")
ax.set_ylabel("log size")

ax.legend()

fig.subplots_adjust(hspace=0.4)
Expand Down
7 changes: 5 additions & 2 deletions source/rst/kesten_processes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,11 @@ Now we produce the rank-size plot:

fig, ax = plt.subplots()

qe.rank_size_plot(data, ax, c=0.01)

rank_data, size_data = qe.rank_size(data, c=0.01)
ax.loglog(rank_data, size_data, 'o', markersize=3.0, alpha=0.5)
ax.set_xlabel("log rank")
ax.set_ylabel("log size")

plt.show()

The plot produces a straight line, consistent with a Pareto tail.
Expand Down
9 changes: 6 additions & 3 deletions source/rst/wealth_dynamics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ At the same time, given the similarities, perhaps Pareto tails will arise.
To test this, run a simulation that generates a cross-section of wealth and
generate a rank-size plot.

If you like, you can use the function ``rank_size_plot`` from the ``quantecon`` library (documentation `here <https://quanteconpy.readthedocs.io/en/latest/tools/inequality.html#quantecon.inequality.rank_size_plot>`__).
If you like, you can use the function ``rank_size`` from the ``quantecon`` library (documentation `here <https://quanteconpy.readthedocs.io/en/latest/tools/inequality.html#quantecon.inequality.rank_size>`__).

In viewing the plot, remember that Pareto tails generate a straight line. Is
this what you see?
Expand Down Expand Up @@ -645,6 +645,9 @@ Now let's see the rank-size plot:

fig, ax = plt.subplots()

qe.rank_size_plot(ψ_star, ax, c=0.001)

rank_data, size_data = qe.rank_size(ψ_star, c=0.001)
ax.loglog(rank_data, size_data, 'o', markersize=3.0, alpha=0.5)
ax.set_xlabel("log rank")
ax.set_ylabel("log size")

plt.show()