580 likes | 759 Views
Introduction to Statistics. Colm O’Dushlaine. Neuropsychiatric Genetics, TCD codushlaine@gmail.com. Overview. Descriptive Statistics & Graphical Presentation of Data Statistical Inference Hypothesis Tests & Confidence Intervals T-tests (Paired/Two-sample)
E N D
Introduction to Statistics Colm O’Dushlaine Neuropsychiatric Genetics, TCD codushlaine@gmail.com
Overview • Descriptive Statistics & Graphical Presentation of Data • Statistical Inference • Hypothesis Tests & Confidence Intervals • T-tests (Paired/Two-sample) • Regression (SLR & Multiple Regression) • ANOVA/ANCOVA • Intended as an interview. Will provide slides after lectures • What’s in the lectures?...
Lecture 1 Lecture 2 Lecture 3 Lecture 4 Descriptive Statistics and Graphical Presentation of Data • Terminology • Frequency Distributions/Histograms • Measures of data location • Measures of data spread • Box-plots • Scatter-plots • Clustering (Multivariate Data)
Lecture 1 Lecture 2 Lecture 3 Lecture 4 Statistical Inference • Distributions & Densities • Normal Distribution • Sampling Distribution & Central Limit Theorem • Hypothesis Tests • P-values • Confidence Intervals • Two-Sample Inferences • Paired Data
Lecture 1 Lecture 2 Lecture 3 Lecture 4 Sample Inferences • Two-Sample Inferences • Paired t-test • Two-sample t-test • Inferences for more than two samples • One-way ANOVA • Two-way ANOVA • Interactions in Two-way ANOVA • DataDesk demo
Lecture 1 Lecture 2 Lecture 3 Lecture 4 • Regression • Correlation • Multiple Regression • ANCOVA • Normality Checks • Non-parametrics • Sample Size Calculations • Useful tools and websites
FIRST, A REALLY USEFUL SITE Explanations of outputs Videos with commentary Help with deciding what test to use with what data
TerminologyPopulations & Samples • Population: the complete set of individuals, objects or scores of interest. • Often too large to sample in its entirety • It may be real or hypothetical (e.g. the results from an experiment repeated ad infinitum) • Sample: A subset of the population. • A sample may be classified asrandom(each member has equal chance of being selected from a population) or convenience (what’s available). • Random selection attempts to ensure the sample is representative of the population.
Variables • Variables are the quantities measured in a sample.They may be classified as: • Quantitativei.e. numerical • Continuous (e.g. pH of a sample, patient cholesterol levels) • Discrete (e.g. number of bacteria colonies in a culture) • Categorical • Nominal (e.g. gender, blood group) • Ordinal(ranked e.g. mild, moderate or severe illness). Often ordinal variables are re-coded to be quantitative.
Variables • Variables can be further classified as: • Dependent/Response. Variable of primary interest (e.g. blood pressure in an antihypertensive drug trial). Not controlled by the experimenter. • Independent/Predictor • called a Factor whencontrolled by experimenter. It is often nominal (e.g. treatment) • Covariate when not controlled. • If the value of a variable cannot be predicted in advance then the variable is referred to as a random variable
Parameters & Statistics • Parameters: Quantities that describe a population characteristic. They are usually unknown and we wish to make statistical inferences about parameters. Different to perimeters. • Descriptive Statistics: Quantities and techniques used to describe a sample characteristic or illustrate the sample data e.g. mean, standard deviation, box-plot
2. Frequency Distributions • An (Empirical) Frequency Distribution or Histogram for a continuous variable presents the counts of observations grouped within pre-specified classes or groups • A Relative Frequency Distribution presents the corresponding proportions of observations within the classes • A Barchart presents the frequencies for a categorical variable
Example – Serum CK • Blood samples taken from 36 male volunteers as part of a study to determine the natural variation in CK concentration. • The serum CK concentrations were measured in (U/I) are as follows:
Relative Frequency Distribution Mode Shaded area is percentage of males with CK values between 60 and 100 U/l, i.e. 42%. Right tail (skewed) Left tail
3. Measures of Central Tendency (Location) Measures of location indicate where on the number line the data are to be found. Common measures of location are: (i)the ArithmeticMean, (ii)theMedian, and (iii)the Mode
The Mean • Let x1,x2,x3,…,xnbe the realised valuesof a random variable X, from a sample of size n. The sample arithmetic mean is defined as:
Example Example 2: The systolic blood pressure of seven middle aged men were as follows: 151, 124, 132, 170, 146, 124 and 113. The mean is
The Median and Mode • If the sample data are arranged in increasing order, the median is • the middle value if n is an odd number, or • midway between the two middle values if n is an even number • The mode is the most commonly occurring value.
Example 1 – n is odd The reordered systolic blood pressure data seen earlier are: 113, 124, 124, 132, 146, 151, and 170. The Median is the middle value of the ordered data, i.e. 132. Two individuals have systolic blood pressure = 124 mm Hg, so the Mode is 124.
Example 2 – n is even Six men with high cholesterol participated in a study to investigate the effects of diet on cholesterol level. At the beginning of the study, their cholesterol levels (mg/dL) were as follows: 366, 327, 274, 292, 274 and 230. Rearrange the data in numerical order as follows: 230, 274, 274, 292, 327 and 366. The Median is half way between the middle two readings, i.e. (274+292) 2 = 283. Two men have the same cholesterol level- the Mode is 274.
Mean versus Median • Large sample values tend to inflate the mean. This will happen if the histogram of the data is right-skewed. • The median is not influenced by large sample values and is a better measure of centrality if the distribution is skewed. • Note if mean=median=mode then the data are said to be symmetrical • e.g. In the CK measurement study, the sample mean = 98.28. The median = 94.5, i.e. mean is larger than median indicating that mean is inflated by two large data values 201 and 203.
4. Measures of Dispersion • Measures of dispersion characterise how spread out the distribution is, i.e., how variable the data are. • Commonly used measures of dispersion include: • Range • Variance & Standard deviation • Coefficient of Variation (or relative standard deviation) • Inter-quartile range
Range • the sample Range is the difference between the largest and smallest observations in the sample • easy to calculate; • Blood pressure example: min=113 and max=170, so the range=57 mmHg • useful for “best” or “worst” case scenarios • sensitive to extreme values
Sample Variance • The sample variance, s2, is the arithmetic mean of the squared deviations from the sample mean: >
Standard Deviation • The sample standard deviation, s, is the square-root of the variance • s has the advantage of being in the same units as the original variable x
Example (contd.) Therefore,
Coefficient of Variation • The coefficient of variation (CV) or relative standard deviation (RSD) is the sample standard deviation expressed as a percentage of the mean, i.e. • The CV is not affected by multiplicative changes in scale • Consequently, a useful way of comparing the dispersion of variables measured on different scales
Example The CV of the blood pressure data is: i.e., the standard deviation is 14.3% as large as the mean.
Inter-quartile range • The Median divides a distribution into two halves. • The first and third quartiles (denoted Q1 and Q3) are defined as follows: • 25% of the data lie below Q1 (and 75% is above Q1), • 25% of the data lie above Q3 (and 75% is below Q3) • The inter-quartile range (IQR) is the difference between the first and third quartiles, i.e. IQR = Q3- Q1
Example The ordered blood pressure data is: 113 124 124 132 146 151 170 Q1 Q3 Inter Quartile Range (IQR) is 151-124 = 27
5. Box-plots • A box-plot is a visual description of the distribution based on • Minimum • Q1 • Median • Q3 • Maximum • Useful for comparing large sets of data
Example 1 The pulse rates of 12 individuals arranged in increasing order are: 62, 64, 68, 70, 70, 74, 74, 76, 76, 78, 78, 80 Q1=(68+70)2 = 69, Q3=(76+78)2 = 77 IQR = (77 – 69) = 8
Example 2: Box-plots of intensities from 11 gene expression arrays
Outliers • An outlier is an observation which does not appear to belong with the other data • Outliers can arise because of a measurement or recording error or because of equipment failure during an experiment, etc. • An outlier might be indicative of a sub-population, e.g. an abnormally low or high value in a medical test could indicate presence of an illness in the patient.
Outlier Boxplot • Re-define the upper and lower limits of the boxplots (the whisker lines) as: Lower limit = Q1-1.5IQR, and Upper limit = Q3+1.5IQR • Note that the lines may not go as far as these limits • If a data point is < lower limit or > upper limit, the data point is considered to be an outlier.
Example – CK data outliers
6. Scatter-plot • Displays the relationship between two continuous variables • Useful in the early stage of analysis when exploring data and determining is a linear regression analysis is appropriate • May show outliers in your data
Example 1: Age versus Systolic Blood Pressure in a Clinical Trial
Example 2: Up-regulation/Down-regulation of gene expression across an array (Control Cy5 versus Disease Cy3)
Other graphical representations • Dot-Plots, Stem-and-leaf plots • Not visually appealing • Pie-chart • Visually appealing, but hard to compare two datasets. Best for 3 to 7 categories. A total must be specified. • Violin-plots • =boxplot+smooth density • Nice visual of data shape
Multivariate Data • Clustering is useful for visualising multivariate data and uncovering patterns, often reducing its complexity • Clustering is especially useful for high-dimensional data (p>>n): hundreds or perhaps thousands of variables • An obvious areas of application are gel electrophoresis and microarray experiments where the variables are protein abundances or gene expression ratios
7. Clustering • Aim: Find groups of samples or variables sharing similiarity • Clustering requires a definition of distance between objects, quantifying a notion of (dis)similarity • Points are grouped on the basis on minimum distance apart (distance measures) • Once a pair are grouped, they are combined into a single point (using a linkage method) e.g. take their average. The process is then repeated.
Clustering • Clustering can be applied to rows or columns of a data set (matrix) i.e. to the samples or variables • A tree can be constructed with branch length proportional to distances between linked clusters, called a Dendrogram • Clustering is an example of unsupervisedlearning: No use is made of sample annotations i.e. treatment groups, diagnosis groups