Two-way Analysis of Variance (ANOVA)

February 15th, 2010

The analysis of variance (ANOVA) model can be extended from making a comparison between multiple groups to take into account additional factors in an experiment. The simplest extension is from one-way to two-way ANOVA where a second factor is included in the model as well as a potential interaction between the two factors. Read the rest of this entry »

One-way Analysis of Variance (ANOVA)

February 3rd, 2010

Analysis of Variance (ANOVA) is a commonly used statistical technique for investigating data by comparing the means of subsets of the data. The base case is the one-way ANOVA which is an extension of two-sample t test for independent groups covering situations where there are more than two groups being compared. Read the rest of this entry »

The Grammar of Graphics: ggplot2 package

December 14th, 2009

The grammar of graphics approach to constructing graphs has been implemented in the ggplot2 package in R. The author of the package, Hadley Wickham, has provided a website with many details of using the system to create nice looking graphics. Read the rest of this entry »

Summarising data using bar charts

December 12th, 2009

A bar graph is a frequently used type of display that compares counts, frequencies, totals or other summary measures for a series of categories, e.g. sales in different market sectors or in quarters in a financial year. The bar graph can be laid out with the categories either on the vertical or horizontal axis of the display – depending on whether we consider making a vertical or horizontal comparison is easier for interpreting the graph. Read the rest of this entry »

Graph Examples from Visualizing Data by William Cleveland

November 12th, 2009

The trellis graphics approach was pioneered by various statistical researchers and the ideas are used extensively in the book “Visualizing Data” by William Cleveland. There are various resources on the website for trellis graphics including S code for creating the majority of the graphs that appear in the book. Inspired by efforts on the Learning R blog to recreate the examples from Deepayan Sarkar’s book on lattice using ggplot2 I have decide to undertake a similar exercise based on the scripts that have been made available for creating the graphs from the book. Read the rest of this entry »

Using Faceting in ggplot2 to create Trellis-like Plots

November 9th, 2009

One of the main strengths of the Trellis graphics paradigm is the use of panelling to divide data into subsets to investigate whether patterns are consistent as the conditioning variables change. In the ggplot2 package the terminology for specifying these separate panels is faceting and can be used to create similar displays. Read the rest of this entry »

Creating scatter plots using ggplot2

November 6th, 2009

The ggplot2 package can be used as an alternative to lattice for producing high quality graphics in R. The package provides a framework and hopefully simple interface to producing graphs and is inspired by the grammar of graphics. Read the rest of this entry »