Descriptive Statistics and Exploratory Data Analysis
Descriptive Statistics and Exploratory Data Analysis
Pop 1
Pop 2 Randomly sample 4 individuals from each pop Tissue culture and RNA extraction Labeling and array hybridization Slide scanning and data acquisition Repeat 2 times processing 16 samples in total Repeat entire process producing 2 technical replicates for all 16 samples
Other Business
Course web-site:
http://www.gs.washington.edu/academics/courses/akey/56008/index.htm
Make sure you look at HW1 soon and see either Shameek or myself with questions
Today
What is descriptive statistics and exploratory data analysis? Basic numerical summaries of data Basic graphical summaries of data How to use R for calculating descriptive statistics and making graphs
Population
Descriptive Statistics
Sample
Inferential Statistics
EDA
Before making inferences from data it is essential to examine all your variables. Why? To listen to the data: - to catch mistakes - to see patterns in the data - to nd violations of statistical assumptions - to generate hypotheses and because if you dont, you will have trouble later
Types of Data
Categorical Quantitative
binary
2 categories
nominal
ordinal
discrete
continuous
Location: Mean
1. The Mean To calculate the average x of a set of observations, add their value and divide by the number of observations:
Trimmed:
x ="
"w x
i
x=
i= 1 n
"w
i= 1
Geometric:
# & x = %" x i ( $ i=1 '
n 1 n
Harmonic:
x= n 1 "x i= 1 i
n
Location: Median
Median the exact middle value Calculation:
- If there are an odd number of observations, nd the middle value - If there are an even number of observations, nd the middle two values and average them
Example
Some data: Age of participants: 17 19 21 22 23 23 23 38 Median = (22+23)/2 = 22.5
Mean = 3 Median = 3
Mean = 4 Median = 3
Scale: Variance
Average of squared deviations of values from the mean
n
2 " =
$( x
i
# x)
n #1
= "
n #1
1. Score (in the units that are meaningful) 2. Mean ! 3. Each scores deviation from the mean 4. Square that deviation 5. Sum all the squared deviations (Sum of Squares) 6. Divide by n-1 7. Square root now the value is in the units we started with!!!
At least
within
(1 - 1/12) = 0% ... k=1 ( 1) (1 - 1/22) = 75% ........ k=2 ( 2) (1 - 1/32) = 89% ....k=3 ( 3)
Ave-2s.d.
Ave-s.d.
68% 95%
Q1
Q2
Q3
The rst quartile, Q1, is the value for which 25% of the observations are smaller and 75% are larger Q2 is the same as the median (50% are smaller, 50% are larger) Only 25% of the observations are greater than the third quartile
Histogram
Used to visualize distribution (shape, center, range, variation) of continuous variables Bin size important
Frequency
Frequency
Frequency
More on Histograms
Whats the difference between a frequency histogram and a density histogram?
More on Histograms
Whats the difference between a frequency histogram and a density histogram?
Frequency Histogram Density Histogram
Box Plots
100.0
maximum
66.7
Q3 IQR median Q1
Years
33.3
minimum
0.0
AGE
Variables
Bivariate Data
Variable 1
Categorical
Variable 2
Categorical
Display
Crosstabs Stacked Box Plot
Categorical Continuous
Continuous Continuous
Multivariate Data
Clustering Organize units into clusters Descriptive, not inferential Many approaches Clusters always produced Data Reduction Approaches (PCA) Reduce n-dimensional dataset into much smaller number Finds a new (smaller) set of variables that retains most of the information in the total sample Effective way to visualize multivariate data
Example 1
Example 2
Example 3
Example 4
Example 5
R Tutorial
Calculating descriptive statistics in R Useful R commands for working with multivariate data (apply and its derivatives) Creating graphs for different types of data (histograms, boxplots, scatterplots) Basic clustering and PCA analysis