6
6
7
7
* Title slide :slide:
8
8
#+BEGIN_SRC emacs-lisp-slide
9
- (org-show-animate '("Quantitative Methods, Part-II" "Vikas Rawal" "Prachi Bansal" "" "" ""))
9
+ (org-show-animate '("Quantitative Methods, Part-II" "Descriptive Statistics" " Vikas Rawal" "Prachi Bansal" "" "" ""))
10
10
#+END_SRC
11
- * Day 1
12
- ** Title slide
11
+ * Title slide
13
12
#+BEGIN_SRC emacs-lisp-slide
14
13
(org-show-animate '("Why do financial journalists need to know quantitative methods?" "" "" ""))
15
14
#+END_SRC
16
15
17
- ** What do we aim to achieve in this course? :slide:
18
- **** Make friends with numbers
19
- **** Learn how to read numbers, how to present them, and how to write about them
20
- **** Learn how to use computers to work with numbers
21
- ** Two Types of Statistics :slide:
22
- *** Descriptive Statistics
23
- **** Use summaries of data for the entire population to describe a population
24
- **** Use summaries of sample data to describe a sample
25
- *** Inferential Statistics
26
- **** Use sample data to describe a population
27
- ** Descriptive Statistics :slide:
16
+ * What do we aim to achieve in this course? :slide:
17
+ *** Make friends with numbers
18
+ *** Learn how to read numbers, how to present them, and how to write about them
19
+ *** Learn how to use computers to work with numbers
20
+ * Two Types of Statistics :slide:
21
+ ** Descriptive Statistics
22
+ *** Use summaries of data for the entire population to describe a population
23
+ *** Use summaries of sample data to describe a sample
24
+ ** Inferential Statistics
25
+ *** Use sample data to describe a population
26
+ * Descriptive Statistics :slide:
28
27
29
28
+ Frequency
30
29
+ Measures of central tendency
31
30
+ Summary positions
32
31
+ Measures of dispersion
33
32
34
- *** Frequency :slide:
33
+ ** Frequency :slide:
35
34
36
35
#+NAME: worker-code0
37
36
#+begin_src R :results value :export results :colnames yes :hline
93
92
| M | 7 |
94
93
| F | 9 |
95
94
96
- *** Measures of Central Tendency :slide:
95
+ ** Measures of Central Tendency :slide:
97
96
98
97
#+NAME: mid-code
99
98
#+begin_src R :results value :export results :colnames yes :hline
118
117
| M | 172428.6 | 50000 |
119
118
| F | 46333.3 | 45000 |
120
119
121
- *** Measures of Position :slide:
120
+ ** Measures of Position :slide:
122
121
123
122
+ First quartile
124
123
+ Second quartile (median)
128
127
+ Quintiles
129
128
+ Percentiles
130
129
131
- *** Measures of Dispersion :slide:
130
+ ** Measures of Dispersion :slide:
132
131
133
- **** Range and other measures based on positions :slide:
132
+ *** Range and other measures based on positions :slide:
134
133
135
134
136
135
$range=max-min$
@@ -147,7 +146,7 @@ $range=max-min$
147
146
range=max(salary)-min(salary))]
148
147
#+end_src
149
148
150
- **** Range and other measures based on positions :slide:
149
+ *** Range and other measures based on positions :slide:
151
150
152
151
+ Distance between any two positions (Deciles, Quintiles, Percentiles) can be used as a measure of dispersion.
153
152
@@ -179,7 +178,7 @@ $inter.quartile.range=Q3-Q1$
179
178
180
179
181
180
182
- **** Variance, Standard Deviation and Coefficient of Variation
181
+ *** Variance, Standard Deviation and Coefficient of Variation
183
182
184
183
$variance=\frac{1}{n} \times \sum(x_{i}-x)^{2}$
185
184
@@ -214,59 +213,59 @@ $cov=\frac{standard.deviation}{mean}$
214
213
| F | 54500000 | 7382.4 | 0.16 |
215
214
216
215
217
- ** Graphical Displays of Quantitative Information: Common Pitfalls
216
+ * Graphical Displays of Quantitative Information: Common Pitfalls
218
217
219
- *** Common uses of statistical graphics :slide:
218
+ ** Common uses of statistical graphics :slide:
220
219
+ To show trends over time
221
220
+ To show mid-point variations across categories
222
221
+ To show composition
223
222
+ (less commonly, though more usefully) to show/analyse dispersion
224
223
225
- *** Mis-representation :slide:
224
+ ** Mis-representation :slide:
226
225
227
226
#+CAPTION: "and sometimes the fact that numbers have a magnitude as well as an order is simply forgotten"
228
227
[[file:graphics/tufte-insanity.png]]
229
228
230
- *** Mis-representation :slide:
229
+ ** Mis-representation :slide:
231
230
232
231
#+CAPTION: Another example borrowed from Tufte
233
232
[[file:graphics/tufte-fuel.png]]
234
233
235
- *** Mis-representation :slide:
234
+ ** Mis-representation :slide:
236
235
237
236
#+CAPTION: Tufte's graph on fuel economy of cars
238
237
#+attr_html: :width 400px
239
238
[[file:graphics/tufte-fuel2.png]]
240
239
241
- *** Mis-representation :slide:
240
+ ** Mis-representation :slide:
242
241
243
242
#+CAPTION: Nobel prizes awarded in science (National Science Foundation, 1974)
244
243
#+attr_html: :width 300px
245
244
[[file:graphics/nobel-wrong.png]]
246
245
247
- *** Mis-representation :slide:
246
+ ** Mis-representation :slide:
248
247
249
248
#+CAPTION: Nobel prizes awarded in science (corrected by Tufte)
250
249
#+attr_html: :width 300px
251
250
[[file:graphics/nobel-right.png]]
252
251
253
- *** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
252
+ ** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
254
253
255
254
[[file:graphics/piketty1_o.png]]
256
255
257
- *** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
256
+ ** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
258
257
259
258
[[file:graphics/piketty1_c.png]]
260
259
261
- *** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
260
+ ** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
262
261
263
262
[[file:graphics/piketty2_o.png]]
264
263
265
- *** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
264
+ ** Mis-representation: illustrations from Thomas Piketty's work (source Noah Wright) :slide:
266
265
267
266
[[file:graphics/piketty2_c.png]]
268
267
269
- *** The problem multiplied with the coming in of spreadsheets :slide:
268
+ ** The problem multiplied with the coming in of spreadsheets :slide:
270
269
271
270
#+ATTR_html: :width 300px
272
271
[[file:graphics/chart1.png]]
@@ -277,8 +276,8 @@ $cov=\frac{standard.deviation}{mean}$
277
276
#+ATTR_html: :width 300px
278
277
[[file:graphics/chart3.png]]
279
278
280
- ** Graphical Displays of Quantitative Information: Dispersion :slide:
281
- *** Histogram :slide:
279
+ * Graphical Displays of Quantitative Information: Dispersion :slide:
280
+ ** Histogram :slide:
282
281
283
282
#+RESULTS: ccpc-wheat-hist1
284
283
#+attr_html: :width 800px
@@ -292,7 +291,7 @@ $cov=\frac{standard.deviation}{mean}$
292
291
hist(b$yield,main="Histogram of wheat yields",ylim=c(0,4000))
293
292
#+END_SRC
294
293
295
- *** Histogram with relative densities :slide:
294
+ ** Histogram with relative densities :slide:
296
295
297
296
#+RESULTS: ccpc-wheat-hist2
298
297
#+attr_html: :width 600px
@@ -306,13 +305,13 @@ $cov=\frac{standard.deviation}{mean}$
306
305
hist(b$yield,freq=F,main="Histogram of wheat yields",ylim=c(0,0.00040))
307
306
#+END_SRC
308
307
309
- *** Boxplot :slide:
308
+ ** Boxplot :slide:
310
309
311
310
+ Invented by John Tukey in 1970
312
311
+ Many variations proposed since then, though the essential form and idea as remained intact.
313
312
314
313
315
- *** Boxplot of wheat yields :slide:
314
+ ** Boxplot of wheat yields :slide:
316
315
317
316
#+RESULTS: ccpc-wheat-box1
318
317
[[file:boxplotyield1.png]]
@@ -325,7 +324,7 @@ $cov=\frac{standard.deviation}{mean}$
325
324
boxplot(b$yield,main="Boxplot of wheat yields")
326
325
#+END_SRC
327
326
328
- *** Violin plots :slide:
327
+ ** Violin plots :slide:
329
328
330
329
#+RESULTS: ccpc-wheat-vio1
331
330
[[file:vioplotyield1.png]]
@@ -342,7 +341,7 @@ $cov=\frac{standard.deviation}{mean}$
342
341
343
342
344
343
345
- *** Boxplots: Useful to identify extreme values :slide:
344
+ ** Boxplots: Useful to identify extreme values :slide:
346
345
347
346
348
347
#+RESULTS: ccpc-wheat-box2
@@ -355,7 +354,7 @@ $cov=\frac{standard.deviation}{mean}$
355
354
boxplot(b$yield,main="Magnified tail of the boxplot",ylim=c(7000,25000))
356
355
#+END_SRC
357
356
358
- *** Boxplots: Useful for comparisons across categories :slide:
357
+ ** Boxplots: Useful for comparisons across categories :slide:
359
358
360
359
#+RESULTS: ccpc-crop-box3
361
360
[[file:boxplotyield3.png]]
@@ -369,7 +368,7 @@ $cov=\frac{standard.deviation}{mean}$
369
368
boxplot(yield~Crop_code,data=b,main="Boxplots of yields of various crops",las=3,ylim=c(0,8000),outline=F)
370
369
#+END_SRC
371
370
372
- *** Violin plots :slide:
371
+ ** Violin plots :slide:
373
372
374
373
#+RESULTS: ccpc-crop-vio
375
374
[[file:vioplotyield3.png]]
@@ -389,3 +388,37 @@ $cov=\frac{standard.deviation}{mean}$
389
388
390
389
391
390
391
+ * Paul Krugman on Fiscal Austerity
392
+
393
+ ** What does this graph show? :slide:
394
+
395
+ #+attr_html: :width 1200px
396
+ [[file:krugman1.png]]
397
+ Source: [[https://www.nytimes.com/2018/11/02/opinion/the-perversion-of-fiscal-policy-slightly-wonkish.html]]
398
+
399
+
400
+ ** What did Paul Krugman say? :slide:
401
+
402
+ "Here’s what fiscal policy should do: it should support demand when the economy is weak, and it should pull that support back when the economy is strong. As John Maynard Keynes said, “The boom, not the slump, is the right time for austerity.” And up until 2010 the U.S. more or less followed that prescription. Since then, however, fiscal policy has become perverse: first austerity despite high unemployment, now expansion despite low unemployment.
403
+
404
+ ** How could we better show the relationship between unemployment and fiscal austerity :slide:
405
+
406
+ #+name: fixed-krugman-graph
407
+ #+attr_html: :width 1200px
408
+ [[file:krugman2.png]]
409
+
410
+ #+NAME: graph2
411
+ #+BEGIN_SRC R :results output graphics :exports results :file krugman2.png :width 2000 :height 2000 :res 300
412
+ library(data.table)
413
+ library(ggplot2)
414
+ fread("~/ssercloud/acj2018/krugmandata.csv")->a
415
+ as.Date(a$date,format=c("%m/%d/%y"))->a$date
416
+ factor(ifelse(a$date<"2010-01-01","2000-2009","2010-2018"))->a$Period
417
+ melt(a,id=c("date","Period"),m=c("impact","unemployment"))->t
418
+ levels(t$variable)<-c("Fiscal stimulus","Unemployment rate")
419
+ ggplot(t,aes(x=date,y=value,group=variable,colour=Period))->p
420
+ p+geom_line(size=1.2)+facet_wrap(~variable,scales="free_y",ncol=1)->p
421
+ p+scale_y_continuous("Per cent")+theme(legend.position="bottom")->p
422
+ p+scale_x_date("Year/Month",date_labels = "%Y")
423
+ #+END_SRC
424
+
0 commit comments