Docsity

Statistics and Hypothesis Testing - Lecture Notes | BIOL 4230, Study notes of Zoology

Toggle sidebar
bg1
Animal Behavior (BIOL/WFS 4230/5230) Spring 2008
STATISTICS AND HYPOTHESIS TESTING
Like many other scientists, one of the things behaviorists do is conduct experiments and gather
data. Oftentimes, we collect data from two or more groups, and then want to compare these groups to see
if they differ. For instance, we might want to determine whether running speed differs between male and
female anoles, or if foraging in kangaroo rats differs when a predator is present or absent. To conduct the
first experiment, we could gather up a number of anoles, both males and females, run them down a track,
and record their maximum speed. We then have two similar, but distinct, questions we can ask. First, how
can we summarize the information we obtained by measuring running speed (or number of seeds obtained
by the kangaroo rats)? And second, how can we determine whether running speed differs between the two
groups (sexes or predator treatments)? For the first question, we will use what are called descriptive
statistics, while for the second question we will use inferential statistics. Each of these is explained
further below.
Descriptive Statistics
Just as the name implies, descriptive statistics describe our data. The most common descriptive
statistic, and one which hopefully you are all familiar with, is the mean (or the average, as it’s more
popularly called). The mean, or
X
, represents the ā€œmiddleā€ (or, it mathematical terms, the central
tendency) of the data, and is given by the formula:
ĀÆ
X=
āˆ‘
X
i
n
,
where the Xi’s are your individual data points (for example, your running speeds), and n is your sample
size (the total number of speeds measured). Two other measures of central tendency can be used, but are
less common than the mean. The mode represents the most common data class, while the median
represents the middle data point in the ordered data set. See the sample calculations page for details on
calculating the mean, median, and mode.
The other common set of descriptive statistics describe the degree to which the data are spread
out around the mean. For example, look at the data curves below:
Each of these could have the same mean, but their ā€œspreadnessā€ varies quite a bit. The most common
measures of spread are the variance, the standard deviation, and the standard error. The variance, or
s2, is given by the formula
s
2
=
āˆ‘
(X
i
āˆ’ĀÆ
X)
2
nāˆ’1
where all the symbols are the same as defined above for the mean. If you look at this formula closely,
you’ll note that it essentially describes the (squared) distance each data point is from the mean of those
data. The standard deviation, or s, is then simply the square root of the variance,
s=
√
s2
,
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Statistics and Hypothesis Testing - Lecture Notes | BIOL 4230 and more Study notes Zoology in PDF only on Docsity!

STATISTICS AND HYPOTHESIS TESTING

Like many other scientists, one of the things behaviorists do is conduct experiments and gather

data. Oftentimes, we collect data from two or more groups, and then want to compare these groups to see

if they differ. For instance, we might want to determine whether running speed differs between male and

female anoles, or if foraging in kangaroo rats differs when a predator is present or absent. To conduct the

first experiment, we could gather up a number of anoles, both males and females, run them down a track,

and record their maximum speed. We then have two similar, but distinct, questions we can ask. First, how

can we summarize the information we obtained by measuring running speed (or number of seeds obtained

by the kangaroo rats)? And second, how can we determine whether running speed differs between the two

groups (sexes or predator treatments)? For the first question, we will use what are called descriptive

statistics , while for the second question we will use inferential statistics. Each of these is explained

further below.

Descriptive Statistics

Just as the name implies, descriptive statistics describe our data. The most common descriptive

statistic, and one which hopefully you are all familiar with, is the mean (or the average , as it’s more

popularly called). The mean, or

X

, represents the ā€œmiddleā€ (or, it mathematical terms, the central

tendency ) of the data, and is given by the formula:

X =

āˆ‘

X

i

n

where the X i ’s are your individual data points (for example, your running speeds), and n is your sample

size (the total number of speeds measured). Two other measures of central tendency can be used, but are

less common than the mean. The mode represents the most common data class, while the median

represents the middle data point in the ordered data set. See the sample calculations page for details on

calculating the mean, median, and mode.

The other common set of descriptive statistics describe the degree to which the data are spread

out around the mean. For example, look at the data curves below:

Each of these could have the same mean, but their ā€œspreadnessā€ varies quite a bit. The most common

measures of spread are the variance , the standard deviation , and the standard error. The variance, or

s

2

, is given by the formula

s

2

āˆ‘

( X

i

X )

2

n āˆ’ 1

where all the symbols are the same as defined above for the mean. If you look at this formula closely,

you’ll note that it essentially describes the (squared) distance each data point is from the mean of those

data. The standard deviation, or s , is then simply the square root of the variance,

s =

√

s

2

and the standard error, or SE, is given by the square root of the variance divided by the sample size,

SE =

s

2

n

Note that most descriptive statistics can be calculated using a spreadsheet program such as Excel, or from

higher-end calculators using the

x

and  n- buttons.

Parameters versus Statistics

Before we leave the idea of descriptive statistics, you should know a little about an important

distinction in mathematics. You’ll notice that, in our running speed example above, we did not record

speeds for each and every anole of each sex. This would have been much too time-consuming and

difficult! Instead, what we did was take a sample of running speeds for each sex. We then calculated our

mean, variance, etc. from this sample. These values (the mean, variance, etc.) are called statistics because

they represent one estimate of the true values of the mean and variance. So that’s what statistics really

are…estimates of an unmeasured true value for a population. You can probably guess that, if we went and

raced a second sample of anoles, the values of the mean and variance would likely differ from what we

got for the first sample.

The true values for a population are called parameters , or parametric values , and are usually

represented by Greek letters; the mean by  (mu) and the variance by 

2

(sigma squared). We almost

never know the parametric values, but we assume that our statistics come reasonably close to these

parameters. In general, as long as we randomly sample our populations, and have a large enough sample

size, this assumption will hold. However, it’s always possible that we just happen to sample anoles that

are uncommonly fast (or uncommonly slow); if so, then our statistics will likely differ from the

parametric values.

Inferential Statistics and the Logic of Experimental Design

At the heart of all good science lies a question; in our example, we ask the question, does running

speed of anoles differ between males and females? Before we even collect data, we can come up with one

or more potential answers to this question. We call these potential answers hypotheses. The most basic

hypothesis in most studies suggests that there are no differences between our populations (that is, male

and female anoles run at equivalent speeds), and we call this the null hypothesis. As researchers we

typically hope to prove this hypothesis false, and so we can have the following two types of alternative

hypotheses : (1) the data sets are different from each other, but we don’t know the direction of the

difference (larger or smaller), or (2) the difference between the data sets is in a predicted direction (for

example, females > males; usually we need previous experiments to make this hypothesis).

If we somehow knew the parametric values, then it would be easy to determine if our populations

differed: for example, if average female speed was 25 cm/sec and average male speed was 35 cm/sec,

then we know these differ because we’ve raced every stupid anole, and 25 is not equal to 35!! However,

we haven’t raced every anole, so we have uncertainty in how close our statistics are to the parametric

values. This is where inferential statistics come in; they help us as researchers make objective decisions

about differences which might occur between two or more sets of data, or, to put it another way, they help

us answer the question, "are the differences we see real, or have they occurred simply by chance?".

Inferential statistical tests come in a wide variety of forms, but nearly all have the same

conceptual framework. We begin with our null hypothesis (male speed is equivalent to female speed, in

our example), and then collect data on running speed from both sexes to determine whether to accept or

reject this hypothesis. We then choose an appropriate statistical test; this may or may not be a simple

matter, but we’ll ignore those types of details for now. Many basic types of tests can be done using Excel

or other spreadsheets. Whatever we choose, the test will calculate a test statistic based on your data, for

example, a t -value for the t -test, or an F -value for analysis of variance, or an r -value for a correlation. You

(or more likely the computer program) will then compare your calculated test statistic to an expected, or

ā€œcut-off,ā€ value, and this will generate something called the probability, or P -value.

Now for the big question…what does all of the above mean!? To answer that, let’s first do a

Some Sample Statistical Calculations

Female Speed (cm/sec) Male Speed (cm/sec)

For the females only (you can do the males, if you’d like)…

  1. Mode: Look for the most common speed; in this case it is 38, which appears three times.
  2. Median: First, arrange the values from lowest to highest, which gives:

Now look for the number with an equal number of data points below it and above it in line. For this

dataset, that number is 38 (there are 7 speeds below and 7 above). If the sample size is an even number,

you have to take the average of the two numbers with equal data points above and below.

  1. Mean:

X =

cm/sec

  1. Variance:

s

2

2

2

2

2

2

2

  1. Standard Deviation:

s =

√

  1. Standard Error of the Mean:

SE =

√

  1. 43

15

= 2. 46

NOTE: Most of the rest of this lab handout is borrowed from Elizabeth A. Jakob and Marta J. Hersek, in

Learning the skills of Research: Animal Behavior Exercises in the Laboratory and Field. All material

copyrighted 2004 by the authors.

Choosing a Statistical Test

To determine which type of statistical test to use on a given set of data, we must first determine

whether or not the data fit a normal (bell-shaped) distribution. If so, we can use parametric statistical

tests. If the data are not normal, we must use non-parametric tests. Since many of the data collected in

animal behavior studies are not normally distributed, we will focus on nonparametric tests in this lab.

A flow chart to help you decide which tests to use is given in Figure 1, at the end of the handout.

Below are some useful definitions, and then a series of worked examples for a number of nonparametric

tests.

Here are some helpful terms:

ordinal data : numerical data, such as number of seconds, distance, or frequency of a behavior

categorical data : data that can be put into categories, such as alive/dead, or active/inactive

unpaired data : data points that are independent from each other, such as data generated by testing two

separate groups of animals

paired data : data points that are naturally paired in some way, most commonly because the same animal

was tested more than once. These data points should not be treated as independent from one another.

number of groups : the number of different test groups being compared

Test 1: Wilcoxon Ranked-Sums test

This test is used to determine the significance of differences between two sets of unpaired data. A

ranking system is used.

Example: You are interested in whether the movement rate of the protozoan Paramecium

caudatum is influenced by whether they are tested under dim or bright light. The null hypothesis is P.

caudatum has the same rate of movement under both conditions. You measure movement rate by counting

the number of squares in a counting chamber a Paramecium crosses every 10 seconds.

P. caudatum movement data (squares crossed per 10 sec)

NOTE: This is only a small sample of available tests. These were

chosen because they are easy to calculate.

NOTE: This is only a small sample of available tests. These were

chosen because they are easy to calculate.

Flight distance of snakes (in meters)

23°C Rank 25°C Rank 27°C Rank

R
= 22 R

2

= 37 R
  1. First order and rank the data, as described for the Wilcoxon ranked-sums test. When there are tied

scores, each score is given the mean of the ranks for which it is tied. Compute the sum of the ranks for

each group, symbolized by R. R 1

is the sum of the ranks of group 1, etc.

  1. Now compute the test statistic, H , using the following formula:

H =

N ( N + 1 )

[

āˆ‘

R

i

2

n

i

]

āˆ’ 3 ( N + 1 )

In this formula, the  is a summation sign, and indicates that you should sum up each is a summation sign, and indicates that you should sum up each R

2

value, from R 1

to R 3

. Plugging in the appropriate numbers for R , N (the total number of observations), and n i

(the

number of observations in each group):

H =

12

14 ( 14 + 1 )

[

( 22 )

5

2

( 37 )

2

5

( 46 )

2

4

]

āˆ’ 3 ( 14 + 1 )= 6. 4

If you have a large number of ties, use the correction for ties. Compute H as above, then divide by

āˆ‘

( t

3

āˆ’ t )

N

3

āˆ’ N

where t = the number of observations in a tied group of scores and N = the total number of all

observations

  1. Compare your test statistic with Table 2. The df column corresponds to the degrees of freedom for this

test. Degrees of freedom is a number that results from the way the data are organized, and refers to

whether the observations are free to vary. For example, if all of 50 observations must fall into 2

categories, as soon as we know that one category holds 41 data points, then the other category holds 9.

For every statistical test, there are established methods for determining degrees of freedom. For the

Kruskal-Wallis test, we have:

df = (# of groups) – 1.

In our example, df = 3-1 =2. The test statistic must be higher than the critical value to be significant. H , at

6.4, is greater than 5.99, so you may reject the null hypothesis at P < .05. The three groups do differ.

Test 3: Sign test

The sign test is used for two-groups when the data are paired. In this test, only the signs of the

differences are used. Another non-parametric test, the Wilcoxon matched-pairs signed rank test, is more

powerful because it uses both the signs and the magnitude of the differences.

Example : You imagine that male mice might benefit from avoiding inbreeding, or mating with close

relatives. Because mice depend on odor for a great deal of their information about the world, you decide

to present males with soiled litter from the cages of females. You test each male twice: once with litter

from his sister, and once with litter from a stranger. The females are sexually receptive so the soiled litter

should be rich in chemical cues. You present the litter in random order so that half the males get their

sibling’s litter first, and half get the stranger’s litter first. Since the same males are tested twice, a Mann-

Whitney U test is inappropriate. Null hypothesis: The number of sniffs per minute will be the same when

males are exposed to the litter of their sisters vs. that of strangers.

Male ID

Number

Number of Sniffs/Min

with Sister’s Litter

Number of Sniffs/Min with

Stranger’s Litter

Sign of the Difference

  1. Subtract one data column from the other to determine the sign of the difference. (It doesn’t matter

which you subtract from which, just be consistent.)

  1. Note the most frequent sign. In this case, the most frequent sign is ā€œ+ā€œ (positive), and there are 11. The

test statistic therefore equals 11.

  1. Determine N , the number of pairs which showed a difference. Here we disregard male #11, so N = 13.
  2. Look at Table 3 for N = 13. Note the critical value at the 95% level. In this test, the test statistic must

be equal to or greater than the critical value. In this example, we can reject the null hypothesis at P = 0.05.

Test 4: Wilcoxon’s Signed-Ranks Test

As with the sign test, this is used for paired data.

Example : Juvenile scorpions may climb vegetation when in the presence of an adult. We placed juvenile

variable) and how it responds (the second variable). Note: if instead of making categories of ā€œclimbā€ and

ā€œnot climbā€, the experimenter had measured the distance each snail moved, the chi-square test would be

inappropriate.

  1. Make a table of observed frequencies , the data actually collected in the experiment.

Observed frequencies:

Source of Test Water

Behavior Control Sea urchin Predator Row totals

Climb 12 14 24 50

Not climb 28 23 15 66

Column totals 40 37 39 Grand total = 116

Note: The grand total of the rows should equal the grand total of the columns.

  1. Calculate and tabulate the expected frequency for each category (that is, the frequency expected in each

category if there is no relationship between the variables):

column total x row total

grand total

Expected frequencies:

Source of Test Water

Behavior Control Sea urchin Predator Row totals

Climb 17.2 16 16.8 50

Not climb 22.8 21 22.2 66

Column totals 40 37 39 Grand total = 116

  1. Calculate the value of chi-square (

2

c

2

āˆ‘

( O āˆ’ E )

E

2

where O = the observed frequency in each cell, and E = the expected frequency in each cell:

2

2

2

2

2

2

2

  1. Examine the table of critical values for this test (Table 2). For the chi-square test, the degrees of

freedom formula is:

df = (# rows - 1) * (# columns - 1) = (2-1) * (3-1) = 2

We compare the test statistic to the critical value: if it is bigger, we reject the null hypothesis. The

calculated 

2

is 8.62, which is greater than 5.99. The three groups of snails moved differently.

A second type of chi-square test is called the chi-square goodness-of-fit test. In this case, the

experimenter tests to see how the data match expected values that were determined before the test was

run. For example, in Mendelian genetics, we can predict the outcome of different crosses; the ratio of the

different types of offspring is known in advance. In this case, we compare the observed values from the

experiment with the expected values, generated by theory. The calculations are performed in exactly the

same way as for the chi-square test of independence.

Test 6: The binomial test

This test is useful for categorical data where we have only two categories, and when we are

interested in testing whether the data are equally likely to fall into either category.

Example : You’ve been using a coin to randomly assign treatments to your experimental animals, but you

are beginning to suspect that the coin is not fair, and you decide you’d better test this. The null hypothesis

is: the coin is equally likely to come up tails as heads.

  1. Flip the coin 11 times. Nine times it comes up heads, and twice it comes up tails.
  2. Using Table 5, locate the value for N (in this case, 11) along the left side. Compare your smallest

number (in this case 2, which is the number of tails) to the smaller of the two numbers in the ā€œ2-tailed

test,  = 0.05 column.ā€ If your number is equal to or less than this table value, the result is significant.

Since 2 > 1, we cannot reject the null hypothesis, and so we must assume the coin is fair.

individuals. This time you watch until they see a dance and accept food, and again measure how long it

takes them to reach the resource.

Here are your data. The numbers are seconds needed for the bee to reach the resource.

Bee # Watch Only Watch and Accept Food

(A) What sort of data are these? Which test should you choose?

(B) What is the test statistic? The table statistic?

(C) You decide that a bee that has both watched and gotten food from another bee finds the resource faster

than one that has just watched. What other factor that is a result of your experimental protocol might also

explain your results?

Type of

data?

Chi-square goodness of fit

Chi-square test of

independence

Binomial test

Categorical

e.g., left/right,

large/small

Ordinal

e.g., 1,

Number

of groups?

Are data

paired?

Sign test

Wilcoxon matched-

pairs signed-rank

test

Paired t-test

(parametric)

Mann-Whitney U test

(nonparametric)

T-test (parametric)

No

Figure 1. A flow chart to aid in deciding which statistical test is appropriate. Only

common tests are included.

Yes

Kruskal-Wallis test

(nonparametric)

ANOVA

(parametric)