Skip to content

Commit b1f651a

Browse files
committed
First upload of files
1 parent 1f151d5 commit b1f651a

File tree

52 files changed

+12874
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+12874
-4
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "Art of Statistics: 0-1 Age and Year of Shipman Victims"
3+
#output: md_document
4+
output: html_document
5+
---
6+
7+
***************************************************************************
8+
9+
Data are contained in [00-1-shipman-confirmed-victims-x.csv](00-1-shipman-confirmed-victims-x.csv), and taken from [Chronological List of Decided Cases in the Shipman Inquiry](https://webarchive.nationalarchives.gov.uk/20090808221518/http://www.the-shipman-inquiry.org.uk/fr_casesbyyear.asp?year=74&from=r).
10+
11+
```{r 0-1 Scatter and bars, fig.height=6, fig.width=6, fig.align='left'}
12+
13+
library(magrittr)
14+
library(ggplot2)
15+
library(ggpubr)
16+
library(ggExtra)
17+
18+
# read data to dataframe
19+
df<-read.csv("00-1-shipman-confirmed-victims-x.csv",header=TRUE)
20+
21+
# scatter-plot
22+
s <- ggplot(df, aes(x=fractionalDeathYear, y=Age, colour=reorder(gender2,gender))) # initialise plot for the scatter-chart
23+
s <- s + geom_point(size=1) # assign scatter chart-type with size 1 points
24+
s <- s + labs(x ="Year", y="Age of victim") # Adds axis labels
25+
s <- s + scale_x_continuous(breaks=seq(1975, 1995, 5), limits = c(1974,1998)) #x-axis labels every 5 years and between 74 and 98
26+
s <- s + scale_y_continuous(breaks=seq(40, 90, 10), limits = c(39,95)) # y-axis every 10 years and between 39 and 95
27+
#s <- s + scale_size_continuous(name = "Size", guide = FALSE) # turns off size legend
28+
s <- s + theme(legend.position=c(0.125,1.12 ), legend.background = element_rect(colour = "black"), legend.title = element_blank()) # positions. borders, and un-titles the legend
29+
30+
# with marginal histogram
31+
ggMarginal(s, type="histogram")
32+
33+
34+
35+
```
36+
37+
Figure 0.1 A scatter-plot showing the age and the year of death of Harold Shipman's 215 confirmed victims. Bar-charts have been added on the axes to reveal the pattern of ages and the pattern of years in which he committed murders.
38+

00-1-age-and-year-of-deathofharold-shipmans-victims/00-1-age-year-shipman_victims-x.html

Lines changed: 429 additions & 0 deletions
Large diffs are not rendered by default.

00-1-age-and-year-of-deathofharold-shipmans-victims/00-1-shipman-confirmed-victims-x.csv

Lines changed: 216 additions & 0 deletions
Large diffs are not rendered by default.

00-2-shipman-times/0-2-shipman-times-x.Rmd renamed to 00-2-shipman-times/00-2-shipman-times-x.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
---
66
### At what time of day did Harold Shipman's victims die?
77

8-
Data are contained in [0-2-shipman-times-x.csv](0-2-shipman-times-x.csv), and taken from [Harold Shipman's Clinical Practice 1974-1998: A Clinical Audit Commissioned by the Chief Medical Officer, by Richard Baker, page 40, Figure 5.2](https://webarchive.nationalarchives.gov.uk/20090808160000/http://www.the-shipman-inquiry.org.uk/ge_doclist.asp?ID=5), derived from the cremation forms of Shipman's victims.
8+
Data are contained in [00-2-shipman-times-x.csv](00-2-shipman-times-x.csv), and taken from [Harold Shipman's Clinical Practice 1974-1998: A Clinical Audit Commissioned by the Chief Medical Officer, by Richard Baker, page 40, Figure 5.2](https://webarchive.nationalarchives.gov.uk/20090808160000/http://www.the-shipman-inquiry.org.uk/ge_doclist.asp?ID=5), derived from the cremation forms of Shipman's victims.
99
```{r}
1010
1111
library(ggplot2)
12-
shipmantimes<-read.csv("0-2-shipman-times-x.csv", header=TRUE) # reads data into shipmantimes data frame
12+
shipmantimes<-read.csv("00-2-shipman-times-x.csv", header=TRUE) # reads data into shipmantimes data frame
1313
p <- ggplot(shipmantimes, aes(x=Hour, y)) + ylim(0,15) # constructs initial plot object, p
1414
p <- p + geom_line(aes(y = Comparison, col = "Comparison GPs"), size=1.5) # adds a y-series
1515
p <- p + geom_line(aes(y = Shipman, col = "Shipman"), size=1.5) # adds a y-series

00-2-shipman-times/0-2-shipman-times-x.html renamed to 00-2-shipman-times/00-2-shipman-times-x.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@ <h1 class="title toc-ignore">Art of Statistics: Figure 0.2, page 5.</h1>
375375

376376
<div id="at-what-time-of-day-did-harold-shipmans-victims-die" class="section level3">
377377
<h3>At what time of day did Harold Shipman’s victims die?</h3>
378-
<p>Data are contained in <a href="0-2-shipman-times-x.csv" class="uri">0-2-shipman-times-x.csv</a>, and taken from <a href="https://webarchive.nationalarchives.gov.uk/20090808160000/http://www.the-shipman-inquiry.org.uk/ge_doclist.asp?ID=5">Harold Shipman’s Clinical Practice 1974-1998: A Clinical Audit Commissioned by the Chief Medical Officer, by Richard Baker, page 40, Figure 5.2</a>, derived from the cremation forms of Shipman’s victims.</p>
378+
<p>Data are contained in <a href="00-2-shipman-times-x.csv" class="uri">00-2-shipman-times-x.csv</a>, and taken from <a href="https://webarchive.nationalarchives.gov.uk/20090808160000/http://www.the-shipman-inquiry.org.uk/ge_doclist.asp?ID=5">Harold Shipman’s Clinical Practice 1974-1998: A Clinical Audit Commissioned by the Chief Medical Officer, by Richard Baker, page 40, Figure 5.2</a>, derived from the cremation forms of Shipman’s victims.</p>
379379
<pre class="r"><code>library(ggplot2)
380-
shipmantimes&lt;-read.csv(&quot;0-2-shipman-times-x.csv&quot;, header=TRUE) # reads data into shipmantimes data frame
380+
shipmantimes&lt;-read.csv(&quot;00-2-shipman-times-x.csv&quot;, header=TRUE) # reads data into shipmantimes data frame
381381
p &lt;- ggplot(shipmantimes, aes(x=Hour, y)) + ylim(0,15) # constructs initial plot object, p
382382
p &lt;- p + geom_line(aes(y = Comparison, col = &quot;Comparison GPs&quot;), size=1.5) # adds a y-series
383383
p &lt;- p + geom_line(aes(y = Shipman, col = &quot;Shipman&quot;), size=1.5) # adds a y-series
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: "Art of Statistics: Figure 1.1 (page 26)"
3+
#output: md_document
4+
output: html_document
5+
---
6+
### Figure 1.1: Survival rates following child heart surgery in thirteen hospitals from 2012-2015
7+
8+
Data are shown in Table 1.1 (page 23) and are contained in [01-1-child-heart-survival-x.csv](01-1-child-heart-survival-x.csv). The data were originally presented in the [NCHDA 2012-15 report](https://nicor4.nicor.org.uk/chd/an_paeds.nsf/vwContent/Analysis%20Documents?Opendocument), but are best seen on [childrensheartsurgery.info](http://childrensheartsurgery.info/).
9+
10+
```{r figure 1-1}
11+
12+
library(ggplot2)
13+
14+
ThirtyDaySurv <-read.csv("01-1-child-heart-survival-x.csv", header=TRUE) # reads data into ThirtyDaySurv data frame
15+
nhosp=length(ThirtyDaySurv$Hospital)
16+
p <- ggplot(ThirtyDaySurv, aes(x=reorder(Hospital,nhosp:1), y= ThirtyDaySurvival, fill=Hospital)) # constructs initial plot object, , starting with top row
17+
p <- p + geom_bar(stat = "identity") # assigns bar chart-type
18+
p <- p + coord_flip(ylim = c(86,100)) # flips to horizontal bars and limits y-axis
19+
p <- p + scale_y_continuous(breaks=seq(86, 100, 2)) # assigns breaks every 2 percent
20+
p <- p + scale_colour_brewer(palette = "Accent") # sets the colour palette
21+
p <- p + theme(legend.position="none") # removes the legend
22+
p <- p + labs(x="", y="% surviving 30 days") # Adds y-axis label
23+
p # draws the plot
24+
25+
```
26+
27+
_Figure 1.1 Bar-chart of 30-day survival rates for thirteen hospitals. The choice of the start of the horizontal axis, here 86%, can have a crucial effect on the impression given by the graphic. If the axis starts at 0%, all the hospitals will look indistinguishable, whereas if we started at 95% the differences would look misleadingly dramatic._
28+
29+
For other ways of displaying and explaining this data, and more recent results, see [childrensheartsurgery.info](http://childrensheartsurgery.info/).
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hospital,Operations,Survivors,Deaths,ThirtyDaySurvival,PercentageDying
2+
London - Harley Street ,418,413,5,98.8,1.2
3+
Leicester,607,593,14,97.7,2.3
4+
Newcastle,668,653,15,97.8,2.2
5+
Glasgow,760,733,27,96.3,3.7
6+
Southampton,829,815,14,98.3,1.7
7+
Bristol,835,821,14,98.3,1.7
8+
Dublin,983,960,23,97.7,2.3
9+
Leeds,1038,1016,22,97.9,2.1
10+
London - Brompton,1094,1075,19,98.3,1.7
11+
Liverpool,1132,1112,20,98.2,1.8
12+
London - Evelina,1220,1185,35,97.1,2.9
13+
Birmingham,1457,1421,36,97.5,2.5
14+
London - Great Ormond Street,1892,1873,19,99,1

01-1-2-3-child-heart-survival-times/01-1-child-heart-survival-x.html

Lines changed: 425 additions & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.

0 commit comments

Comments
 (0)