Skip to content

Commit

Permalink
First upload of files
Browse files Browse the repository at this point in the history
  • Loading branch information
dspiegel29 committed Mar 27, 2019
1 parent 1f151d5 commit b1f651a
Show file tree
Hide file tree
Showing 52 changed files with 12,874 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: "Art of Statistics: 0-1 Age and Year of Shipman Victims"
#output: md_document
output: html_document
---

***************************************************************************

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).

```{r 0-1 Scatter and bars, fig.height=6, fig.width=6, fig.align='left'}
library(magrittr)
library(ggplot2)
library(ggpubr)
library(ggExtra)
# read data to dataframe
df<-read.csv("00-1-shipman-confirmed-victims-x.csv",header=TRUE)
# scatter-plot
s <- ggplot(df, aes(x=fractionalDeathYear, y=Age, colour=reorder(gender2,gender))) # initialise plot for the scatter-chart
s <- s + geom_point(size=1) # assign scatter chart-type with size 1 points
s <- s + labs(x ="Year", y="Age of victim") # Adds axis labels
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
s <- s + scale_y_continuous(breaks=seq(40, 90, 10), limits = c(39,95)) # y-axis every 10 years and between 39 and 95
#s <- s + scale_size_continuous(name = "Size", guide = FALSE) # turns off size legend
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
# with marginal histogram
ggMarginal(s, type="histogram")
```

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.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
---
### At what time of day did Harold Shipman's victims die?

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.
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.
```{r}
library(ggplot2)
shipmantimes<-read.csv("0-2-shipman-times-x.csv", header=TRUE) # reads data into shipmantimes data frame
shipmantimes<-read.csv("00-2-shipman-times-x.csv", header=TRUE) # reads data into shipmantimes data frame
p <- ggplot(shipmantimes, aes(x=Hour, y)) + ylim(0,15) # constructs initial plot object, p
p <- p + geom_line(aes(y = Comparison, col = "Comparison GPs"), size=1.5) # adds a y-series
p <- p + geom_line(aes(y = Shipman, col = "Shipman"), size=1.5) # adds a y-series
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ <h1 class="title toc-ignore">Art of Statistics: Figure 0.2, page 5.</h1>

<div id="at-what-time-of-day-did-harold-shipmans-victims-die" class="section level3">
<h3>At what time of day did Harold Shipman’s victims die?</h3>
<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>
<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>
<pre class="r"><code>library(ggplot2)
shipmantimes&lt;-read.csv(&quot;0-2-shipman-times-x.csv&quot;, header=TRUE) # reads data into shipmantimes data frame
shipmantimes&lt;-read.csv(&quot;00-2-shipman-times-x.csv&quot;, header=TRUE) # reads data into shipmantimes data frame
p &lt;- ggplot(shipmantimes, aes(x=Hour, y)) + ylim(0,15) # constructs initial plot object, p
p &lt;- p + geom_line(aes(y = Comparison, col = &quot;Comparison GPs&quot;), size=1.5) # adds a y-series
p &lt;- p + geom_line(aes(y = Shipman, col = &quot;Shipman&quot;), size=1.5) # adds a y-series
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Art of Statistics: Figure 1.1 (page 26)"
#output: md_document
output: html_document
---
### Figure 1.1: Survival rates following child heart surgery in thirteen hospitals from 2012-2015

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/).

```{r figure 1-1}
library(ggplot2)
ThirtyDaySurv <-read.csv("01-1-child-heart-survival-x.csv", header=TRUE) # reads data into ThirtyDaySurv data frame
nhosp=length(ThirtyDaySurv$Hospital)
p <- ggplot(ThirtyDaySurv, aes(x=reorder(Hospital,nhosp:1), y= ThirtyDaySurvival, fill=Hospital)) # constructs initial plot object, , starting with top row
p <- p + geom_bar(stat = "identity") # assigns bar chart-type
p <- p + coord_flip(ylim = c(86,100)) # flips to horizontal bars and limits y-axis
p <- p + scale_y_continuous(breaks=seq(86, 100, 2)) # assigns breaks every 2 percent
p <- p + scale_colour_brewer(palette = "Accent") # sets the colour palette
p <- p + theme(legend.position="none") # removes the legend
p <- p + labs(x="", y="% surviving 30 days") # Adds y-axis label
p # draws the plot
```

_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._

For other ways of displaying and explaining this data, and more recent results, see [childrensheartsurgery.info](http://childrensheartsurgery.info/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Hospital,Operations,Survivors,Deaths,ThirtyDaySurvival,PercentageDying
London - Harley Street ,418,413,5,98.8,1.2
Leicester,607,593,14,97.7,2.3
Newcastle,668,653,15,97.8,2.2
Glasgow,760,733,27,96.3,3.7
Southampton,829,815,14,98.3,1.7
Bristol,835,821,14,98.3,1.7
Dublin,983,960,23,97.7,2.3
Leeds,1038,1016,22,97.9,2.1
London - Brompton,1094,1075,19,98.3,1.7
Liverpool,1132,1112,20,98.2,1.8
London - Evelina,1220,1185,35,97.1,2.9
Birmingham,1457,1421,36,97.5,2.5
London - Great Ormond Street,1892,1873,19,99,1
425 changes: 425 additions & 0 deletions 01-1-2-3-child-heart-survival-times/01-1-child-heart-survival-x.html

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Art of Statistics: Figure 1.3 (page 30)"
#output: md_document
output: html_document
---

### Figure 1.3: Percentage of all child heart surgery being carried out in each of thirteen hospitals

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/).


```{r figure 1-3}
library(ggplot2)
df <- read.csv("01-1-child-heart-survival-x.csv", header=TRUE) # reads csv into dataframe, df
df$Percentage = 100*df$Operations/sum(df$Operations)
df$Pos= rank(df$Percentage)
bp <- ggplot(df, aes(x=reorder(Hospital,-Pos), y=Percentage, fill=Hospital)) #sets initial plot object from the dataframe for Hospitals, reordered by Percentage (descending) as the y-values, colour-filled by Hospital
bp <- bp + geom_bar(stat = "identity") + labs(x="Hospital") # makes the plot a bar-chart
bp <- bp + coord_flip() # makes it an horizontal bar chart
bp <- bp + scale_y_continuous(breaks=seq(2,16,2)) # breaks every two-count
bp <- bp + theme(legend.position="none") # removes the legend
bp <- bp + labs(y="Percentage of all operations in 2012-15 \nthat are carried out in each hospital", x="") # Adds labels
bp # draws the plot
```

_Figure 1.3 Percentage of all operations in 2012-15 that are carried out in each hospital: a clearer representation using a horizontal bar chart._

Large diffs are not rendered by default.

Loading

0 comments on commit b1f651a

Please sign in to comment.