Skip to content

Commit 5be831d

Browse files
committed
Minor cleaning up
1 parent 1badbc4 commit 5be831d

File tree

2 files changed

+83
-86
lines changed

2 files changed

+83
-86
lines changed

descriptive-statistics.org

Lines changed: 75 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,31 @@
66

77
* Title slide :slide:
88
#+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" "" "" ""))
1010
#+END_SRC
11-
* Day 1
12-
** Title slide
11+
* Title slide
1312
#+BEGIN_SRC emacs-lisp-slide
1413
(org-show-animate '("Why do financial journalists need to know quantitative methods?" "" "" ""))
1514
#+END_SRC
1615

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:
2827

2928
+ Frequency
3029
+ Measures of central tendency
3130
+ Summary positions
3231
+ Measures of dispersion
3332

34-
*** Frequency :slide:
33+
** Frequency :slide:
3534

3635
#+NAME: worker-code0
3736
#+begin_src R :results value :export results :colnames yes :hline
@@ -93,7 +92,7 @@
9392
| M | 7 |
9493
| F | 9 |
9594

96-
*** Measures of Central Tendency :slide:
95+
** Measures of Central Tendency :slide:
9796

9897
#+NAME: mid-code
9998
#+begin_src R :results value :export results :colnames yes :hline
@@ -118,7 +117,7 @@
118117
| M | 172428.6 | 50000 |
119118
| F | 46333.3 | 45000 |
120119

121-
*** Measures of Position :slide:
120+
** Measures of Position :slide:
122121

123122
+ First quartile
124123
+ Second quartile (median)
@@ -128,9 +127,9 @@
128127
+ Quintiles
129128
+ Percentiles
130129

131-
*** Measures of Dispersion :slide:
130+
** Measures of Dispersion :slide:
132131

133-
**** Range and other measures based on positions :slide:
132+
*** Range and other measures based on positions :slide:
134133

135134

136135
$range=max-min$
@@ -147,7 +146,7 @@ $range=max-min$
147146
range=max(salary)-min(salary))]
148147
#+end_src
149148

150-
**** Range and other measures based on positions :slide:
149+
*** Range and other measures based on positions :slide:
151150

152151
+ Distance between any two positions (Deciles, Quintiles, Percentiles) can be used as a measure of dispersion.
153152

@@ -179,7 +178,7 @@ $inter.quartile.range=Q3-Q1$
179178

180179

181180

182-
**** Variance, Standard Deviation and Coefficient of Variation
181+
*** Variance, Standard Deviation and Coefficient of Variation
183182

184183
$variance=\frac{1}{n} \times \sum(x_{i}-x)^{2}$
185184

@@ -214,59 +213,59 @@ $cov=\frac{standard.deviation}{mean}$
214213
| F | 54500000 | 7382.4 | 0.16 |
215214

216215

217-
** Graphical Displays of Quantitative Information: Common Pitfalls
216+
* Graphical Displays of Quantitative Information: Common Pitfalls
218217

219-
*** Common uses of statistical graphics :slide:
218+
** Common uses of statistical graphics :slide:
220219
+ To show trends over time
221220
+ To show mid-point variations across categories
222221
+ To show composition
223222
+ (less commonly, though more usefully) to show/analyse dispersion
224223

225-
*** Mis-representation :slide:
224+
** Mis-representation :slide:
226225

227226
#+CAPTION: "and sometimes the fact that numbers have a magnitude as well as an order is simply forgotten"
228227
[[file:graphics/tufte-insanity.png]]
229228

230-
*** Mis-representation :slide:
229+
** Mis-representation :slide:
231230

232231
#+CAPTION: Another example borrowed from Tufte
233232
[[file:graphics/tufte-fuel.png]]
234233

235-
*** Mis-representation :slide:
234+
** Mis-representation :slide:
236235

237236
#+CAPTION: Tufte's graph on fuel economy of cars
238237
#+attr_html: :width 400px
239238
[[file:graphics/tufte-fuel2.png]]
240239

241-
*** Mis-representation :slide:
240+
** Mis-representation :slide:
242241

243242
#+CAPTION: Nobel prizes awarded in science (National Science Foundation, 1974)
244243
#+attr_html: :width 300px
245244
[[file:graphics/nobel-wrong.png]]
246245

247-
*** Mis-representation :slide:
246+
** Mis-representation :slide:
248247

249248
#+CAPTION: Nobel prizes awarded in science (corrected by Tufte)
250249
#+attr_html: :width 300px
251250
[[file:graphics/nobel-right.png]]
252251

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:
254253

255254
[[file:graphics/piketty1_o.png]]
256255

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:
258257

259258
[[file:graphics/piketty1_c.png]]
260259

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:
262261

263262
[[file:graphics/piketty2_o.png]]
264263

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:
266265

267266
[[file:graphics/piketty2_c.png]]
268267

269-
*** The problem multiplied with the coming in of spreadsheets :slide:
268+
** The problem multiplied with the coming in of spreadsheets :slide:
270269

271270
#+ATTR_html: :width 300px
272271
[[file:graphics/chart1.png]]
@@ -277,8 +276,8 @@ $cov=\frac{standard.deviation}{mean}$
277276
#+ATTR_html: :width 300px
278277
[[file:graphics/chart3.png]]
279278

280-
** Graphical Displays of Quantitative Information: Dispersion :slide:
281-
*** Histogram :slide:
279+
* Graphical Displays of Quantitative Information: Dispersion :slide:
280+
** Histogram :slide:
282281

283282
#+RESULTS: ccpc-wheat-hist1
284283
#+attr_html: :width 800px
@@ -292,7 +291,7 @@ $cov=\frac{standard.deviation}{mean}$
292291
hist(b$yield,main="Histogram of wheat yields",ylim=c(0,4000))
293292
#+END_SRC
294293

295-
*** Histogram with relative densities :slide:
294+
** Histogram with relative densities :slide:
296295

297296
#+RESULTS: ccpc-wheat-hist2
298297
#+attr_html: :width 600px
@@ -306,13 +305,13 @@ $cov=\frac{standard.deviation}{mean}$
306305
hist(b$yield,freq=F,main="Histogram of wheat yields",ylim=c(0,0.00040))
307306
#+END_SRC
308307

309-
*** Boxplot :slide:
308+
** Boxplot :slide:
310309

311310
+ Invented by John Tukey in 1970
312311
+ Many variations proposed since then, though the essential form and idea as remained intact.
313312

314313

315-
*** Boxplot of wheat yields :slide:
314+
** Boxplot of wheat yields :slide:
316315

317316
#+RESULTS: ccpc-wheat-box1
318317
[[file:boxplotyield1.png]]
@@ -325,7 +324,7 @@ $cov=\frac{standard.deviation}{mean}$
325324
boxplot(b$yield,main="Boxplot of wheat yields")
326325
#+END_SRC
327326

328-
*** Violin plots :slide:
327+
** Violin plots :slide:
329328

330329
#+RESULTS: ccpc-wheat-vio1
331330
[[file:vioplotyield1.png]]
@@ -342,7 +341,7 @@ $cov=\frac{standard.deviation}{mean}$
342341

343342

344343

345-
*** Boxplots: Useful to identify extreme values :slide:
344+
** Boxplots: Useful to identify extreme values :slide:
346345

347346

348347
#+RESULTS: ccpc-wheat-box2
@@ -355,7 +354,7 @@ $cov=\frac{standard.deviation}{mean}$
355354
boxplot(b$yield,main="Magnified tail of the boxplot",ylim=c(7000,25000))
356355
#+END_SRC
357356

358-
*** Boxplots: Useful for comparisons across categories :slide:
357+
** Boxplots: Useful for comparisons across categories :slide:
359358

360359
#+RESULTS: ccpc-crop-box3
361360
[[file:boxplotyield3.png]]
@@ -369,7 +368,7 @@ $cov=\frac{standard.deviation}{mean}$
369368
boxplot(yield~Crop_code,data=b,main="Boxplots of yields of various crops",las=3,ylim=c(0,8000),outline=F)
370369
#+END_SRC
371370

372-
*** Violin plots :slide:
371+
** Violin plots :slide:
373372

374373
#+RESULTS: ccpc-crop-vio
375374
[[file:vioplotyield3.png]]
@@ -389,3 +388,37 @@ $cov=\frac{standard.deviation}{mean}$
389388

390389

391390

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+

statistical-inference.org

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,12 @@
55

66
* Title slide :slide:
77
#+BEGIN_SRC emacs-lisp-slide
8-
(org-show-animate '("Quantitative Methods, Part-II" "Vikas Rawal" "Prachi Bansal" "" "" ""))
8+
(org-show-animate '("Quantitative Methods, Part-II" "Introduction to Statistical Inference" "Vikas Rawal" "Prachi Bansal" "" "" ""))
99
#+END_SRC
10-
* Day 2
1110

12-
** Paul Krugman on Fiscal Austerity
11+
* Sampling Distributions
1312

14-
*** What does this graph show? :slide:
15-
16-
#+attr_html: :width 1200px
17-
[[file:krugman1.png]]
18-
Source: [[https://www.nytimes.com/2018/11/02/opinion/the-perversion-of-fiscal-policy-slightly-wonkish.html]]
19-
20-
21-
*** What did Paul Krugman say? :slide:
22-
23-
"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.
24-
25-
*** How could we better show the relationship between unemployment and fiscal austerity :slide:
26-
27-
#+name: fixed-krugman-graph
28-
#+attr_html: :width 1200px
29-
[[file:krugman2.png]]
30-
31-
#+NAME: graph2
32-
#+BEGIN_SRC R :results output graphics :exports results :file krugman2.png :width 2000 :height 2000 :res 300
33-
library(data.table)
34-
library(ggplot2)
35-
fread("~/ssercloud/acj2018/krugmandata.csv")->a
36-
as.Date(a$date,format=c("%m/%d/%y"))->a$date
37-
factor(ifelse(a$date<"2010-01-01","2000-2009","2010-2018"))->a$Period
38-
melt(a,id=c("date","Period"),m=c("impact","unemployment"))->t
39-
levels(t$variable)<-c("Fiscal stimulus","Unemployment rate")
40-
ggplot(t,aes(x=date,y=value,group=variable,colour=Period))->p
41-
p+geom_line(size=1.2)+facet_wrap(~variable,scales="free_y",ncol=1)->p
42-
p+scale_y_continuous("Per cent")+theme(legend.position="bottom")->p
43-
p+scale_x_date("Year/Month",date_labels = "%Y")
44-
#+END_SRC
45-
46-
47-
** Sampling Distributions
48-
49-
*** Sampling Distributions :slide:
13+
** Sampling Distributions :slide:
5014

5115
#+RESULTS: sampling2
5216
[[file:bsample2.png]]
@@ -144,7 +108,7 @@ Source: [[https://www.nytimes.com/2018/11/02/opinion/the-perversion-of-fiscal-po
144108
p
145109
#+end_src
146110

147-
*** Sampling Distributions :slide:
111+
** Sampling Distributions :slide:
148112

149113
+ $Standard.error = \frac{\sigma}{\sqrt{mean}}$
150114

@@ -160,8 +124,8 @@ Source: [[https://www.nytimes.com/2018/11/02/opinion/the-perversion-of-fiscal-po
160124

161125

162126

163-
** Introduction to Hypothesis Testing
164-
*** Transforming the Distribution to Standard Normal :slide:
127+
* Introduction to Hypothesis Testing
128+
** Transforming the Distribution to Standard Normal :slide:
165129

166130
#+RESULTS: sampling3
167131
[[file:bsample3.png]]
@@ -240,7 +204,7 @@ Source: [[https://www.nytimes.com/2018/11/02/opinion/the-perversion-of-fiscal-po
240204
#+end_src
241205

242206

243-
*** Distribution of sample mean with unknown population variance :slide:
207+
** Distribution of sample mean with unknown population variance :slide:
244208

245209
#+RESULTS: sampling5
246210
[[file:bsample5.png]]
@@ -314,7 +278,7 @@ Source: [[https://www.nytimes.com/2018/11/02/opinion/the-perversion-of-fiscal-po
314278
#+end_src
315279

316280

317-
*** Introduction to the t distribution :ignore:
281+
** Introduction to the t distribution :ignore:
318282

319283
#+RESULTS: sampling4
320284
[[file:bsample4.png]]

0 commit comments

Comments
 (0)