Top Banner
Introduction to Probability Theory and Statistics for Psychology Quantitative methods for Human Sciences Dr Sarah Filippi [email protected] Lecture 1: Describing data October 7, 2015 1 / 40
40

Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

May 16, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Introduction to Probability Theoryand Statistics for Psychology

Quantitative methodsfor Human Sciences

Dr Sarah [email protected]

Lecture 1: Describing data October 7, 2015 1 / 40

Page 2: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Course information

Lectures on Wednesdays from 11:05 to 11:55

Course website: may be accessed athttp://www.stats.ox.ac.uk/~filippi/Teaching

Lecture slides on the website.

Lecture notes: more detailed than lectures slides, you must read these.

Formula booklet and definition booklet.

Problem sheets covered in tutorials.

Lecture 1: Describing data October 7, 2015 2 / 40

Page 3: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

About me

I am in the Statistics Department.

Email: [email protected]

Questions more than welcome, either during or at the end of thelecture.

My use of statistics:I work on a range of topics in computational statistics focused onunderstanding biological processes and their relation to disease.

Lecture 1: Describing data October 7, 2015 3 / 40

Page 4: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Lecture 1: Describing data

October 7, 2015

Lecture 1: Describing data October 7, 2015 4 / 40

Page 5: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Outline

Why we need statistics?

Different types of data

Discrete/ContinuousQuantitative/Qualitative

Methods of looking at the data:Barcharts, Histograms, Box plots, Scatter plots

Calculating summary measurement of the data

Location: mean, median, modeDispersion: MAD, sample variance, sample standard deviation

Lecture 1: Describing data October 7, 2015 5 / 40

Page 6: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The general focus of this course

populationabout aHypothesis

Study

Design

Propose an

experiment

Takea

sample

STATISTICALTEST

ExamineResults

Lecture 1: Describing data October 7, 2015 6 / 40

Page 7: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

An Example

Psychologists have long been interested in the relationship between stressand health.

A focused question might involve the study of a specific psychologicalsymptom and its impact on the health of a population.

To assess whether the symptom is a good indicator of stress we need tomeasure the symptom and stress level in a sample of individuals from thepopulation.

It is not immediately clear how we should go about collecting this sample,i.e. how we should design the study.

Lecture 1: Describing data October 7, 2015 7 / 40

Page 8: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Dataset consists of measured variables

The datasets that Psychologists, Human Scientists and Medical Scientistscollect will usually consist of one or more observations on one or morevariables.

A variable is a property of an object or event that can take on differentvalues.

Example: we collect a dataset by measuring, for every student in a class,

the hair colour resting heart rate and score on an IQ test.

The variables in this dataset are therefore

the hair colour resting heart rate and score on an IQ test.

Lecture 1: Describing data October 7, 2015 8 / 40

Page 9: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Types of variables

There are 2 main types of data/variable:

Measurement / Quantitative Data occur when we measureobjects/events,

e.g. when we measure someone’s height or weight.

Categorical / Qualitative Data occur when we assign objects intolabelled groups or categories,

e.g. when we group people according to hair colour or race.

Ordinal variables have a natural orderingNominal variable are unordered, e.g. gender, hair colour

Lecture 1: Describing data October 7, 2015 9 / 40

Page 10: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Types of variables

No. of students late for a lecture

There are only a limited set of distinct values/categoriesi.e. we can’t have exactly 2.23 students late, only integer values are allowed.

0Time spent studying statistics (hrs)

0 1 2 ................................................... 8

3.76 5.67

In theory there are an unlimited set of possible values!There are no discrete jumps between possible values.

Discrete Data

Continuous Data

Lecture 1: Describing data October 7, 2015 10 / 40

Page 11: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Summary of data types

Discrete

Nominal Ordinal

Quantitative

Discrete(counts) Continuous

Binary Non-Binary

Qualitative

Number of offspringsize of vocabulary at 18 months

Heightweight

tumour massbrain volume

Birth order (firstborn, etc.)Degree classification

"How offensive is this odour?(1=not at all, 5=very)"

Smoking (yes/no)Sex (M/F)

place of birth (home/hospital)

Hair colourethnicity

cause of death

Lecture 1: Describing data October 7, 2015 11 / 40

Page 12: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Plotting data

One of the most important stages in a statistical analysis can be simply tolook at your data right at the start.

By doing so you will be able to spot characteristic features, trends andoutlying observations that enable you to carry out an appropriatestatistical analysis.

Also, it is a good idea to look at the results of your analysis using a plot.This can help identify if you did something that wasn’t a good idea!

ALWAYS LOOK AT YOUR DATA !

Lecture 1: Describing data October 7, 2015 12 / 40

Page 13: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The baby-boom dataset

Forty-four babies (a new record) were born in one 24-hour period at theMater Mothers’ Hospital in Brisbane, Queensland, Australia, on December18, 1997. For each of the 44 babies, The Sunday Mail recorded the timeof birth, the sex of the child, and the birth weight in grams.

While we did not collect this dataset based on a specific hypothesis, if wewished we could use it to answer several questions of interest.

Do girls weigh more than boys at birth?

What is the distribution of the number of births per hour?

Is birth weight related to the time of birth?

Is gender related to the time of birth?

Are these observations consistent with boys and girls being equallylikely?

Lecture 1: Describing data October 7, 2015 13 / 40

Page 14: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Bar Charts

A Bar Chart is a useful method of summarising Categorical Data. Werepresent the counts/frequencies/percentages in each category by a bar.

Frequency

Girl Boy

04

812

1620

24

Lecture 1: Describing data October 7, 2015 14 / 40

Page 15: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Histogramms

A Bar Chart is to Categorical Data as a Histogram is to Measurement Data

Birth Weight (g)

Freq

uenc

y

1500 2000 2500 3000 3500 4000 4500

05

1015

200

510

1520

Lecture 1: Describing data October 7, 2015 15 / 40

Page 16: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Constructing an histogram

A histogram is constructed in the following way

1 Divide the measurements into intervals (sometimes called “bins”);

2 Determine the number of measurements within each category.

3 Draw a bar for each category whose heights represent the counts ineach category.

Example: Histogram of the birth weights from the baby-boom dataset.There are only 44 weights so it seems reasonable to take 6 bins.The smallest value= 1745; the largest value= 4162.

Interval 1500-2000 2000-2500 2500-3000 3000-3500 3500-4000 4000-4500Frequency 1 4 4 19 15 1

Using these categories works well, the histogram shows us the shape of thedistribution and we notice that distribution has an extended left ‘tail’.

Lecture 1: Describing data October 7, 2015 16 / 40

Page 17: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Too few categories

Birth Weight (g)

Freq

uenc

y

1500 2500 3500 4500

05

1015

2025

3035

Too many categories

Birth Weight (g)Fr

eque

ncy

1500 2500 3500 4500

01

23

45

67

Too few categories and the details are lost. Too many categories and theoverall shape is obscured by haphazard details.

Lecture 1: Describing data October 7, 2015 17 / 40

Page 18: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Cumulative frequency plot and curve

In a cumulative frequency plot the height of the bar in each intervalrepresents the total count of observations within interval and lower thanthe interval.

Interval 1500-2000 2000-2500 2500-3000 3000-3500 3500-4000 4000-4500

Frequency 1 4 4 19 15 1Cumulative 1 5 9 28 43 44Frequency

Cumulative Frequency Plot

Birth Weight (g)

Cum

ulat

ive

Freq

uenc

y

1500 2000 2500 3000 3500 4000 4500

010

2030

4050

2000 2500 3000 3500 4000 4500

010

2030

4050

Cumulative Frequency Curve

Birth Weight (g)

Cum

ulat

ive

Freq

uenc

y

Lecture 1: Describing data October 7, 2015 18 / 40

Page 19: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Dot plots

A Dot Plot is a simple and quick way of visualising a dataset. This type ofplot is especially useful if data occur in groups and you wish to quicklyvisualise the differences between the groups.

Birth Weight (g)

Gen

der

1500 2000 2500 3000 3500 4000 4500

Girl

Boy

Lecture 1: Describing data October 7, 2015 19 / 40

Page 20: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Scatter plots

Scatter plots are useful when we wish to visualise the relationship betweentwo measurement variables.

2000 2500 3000 3500 4000

020

040

060

080

010

0012

0014

00

Birth Weight (g)

Tim

e of

birt

h (m

ins

sinc

e 12

pm)

Lecture 1: Describing data October 7, 2015 20 / 40

Page 21: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Comparing histograms

10 0 10 20 30

10 0 10 20 30

10 0 10 20 30

Use summary statistics (measurements) of

location (mode, mean, median)dispersion (inter-quartile range, mean deviation, mean absolutedeviation, sample/population variance)

Lecture 1: Describing data October 7, 2015 21 / 40

Page 22: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The Mode

The Mode of a set of numbers is simply the most common valuee.g. the mode of the following set of numbers

1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 5, 5, 6, 6, 7, 8, 10, 13 is 3.

The mode is the peak of the distributionFrequency

0 2 4 6 8 10 12 14

01

23

4

1 2 3 4 5 6 7 8 9 10 11 12 13 14

Lecture 1: Describing data October 7, 2015 22 / 40

Page 23: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Advantage: The mode is always a score that actually occurred and canbe applied to nominal data.

Disadvantage: There may be two or more values that share the largestfrequency. In the case of two modes we would report both and refer to thedistribution as bimodal.

Lecture 1: Describing data October 7, 2015 23 / 40

Page 24: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The Median

The Median can be thought of as the ‘middle’ value i.e. the value forwhich 50% of the data fall below when arranged in numerical order.For example, consider the numbers

15, 3, 9, 21, 1, 8, 4,

When arranged in numerical order

1, 3, 4, 8 , 9, 15, 21

we see that the median value is 8. If there were an even number of scorese.g.

1, 3, 4,8 , 9, 15

then we take the midpoint of the two middle values. In this case themedian is (4 + 8)/2 = 6.

Lecture 1: Describing data October 7, 2015 24 / 40

Page 25: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Advantage: The median is unaffected by extreme scores (a point it shareswith the mode). We say the median is resistant to outliers.

For example, the median of the numbers

1, 3, 4, 8 , 9, 15, 99999

is still 8.

This property is very useful in practice as outlying observations can and dooccur (Data is messy remember!).

Lecture 1: Describing data October 7, 2015 25 / 40

Page 26: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The Mean

The Mean of a set of scores is the sum of the scores divided by thenumber of scores. For example, the mean of

1, 3, 4, 8, 9, 15 is1 + 3 + 4 + 8 + 9 + 15

6= 6.667 (to 3 dp)

In mathematical notation, the mean of a set of n numbers x1, . . . , xn isdenoted by x̄ where

x̄ =

∑ni=1 xin

or x̄ =

∑x

n(in the formula book)

See the appendix for a brief description of the summation notation (∑

)

Lecture 1: Describing data October 7, 2015 26 / 40

Page 27: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Advantage: The mean is the most widely used measure of location.Historically, this is because statisticians can write down equations for themean and derive nice theoretical properties for the mean, which are muchharder for the mode and median.

Disadvantage: The mean is not resistant to outlying observations.For example, the mean of

1, 3, 4, 8, 9, 15, 99999

is 14291.29, whereas the median (from above) is 8.

Lecture 1: Describing data October 7, 2015 27 / 40

Page 28: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Sometimes discrete measurement data are presented in the form of afrequency table in which the frequencies of each value are given.

Data (x) 1 2 3 4 5 6

Frequency (f) 2 4 6 7 4 1

We calculate the sum of the data as

(2× 1) + (4× 2) + (6× 3) + (7× 4) + (4× 5) + (1× 6) = 82

and the number of observations as

2 + 4 + 6 + 7 + 4 + 1 = 24

The the mean is given by

x̄ =82

24= 3.42 (2 dp)

Lecture 1: Describing data October 7, 2015 28 / 40

Page 29: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The relationship between mode/median/mean

Symmetric

10 0 10 20 30

mean = median = mode

Positive Skew

0 5 10 15 20 25 30

meanmedianmode

Negative Skew

0 5 10 15 20 25 30

meanmedianmode

Lecture 1: Describing data October 7, 2015 29 / 40

Page 30: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Measures of the dispersion: IQR and SIQR

The Interquartile Range (IQR) of a set of numbers is defined to be therange of the middle 50% of the data.The Semi-Interquartile Range (SIQR) is simply half the IQR.

Frequency

5 0 5 10 15 20 25

050

100

150

200

25% 75%

IQR

Lecture 1: Describing data October 7, 2015 30 / 40

Page 31: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

We calculate the IQR in the following way:

Calculate the 25% point (1st quartile) of the dataset. The locationof the 1st quartile is defined to be the

(N+1

4

)th data point.

Calculate the 75% point (3rd quartile) of the dataset. The location

of the 3rd quartile is defined to be the(3(N+1)

4

)th data point.

Calculate the IQR as

IQR = 3rd quartile - 1st quartile

Example: Consider the set of 11 numbers

10, 15, 18, 33, 34, 36, 51, 73, 80, 86, 92.

The 1st quartile is the (11+1)4 = 3rd data point = 18

The 3rd quartile is the 3(11+1)4 = 9th data point = 80

IQR = 80− 18 = 62 SIQR = 62/2 = 31.

Lecture 1: Describing data October 7, 2015 31 / 40

Page 32: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The mean absolute deviation (MAD)

To measure the spread of a dataset it seems sensible to use the ‘deviation’of each data point from the mean of the distribution. The deviation ofeach data point from the mean is simply the data point minus the mean.

small spread = small deviations large spread = large deviations

Lecture 1: Describing data October 7, 2015 32 / 40

Page 33: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

We calculate the MAD in the following way1 Calculate the mean of the data, x̄2 Calculate the deviations by subtracting the mean from each value,

x− x̄

3 Calculate the absolute deviations1 by removing any minus signs fromthe deviations,

|x− x̄|4 Sum the absolute deviations, ∑

|x− x̄|

5 Calculate the MAD by dividing the sum of the absolute deviations bythe number of data points, ∑

|x− x̄|n

1The absolute value of a number is the value of that number with any minus signremoved, e.g. | − 3| = 3

Lecture 1: Describing data October 7, 2015 33 / 40

Page 34: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Data Deviations |Deviations|x x− x̄ |x− x̄|10 10 - 48 = -38 3815 15 - 48 = -33 3318 18 - 48 = - 30 3033 33 - 48 = -15 1534 34 - 48 = -14 1436 36 - 48 = -12 1251 51 - 48 = 3 373 73 - 48 = 25 2580 80 - 48 = 32 3286 86 - 48 = 38 3892 92 - 48 = 44 44∑x = 528

∑(x− x̄) = 0

∑|x− x̄| = 284

Mean: MAD:

x̄ =∑

xn = 48

∑(x−x̄)n = 0

∑|x−x̄|n = 25.818

Lecture 1: Describing data October 7, 2015 34 / 40

Page 35: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The sample variance and population variance

Another way of measuring the spread is to consider the squared deviations,called the variance

If our dataset consists of the whole population (a rare occurrence) then wecan calculate the population variance σ2 as

σ2 =

∑ni=1(xi − x̄)2

n

When we just have a sample from the population (most of the time) wecan calculate the sample variance s2 as

s2 =

∑ni=1(xi − x̄)2

n− 1

Note: We divide by n− 1 when calculating the sample variance.

Lecture 1: Describing data October 7, 2015 35 / 40

Page 36: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Data Deviations Deviations2

x x− x̄ (x− x̄)2

10 10 - 48 = -38 144415 15 - 48 = -33 108918 18 - 48 = - 30 90033 33 - 48 = -15 22534 34 - 48 = -14 19636 36 - 48 = -12 14451 51 - 48 = 3 973 73 - 48 = 25 62580 80 - 48 = 32 102486 86 - 48 = 38 144492 92 - 48 = 44 1936∑x = 528

∑(x− x̄) = 0

∑(x− x̄)2 = 9036

Mean: Sample variance:

x̄ =∑

xn = 48

∑(x−x̄)n = 0 s2 =

∑(x−x̄)2

n−1 = 903.6

Lecture 1: Describing data October 7, 2015 36 / 40

Page 37: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

The sample and population standard deviation

Notice how the sample variance in this example Example 1 is much higherthan the MAD.

MAD = 25.818 s2 = 903.6

This happens because we have squared the deviations transforming themto a quite different scale. We can recover the scale of the original data bysimply taking the square root of the sample (population) variance.

Thus we define the sample standard deviation s as

s =

√∑ni=1(xi − x̄)2

n− 1

and we define the population standard deviation σ as

σ =

√∑ni=1(xi − x̄)2

n

Lecture 1: Describing data October 7, 2015 37 / 40

Page 38: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Box Plots

A Box Plot (also called a Box-and-Whisker Plot) is a relativelysophisticated plot that summarises the distribution of a given dataset.

A box plot consists of three main parts

A box that covers the middle 50% of the data. The edges of the boxare the 1st and 3rd quartiles. A line is drawn in the box at the medianvalue.

Whiskers that extend out from the box to indicate how far the dataextend either side of the box. The whiskers should extend no furtherthan 1.5 times the length of the box, i.e. the maximum length of awhisker is 1.5 times the IQR.

All points that lie outside the whiskers are plotted individually asoutlying observations.

Lecture 1: Describing data October 7, 2015 38 / 40

Page 39: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Box Plots

2000

2500

3000

3500

4000

Median

1st quartile

3rd quartile

Lower Whisker

Upper Whisker

Outliers

Lecture 1: Describing data October 7, 2015 39 / 40

Page 40: Introduction to Probability Theory and Statistics for ...filippi/Teaching/psychology_humanscience_20… · Introduction to Probability Theory and Statistics for Psychology Quantitative

Plotting box plots of measurements in different groups side by side can beillustrative. For example, box plots of birth weight for each gender side byside indicate that the distributions have quite different shapes.

Girls Boys

2000

2500

3000

3500

4000

Lecture 1: Describing data October 7, 2015 40 / 40