## Chatfield’s Plots in S-Plus

I have recently finished reading the sixth edition of The Analysis of Time Series: An Introduction by Chatfield in our Statistics reading group. Whilst enjoying most of the book I got a little confused when looking at Appendix D: Some MINITAB and S-PLUS Commands. In the S-Plus section the author gives the code below to replicate his Figure 1.2.

```postscript(file="1.2.ps")
recife<-scan("Recife")
RecfS<-cts(recife, start=dates("01/01/1953"),units="months",frequency="12")
fst_as.numeric(date("01/01/1953"),format="dd/mm/yyyy")
mid1_as.numeric(dates("01/01/1954"),format="dd/mm/yyyy")
mid2_as.numeric(dates("01/01/1955"),format="dd/mm/yyyy")
mid3_as.numeric(dates("01/01/1956"),format="dd/mm/yyyy")
mid4_as.numeric(dates("01/01/1957"),format="dd/mm/yyyy")
mid5_as.numeric(dates("01/01/1958"),format="dd/mm/yyyy")
mid6_as.numeric(dates("01/01/1959"),format="dd/mm/yyyy")
mid7_as.numeric(dates("01/01/1960"),format="dd/mm/yyyy")
mid8_as.numeric(dates("01/01/1961"),format="dd/mm/yyyy")
lst_as.numeric(dates("01/01/1962"),format="dd/mm/yyyy")
ts.plot(RecfS,xaxt="n",ylab="Temperature (deg C)", xlab="Year", type="l")
axis(side=1, at = c(fst,mid1,mid2,mid3,mid4,mid5,mid6,mid7,mid8,lst),
labels=c("Jan 53", "Jan 54", "Jan 55", "Jan 56", "Jan 57", "Jan 58",
"Jan 59", "Jan 60", "Jan 61", "Jan 62"),
ticks=T)
dev.off()
```

I was not too sure what was going on with the code, which gave a tonne of error messages, some of which might well have been typo’s by the publisher (`_` instead of `<-`)? In addition, the author stresses the effort required to construct nice plots in S-Plus. This got me thinking that 1) his code was excessive (not just because it does not work) and 2) he could have saved a lot of his effort by using R. The R code below proves my point

```> png("...:/1.2.png", width=650, height=460, units="px")
> recife <- scan("http://people.bath.ac.uk/mascc/Recife.TS", sep="", skip=3)
> n <- length(recife)
> times <- seq(as.Date("1953/1/1"), by="month", length.out=n)
> plot(recife, xaxt="n", type= "l",ylab="Temperature (deg C)", xlab="Year")
> axis(1, at = seq(1,n,12), labels = format(times, "%b %Y")[seq(1,n,12)])
> dev.off()
```

Much Tidier! Here is the plot..

If you only wanted labels every other January, as in p.2 of the book (but not in the S-Plus code), then you can use..

```> axis(1, at = seq(1,n,24),
labels = format(times, "%b %y")[seq(1,n,24)])
```

## LaTeX Template for Ph.D. Thesis, School of Social Sciences, University of Southampton

This is a LaTeX Template based on the code used for my Thesis.tex document submitted in the School of Social Sciences, University of Southampton (April 2009). I had to develop this myself as I (and others in my Ph.D. cohort) had no contact with previous LaTeX users from the school.

This is the raw .tex file. I have cut out most of the text to leave the bones of the LaTeX commands. (Click on Kingsley Royal LaTeX icon). The entire thesis is available online, link in this post.

I tried to keep within the formatting guidelines laid out in the Completion of Research Degree Candidature book of the University of Southampton and did not receive any problems in my viva.

Feel free to use this as a template. Let me know if you add any developments and I will update the template accordingly.

## Football Predictions: Season 2012-13

Wow. Completely forgot about this, found the old spreadsheet shifting through my Google Drive this morning. Looks like Dave won by the narrowest of margins, fending of James, Rich and Amos were inseparable… and Bernie had a shocker, cricky mate! Seems like the centre of predictive power still lies in the Murry Building. Most defiantly going do a big World Cup comp. Spread the word. Love. Guy.

## Football Predictions: Season 2010-11

Season over. Results are in the table below. Congrats to Amos, the clear winner, who predicted the correct order of the Premiership 1-4. Amazing. Commiserations to Bernie.

At the top of the table are the weights given to each prediction category.

Lowest score wins, where:
*Scores for league places is calculated by multiplying the weight by the difference in the final and predicted finishing places.
*Scores for cup competitions is calculated by multiplying the weight by the number of wins away the chosen team was from winning the cup.
*Scores for Golden Boots are calculated by multiplying the weight by the number of goals the chosen player is away from the top scorers tally.

## Football Predictions: 2010 World Cup

The world cup is over, and I have updated prediction table (see final version below). Well done to Tom who correctly predicted the final. Hard luck to Dave C. who would have won if Tom was 1) patriotic (and actually supported England) and 2) did not make his golden boot prediction a week into the tournament. However, given that these predictions are based on a FIFA tournament, its logical that no action is taken against those who do not play by the rules correctly. Congratulations Tom.

Scoring system:

Lowest points total wins. Points calculated from each category as such:

Winner: 10 x No of wins away from predicted team becoming champions.
Runner: Up 7 x No of wins/losses away from predicted team becoming runner up.
Semi Final: 3 x No of wins/losses away from predicted teams loosing in Semi Finals.
Quarter Final: 1 x No of wins/losses away from predicted teams loosing in Quarter Finals.
Own Team: 7 x No of wins/losses away from own teams predicated finish.
Golden Boot: 5 x No of goals your chosen player is away from the top scorers tally.
Fair Play: -5  If you correctly predict the fair play team.

Tie breaks decided by own team predictions, then alphabetical order.

## Football Predictions: Season 2009-10

Congratulations to Dave H who correctly predicted the Premiership 1,2,3! See final standings below.

Anyone up for some World Cup predictions?

After failing to rig a scoring system that would allow me to win I settled on the following way to aggregate prediction accuracy across competitions:

*League position: Difference in prediction and final position.
*Cups: Wins away from team becoming champions, e.g. winners 0, runners up +1, losing semi-finalists +2, etc.
*Tie breaks decided by own team predictions. Lowest points total wins!