Canadian Bioinformatics Workshops www.bioinformatics.ca.

Slides:



Advertisements
Similar presentations
Learning Objectives Copyright © 2004 John Wiley & Sons, Inc. Data Processing, Fundamental Data Analysis, and Statistical Testing of Differences CHAPTER.
Advertisements

Copyright © Allyn & Bacon (2007) Statistical Analysis of Data Graziano and Raulin Research Methods: Chapter 5 This multimedia product and its contents.
Statistics 100 Lecture Set 7. Chapters 13 and 14 in this lecture set Please read these, you are responsible for all material Will be doing chapters
The General Linear Model. The Simple Linear Model Linear Regression.
Chapter 6 The Normal Distribution and Other Continuous Distributions
Introduction to Educational Statistics
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions.
Statistics for Managers Using Microsoft Excel, 5e © 2008 Pearson Prentice-Hall, Inc.Chap 6-1 Statistics for Managers Using Microsoft® Excel 5th Edition.
Chapter 6 The Normal Distribution & Other Continuous Distributions
Copyright ©2011 Pearson Education, Inc. publishing as Prentice Hall 6-1 Chapter 6 The Normal Distribution & Other Continuous Distributions Statistics for.
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions.
Correlation and Regression Analysis
Business Statistics: A First Course, 5e © 2009 Prentice-Hall, Inc. Chap 6-1 Chapter 6 The Normal Distribution Business Statistics: A First Course 5 th.
Use of Quantile Functions in Data Analysis. In general, Quantile Functions (sometimes referred to as Inverse Density Functions or Percent Point Functions)
Density Curve A density curve is the graph of a continuous probability distribution. It must satisfy the following properties: 1. The total area.
Inference for regression - Simple linear regression
© 2005 The McGraw-Hill Companies, Inc., All Rights Reserved. Chapter 12 Describing Data.
Describing distributions with numbers
Exploratory Data Analysis. Computing Science, University of Aberdeen2 Introduction Applying data mining (InfoVis as well) techniques requires gaining.
Chap 6-1 Copyright ©2013 Pearson Education, Inc. publishing as Prentice Hall Chapter 6 The Normal Distribution Business Statistics: A First Course 6 th.
Tutor: Prof. A. Taleb-Bendiab Contact: Telephone: +44 (0) CMPDLLM002 Research Methods Lecture 9: Quantitative.
Numerical Descriptive Techniques
Continuous Random Variables
Statistics & Biology Shelly’s Super Happy Fun Times February 7, 2012 Will Herrick.
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions.
Statistical Decision Making. Almost all problems in statistics can be formulated as a problem of making a decision. That is given some data observed from.
● Final exam Wednesday, 6/10, 11:30-2:30. ● Bring your own blue books ● Closed book. Calculators and 2-page cheat sheet allowed. No cell phone/computer.
Analyzing and Interpreting Quantitative Data
CHAPTER 7: Exploring Data: Part I Review
Wednesday, May 13, 2015 Report at 11:30 to Prairieview.
Fall Final Topics by “Notecard”.
Categorical vs. Quantitative…
Chapter Twelve Copyright © 2006 John Wiley & Sons, Inc. Data Processing, Fundamental Data Analysis, and Statistical Testing of Differences.
MMSI – SATURDAY SESSION with Mr. Flynn. Describing patterns and departures from patterns (20%–30% of exam) Exploratory analysis of data makes use of graphical.
Review Lecture 51 Tue, Dec 13, Chapter 1 Sections 1.1 – 1.4. Sections 1.1 – 1.4. Be familiar with the language and principles of hypothesis testing.
Chapter 6: Analyzing and Interpreting Quantitative Data
Mr. Magdi Morsi Statistician Department of Research and Studies, MOH
Basic Business Statistics
Sampling and estimation Petter Mostad
Statistical Data Analysis 2011/2012 M. de Gunst Lecture 2.
LIS 570 Summarising and presenting data - Univariate analysis.
© 2002 Prentice-Hall, Inc.Chap 5-1 Statistics for Managers Using Microsoft Excel 3 rd Edition Chapter 5 The Normal Distribution and Sampling Distributions.
Statistics for Managers Using Microsoft Excel, 5e © 2008 Pearson Prentice-Hall, Inc.Chap 6-1 Statistics for Managers Using Microsoft® Excel 5th Edition.
Basic Business Statistics, 10e © 2006 Prentice-Hall, Inc.. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions Basic Business.
Descriptive Statistics(Summary and Variability measures)
Chapter 6: Descriptive Statistics. Learning Objectives Describe statistical measures used in descriptive statistics Compute measures of central tendency.
Graphs with SPSS Aravinda Guntupalli. Bar charts  Bar Charts are used for graphical representation of Nominal and Ordinal data  Height of the bar is.
AP Statistics Review Day 1 Chapters 1-4. AP Exam Exploring Data accounts for 20%-30% of the material covered on the AP Exam. “Exploratory analysis of.
(Unit 6) Formulas and Definitions:. Association. A connection between data values.
Canadian Bioinformatics Workshops
Canadian Bioinformatics Workshops
Describing Data Week 1 The W’s (Where do the Numbers come from?) Who: Who was measured? By Whom: Who did the measuring What: What was measured? Where:
Canadian Bioinformatics Workshops
Canadian Bioinformatics Workshops
Canadian Bioinformatics Workshops
Chapter 6 The Normal Distribution and Other Continuous Distributions
Descriptive Statistics ( )
Thursday, May 12, 2016 Report at 11:30 to Prairieview
Canadian Bioinformatics Workshops
BAE 6520 Applied Environmental Statistics
BAE 5333 Applied Water Resources Statistics
Data Mining: Concepts and Techniques
Analyzing and Interpreting Quantitative Data
STAT 206: Chapter 6 Normal Distribution.
Description of Data (Summary and Variability measures)
Statistics for Managers Using Microsoft® Excel 5th Edition
Georgi Iskrov, MBA, MPH, PhD Department of Social Medicine
The Normal Distribution
Introductory Statistics
Presentation transcript:

Canadian Bioinformatics Workshops

2Module #: Title of Module

Module 1 Exploratory Data Analysis (EDA) D EPARTMENT OF B IOCHEMISTRY D EPARTMENT OF M OLECULAR G ENETICS † Odysseus listening to the song of the sirens. Late Archaic (500–480 BCE) This workshop includes bits of material originally developed by Raphael Gottardo, FHCRC and by Sohrab Shah, UBC † Boris Steipe Exploratory Data Analysis of Biological Data using R Toronto, May 21. and

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Learning Objectives Be able to load, transform and visualize data; Begin generating ideas about how relationships in data can be explored; Understand some principles of effective visualization; Know where to go for help.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Exploratory Data Analysis (EDA) Numerical analysis and graphical presentation of data without a particular model or underlying hypothesis in order to... uncover underlying structure; define important variables; detect outliers and anomalies; detect trends; develop statistical models; test underlying assumptions. The goal is hypothesis generation, not hypothesis testing. Therefore EDA is often the first step of data analysis.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Exploratory Data Analysis (EDA) The objectives of EDA include: uncovering underlying structure and identifying trends and patterns; extracting important variables; detecting outliers and anomalies; testing underlying assumptions; developing statistical models.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Exploratory Data Analysis (EDA) The practice of EDA emphasizes looking at data in different ways through: computing and tabulating basic descriptors of data properties such as ranges, means, quantiles, and variances; generating graphics, such as boxplots, histograms, scatter plots; applying transformations, such as log or rank; comparing observations to statistical models, such as the QQ-plot, or linear and non-linear regression; simplifying data through dimension reduction; identifying underlying structure through clustering all with the final goal of defining which statistical model might be appropriate to use for hypothesis testing and prediction.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Why R for EDA? Full-featured programming language "Statistical workbench" Data manipulation is easy Easy access to graphics Sophisticated packages and libraries Large community

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Graphics Good graphics are immensely valuable. Poor graphics are worse than none. If you want to learn more about good graphics and information design, find a copy of Edward Tufte's The Visual Display of Quantitative Information. You can also visit his Web site to get a sense of the field ( Fundamentally, there is one simple rule. The rule has many corollaries. Use less ink.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Use less ink Make sure that all elements on your graphics are necessary. Make sure that all elements on your graphics are informative. Make sure that all information in your data is displayed. Not all of R's defaults use as little ink as possible...

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca refined graphics... for a popular alternative to R's defaults, check out the ggplot2 package ( > install.packages("ggplot2")... > library(ggplot2)... Example: Bubble chart. crime <- read.csv("crimeRatesByState2008.csv", header=TRUE, sep="\t") p <- ggplot(crime, aes(murder,burglary,size=population, label=state)) p <- p+geom_point(colour="red") +scale_area(to=c(1,20))+geom_text(size=3) p + xlab("Murders per 100,000 population") + ylab("Burglaries per 100,000")

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Graphics examples "... What if you could gussy up a report or pretty up a chart without much additional work? What if, using just one extra line of code, you could create a Microsoft Excel column chart that included a cool gradient fill like this one: " (From Microsoft TechNet)

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Graphics examples: chartjunk "... What if you could gussy up a report or pretty up a chart without much additional work? What if, using just one extra line of code, you could create a Microsoft Excel column chart that included a cool gradient fill like this one: " (From Microsoft TechNet) Only five numbers actually Meaningless colors, no connection to actual scale. Note that the range differs for each stack! No units Values can't be easily retrieved from graph due to parallax. What does the third dimension even mean?

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Graphics examples

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Graphics examples

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Graphics inspiration and advice

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Graphics inspiration and advice

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Box-plot Descriptive statistics can be intuitively summarized in a Box-plot. > boxplot(x) IQR 1.5 x IQR Everything above and below 1.5 x IQR is considered an "outlier". 75% quantile Median 25% quantile IQR = Inter Quantile Range = 75% quantile – 25% quantile

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Violinplot Internal structure of a data-vector can be made visible in a violin plot. The principle is the same as for a boxplot, but a width is calculated from a smoothed histogram. p <- ggplot(X, aes(1,x)) p + geom_violin()

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca QQ–plot One of the first things we may ask about data is whether it deviates from an expectation e.g. to be normally distributed. The quantile-quantile plot provides a way to visually verify this. The QQ-plot shows the theoretical quantiles versus the empirical quantiles. If the distribution assumed (theoretical one) is indeed the correct one, we should observe a straight line. R provides qqnorm() and qqplot().

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca probability distributions Can be either discrete or continuous (uniform, Bernoulli, normal, etc) Defined by a density function, p(x) or f(x) Bernoulli distribution Be(p): flip a coin (T=0, H=1). Assume probability of H is x <- 0:1 f <- dbinom(x, size=1, prob=0.1) plot(x, f, xlab="x", ylab="density", type="h", lwd=5)

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca probability distributions Random sampling: Generate 100 observations from a Be(0.1) set.seed(100) x <- rbinom(100, size=1, prob=0.1) hist(x)

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca probability distributions Normal distribution N(μ,σ 2 ) μ is the mean and σ 2 is the variance. Extremely important because of the Central Limit Theorem: if a random variable is the sum of a large number of small random variables, it will be normally distributed. x <- seq(-4, 4, 0.1) f <- dnorm(x, mean=0, sd=1) plot(x, f, xlab="x", ylab="density", lwd=5, type="l") The area under the curve is the probability of observing a value between 0 and 2.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca exploring data When teaching (or learning new procedures) I prefer to work with synthetic data. Synthetic data has the advantage that I know what the outcome of the analysis should be. Typically one would create values acording to a function and then add noise. R has several functions to create sequences of values – or you can write your own... 0:10 seq(0, pi, 5*pi/180) rep(1:3, each=3, times=2) for (i in 1:10) { print(i*i) }

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca synthetic data Function... Explore functions and noise. Noise... Noisy Function...

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca ACGT 0 1 arbitrary probabilities Map the probabilities onto the unit interval, then use runif() to choose.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca arbitrary probability distributions Calculate the function value at a point in the domain of interest. Then choose a uniform value between the minimum and maximum in the domain. If the random value is smaller than the function value, accept, otherwise reject. Think of this as randomly placing dots on a plot of the function, then accepting those that lie under the curve. Try this

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Multivariate data - scatter plots Biological data sets often contain several variables, they are multivariate. Scatter plots allow us to look at two variables at a time. This can be used to assess independence and identify subgroups. # GvHD flow cytometry data gvhd <- read.table("GvHD.txt", header=TRUE) # Only extract the CD3 positive cells gvhdCD3p 280, 3:6]) plot(gvhdCD3p[, 1:2])

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca trellis graphics Trellis Graphics is a family of techniques for viewing complex, multi-variable data sets. plot(gvhdCD3p, pch=".") Tip: Many more possibilities are available in the "lattice" package. See ?Lattice

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Boxplots The boxplot function can be used to display several variables at a time. boxplot(gvhdCD3p) Exercise: Interpret this plot.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca EDA: HIV microarray data HIV Data: The expression levels of 7680 genes were measured in CD4-T-cell lines at time t = 24 hours after infection with HIV type 1 virus. 12 positive controls (HIV genes). 4 replicates (2 with a dye swap)

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca EDA: HIV microarray data We get the data after the image analysis is done. For each spot we have an estimate of the intensity in both channels. The data matrix therefore is of size 7680 x 8. One of the array chips.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca EDA: Transformations Observations: The data are highly skewed. The standard deviation is not constant, as it increases with the mean. Solution: Look for a transformation that will make the data more symmetric and the variance more constant. With positive data the log transformation is often appropriate.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca EDA: Transformations The standard deviation has become almost independent of the mean. # 'apply' will apply the function to all rows of the data matrix mean <- apply(data[, 1:4], 1, "mean") sd <- apply(data[, 1:4], 1, "sd") plot(mean, sd) trend <- lowess(mean, sd) lines(trend, col=2, lwd=5)

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca EDA for microarray data: always log Makes the data more symmetric, large observations are not as influential The variance is (more) constant Turns multiplication into addition (log(ab)=log(a)+log(b)) In practice use log base 2, log2(x)=log(x)/log(2)

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca Summary EDA should be the first step in any statistical analysis! Good modeling starts and ends with EDA. R provides a great framework for EDA.

Module 1: Exploratory Data Analysis (EDA) bioinformatics.ca