Difference between revisions of "R Analysis"

From REALab Wiki
Jump to navigation Jump to search
Line 76: Line 76:
*Simple line graph for one factor?
*Simple line graph for one factor?
*Simple line graph for more than one factor?
*Simple line graph for more than one factor?
====Follow-up tests====
=====Following up on significant main effect of factor with more than 2 levels=====
*Tukey's HSD tests
*Fisher's LSD tests
=====Following up on significant interaction
*Simple main effect of factor A at level of factor B
*Tukey's HSD tests for factor A at level of factor B
====Full Graphs with Error Bars====
*computing summary stats (means, sd, counts) needed for plots with error bars
*plotting graph with error bars using "ggplot2" package
*fine-tweaking your graph with ggplot2

Revision as of 23:46, 21 March 2013

This wiki is designed to help anyone perform statistical analyses on their data using R. It is divided into 3 broad sections: the first section outlines basics of how R deals with data using built in data sets, the second will help you to read in and organize your own data, and the third will help to summarize, run stats, and output graphs of your data.

Each section is organized into a series of questions. Start from the beginning if you are new to R, or click on a question to go to a detailed answer and/or examples.


To get started, download R for free from the R website

Alternatively, for a better organized scripting environment with syntax highlighting, download Rstudio


Part 1: R basics

Part 2: Organizing your data

This section describes how to load in data files into a data frame, add or drop columns, create a new data frame from a subset of the full data, and generally get your data into the form you need so you can then conduct your analyses.

prep stuff: data sets & making a new script

First download the following data sets, and unzip them to a local folder:

(you can also find these in the bar.laboratory@gmail.com dropbox account, in the "\stats meetings\data sets" folder - please make copies for yourself as these should remain in this folder as originals)

how to read your data into R

how to fill out and complete your main data frame

how to select a subset of your main data frame

Part 3: Analyzing your data

This section outlines how to perform descriptive stats, inferential stats, and output graphs once your data frame is organized

Performing ANOVAs

  • ANOVA using built in R function?
  • ANOVA using "ez" package?

Means tables and simple plots

  • Finding the means of a variable for all levels of a factor?
  • Finding the means of a variable for all levels of more than one factor?
  • Simple bar plot for one factor?
  • Simple bar plot for more than one factor?
  • Simple line graph for one factor?
  • Simple line graph for more than one factor?

Follow-up tests

Following up on significant main effect of factor with more than 2 levels
  • Tukey's HSD tests
  • Fisher's LSD tests

=====Following up on significant interaction

  • Simple main effect of factor A at level of factor B
  • Tukey's HSD tests for factor A at level of factor B

Full Graphs with Error Bars

  • computing summary stats (means, sd, counts) needed for plots with error bars
  • plotting graph with error bars using "ggplot2" package
  • fine-tweaking your graph with ggplot2