@@ -182,6 +182,7 @@ The code below produces the desired plot using Yahoo financial data via the `yfi
182
182
183
183
``` {code-cell} ipython3
184
184
:tags: [hide-output]
185
+
185
186
data = yf.download('AMZN', '2015-1-1', '2022-7-1')
186
187
```
187
188
@@ -213,6 +214,7 @@ We get a similar picture if we look at other assets, such as Bitcoin
213
214
214
215
``` {code-cell} ipython3
215
216
:tags: [hide-output]
217
+
216
218
data = yf.download('BTC-USD', '2015-1-1', '2022-7-1')
217
219
```
218
220
@@ -254,7 +256,7 @@ ax.hist(r, bins=60, alpha=0.4, label='bitcoin returns', density=True)
254
256
xmin, xmax = plt.xlim()
255
257
x = np.linspace(xmin, xmax, 100)
256
258
p = norm.pdf(x, np.mean(r), np.std(r))
257
- ax.plot(x, p, 'k', linewidth=2, label='normal distribution')
259
+ ax.plot(x, p, linewidth=2, label='normal distribution')
258
260
259
261
ax.set_xlabel('returns', fontsize=12)
260
262
ax.legend()
@@ -768,12 +770,12 @@ Here is a plot of the firm size distribution for the largest 500 firms in 2020 t
768
770
769
771
``` {code-cell} ipython3
770
772
---
771
- tags: [hide-input]
772
773
mystnb:
773
774
figure:
774
775
caption: Firm size distribution
775
776
name: firm-size-dist
776
- ---
777
+ tags: [hide-input]
778
+ ---
777
779
778
780
df_fs = pd.read_csv('https://media.githubusercontent.com/media/QuantEcon/high_dim_data/main/cross_section/forbes-global2000.csv')
779
781
df_fs = df_fs[['Country', 'Sales', 'Profits', 'Assets', 'Market Value']]
@@ -795,12 +797,12 @@ The size is measured by population.
795
797
796
798
``` {code-cell} ipython3
797
799
---
798
- tags: [hide-input]
799
800
mystnb:
800
801
figure:
801
802
caption: City size distribution
802
803
name: city-size-dist
803
- ---
804
+ tags: [hide-input]
805
+ ---
804
806
805
807
# import population data of cities in 2023 United States and 2023 Brazil from world population review
806
808
df_cs_us = pd.read_csv('https://media.githubusercontent.com/media/QuantEcon/high_dim_data/main/cross_section/cities_us.csv')
@@ -822,12 +824,12 @@ The data is from the Forbes Billionaires list in 2020.
822
824
823
825
``` {code-cell} ipython3
824
826
---
825
- tags: [hide-input]
826
827
mystnb:
827
828
figure:
828
829
caption: Wealth distribution (Forbes Billionaires in 2020)
829
830
name: wealth-dist
830
- ---
831
+ tags: [hide-input]
832
+ ---
831
833
832
834
df_w = pd.read_csv('https://media.githubusercontent.com/media/QuantEcon/high_dim_data/main/cross_section/forbes-billionaires.csv')
833
835
df_w = df_w[['country', 'realTimeWorth', 'realTimeRank']].dropna()
@@ -878,12 +880,12 @@ df_gdp1.dropna(inplace=True)
878
880
879
881
``` {code-cell} ipython3
880
882
---
881
- tags: [hide-input]
882
883
mystnb:
883
884
figure:
884
885
caption: GDP per capita distribution
885
886
name: gdppc-dist
886
- ---
887
+ tags: [hide-input]
888
+ ---
887
889
888
890
fig, axes = plt.subplots(1, 2, figsize=(8.8, 3.6))
889
891
@@ -934,7 +936,7 @@ mystnb:
934
936
figure:
935
937
caption: LLN failure
936
938
name: fail-lln
937
- ---
939
+ ---
938
940
from scipy.stats import cauchy
939
941
940
942
np.random.seed(1234)
0 commit comments