Biometry Manual 2009

87
6 BIOMETRY Lecture 1 Descriptive Statistics Section Objectives: At the end of this section, students should be able to: 1. Define basic descriptive statistics as it relates to biometry 2. Distinguish between the different scales of measurement 3. Calculate basic descriptive statistics parameters 4. Distinguish between sample and population parameters 5. Use basic descriptive statistics parameters to summarize a dataset What is biometry? Need for information from biological data Analysis of biological data Biological data + Statistical methods = Biometry What are statistics? Statistics are like a bikini; what they reveal is suggestive and what they conceal is vital. Statistics are estimates of population parameters and are subject to sampling errors Two classes of statistics Descriptive statistics describe the characteristics of a group of data Inferential statistics test differences in the distribution of groups of data i.e. Hypothesis testing. Scales of measurement 1. Nominal or Categorical: Arbitrary names numbers or symbols e.g. apples, oranges, bananas Data in this form can be used to answer the questions of “how many?” or “how frequent?” Quantification of nominal data results in categorical data e.g. Table 1 Table 1. An example of categorical data APPLES ORANGES BANANAS 50 20 30

Transcript of Biometry Manual 2009

Page 1: Biometry Manual 2009

6

BIOMETRY Lecture 1

Descriptive Statistics

Section Objectives: At the end of this section, students should be able to:

1. Define basic descriptive statistics as it relates to biometry 2. Distinguish between the different scales of measurement 3. Calculate basic descriptive statistics parameters 4. Distinguish between sample and population parameters 5. Use basic descriptive statistics parameters to summarize a dataset

What is biometry?

• Need for information from biological data • Analysis of biological data • Biological data + Statistical methods = Biometry

What are statistics?

• Statistics are like a bikini; what they reveal is suggestive and what they conceal is vital. • Statistics are estimates of population parameters and are subject to sampling errors • Two classes of statistics

• Descriptive statistics – describe the characteristics of a group of data • Inferential statistics – test differences in the distribution of groups of data i.e. Hypothesis

testing. Scales of measurement

1. Nominal or Categorical: • Arbitrary names numbers or symbols e.g. apples, oranges, bananas • Data in this form can be used to answer the questions of “how many?” or “how frequent?” • Quantification of nominal data results in categorical data e.g. Table 1

Table 1. An example of categorical data

APPLES ORANGES BANANAS

50 20 30

Page 2: Biometry Manual 2009

7

2. Ordinal or Ranking:

• Named categories ranked in terms of some relationship they have to each other e.g. small, medium, large.

3. Interval: • Continuous data points taken along a scale that, at least theoretically could be subdivided i.e. no

true zero point e.g. time, temperature 4. Ratio

• Same as interval scale, but has a true zero point e.g. units of measure POINT TO NOTE:

• The first scale of measurement is qualitative whereas the latter 3 are quantitative. Basic Descriptive Statistics:

• Consists of 2 main components 1. Measures of central tendency or location i.e. mean, mode and median 2. Measures of dispersion or variability i.e. range, mean deviation, variance, standard deviation,

coefficient of variation, standard error, and confidence interval. Other Descriptive Statistics parameters

• Minimum or lowest value • Maximum or highest value • Skewness (measure of the width of a normal distribution curve) • Kurtosis (measure of the height of a normal distribution curve)

Often forgotten descriptive statistics

• Graphs, charts and other illustrations. • Basically any other method used to organize and display data collected

Measures of Central Tendency:

• Mean (average of observations) – Describes group characteristics well but is sensitive to extremes

• The arithmetic mean (average) is denoted as X (pronounced X bar) if calculated for sample data

• The arithmetic mean is also denoted by (called mu) if calculated for the population data

• Mean = iX

n E.g. iX = 10 + 4 + 5 + 9 = 28

• Mean = (28/ 4) = 7

Page 3: Biometry Manual 2009

8

• Median (mid observation in ordered set) – Not as sensitive to extremes as the mean but it ignores useful information

• The median is the value of the middle term in a dataset that has been ranked in increasing order • E.g. 3, 3, 5, 6, 7, 7, 8, 9, 100 where n = 9 • If n is odd – median is the ((n+1)/2)th observation (7 in this example) • If n is even – median is midway between the (n/2)th and the ((n/2)+1)th observation • The advantage of using the median over the mean is that the median is not influenced by outliers • E.g. in the above example , 100 is an outlier and hence the mean would have been 16.44

• Mode (most frequently occurring) – Describes individual characteristics well – Data may be unimodal, bimodal, trimodal etc.

• The mode is a french word meaning fashion - an item that is most popular or most common. • Hence in our case it represents the most common observation in the dataset or the value that

occurs with the highest frequency in the dataset • E.g. speeds for cars given speeding tickets (kph 100, 160, 140, 160, 119, 160) • Since 160 occurs 3 times and all other values once, then 160 is the mode Measures of Dispersion or variability: • Range • Mean deviation

• Variance ( 2s ) • Standard deviation (SD or s) • Coefficient of variation (CV) • Standard error of the mean (SE) • Confidence Interval (CI) The range • Simplest measure of dispersion to calculate. • Range = Largest value – Smallest value • E.g. 20, 25, 30, 50, 70 • Range = 70 – 20 = 50 • Disadvantage is that the range is also influenced by outliers e.g. if dataset contained the value 200,

then the range would be 200 – 20 = 180 • Another disadvantage: only 2 values (observations used in it calculation) • Poor measure of dispersion when outliers are present

Page 4: Biometry Manual 2009

9

Mean deviation

• Sum of all the “absolute values” of deviations from the mean • Summing all the deviations will equal zero.

• Mean deviation = | X i - X | /n

• Not to be confused with the variance (below)

Variance ( 2s )

• The averaged squared deviations from the mean, 2s =

2

1

ix x

n

where

2

ix x , sum of squared deviations (SS)

(n – 1), degrees of freedom of the variance (df) – df is the number of values that can vary independently given a particular mean

– A better estimate of the population parameter ( 2 ) is provided by dividing by df (instead of n)

The variance can also be calculated using the „machine formula‟ 2

2

2

( )

1

xx

nsn

where

2x = Sum of the squared values of X

2

x = The square of the sum of the X values

This formula is easier to calculate and avoids rounding-off errors which can occur in the previous formula. Standard Deviation (s)

• This is the most used measure of dispersion • SD (s) tells how closely the values of a dataset are clustered around the mean. • Low SD values indicate the values are spread over a small range around the mean • In contrast high SD values indicate that the data values are spead over a large area around the

mean • SD is calculated by using the positive square root of the variance

Page 5: Biometry Manual 2009

10

• Remember that

2

2

2

( )

1

xx

nsn

• Therefore s= 2s = 1n

n

)X(X

1n

)xX(s

22

2

i

• • Rule : Never quote the mean without stating the standard deviation • E.g. mean 12 + 3 implies a mean of 12 with a SD of 3. • This means that for a normal distribution, the mean can fall anywhere between 12+3= 15 and 12 –

3= 9 with a high level of probability • This range 9-15 is known as an interval estimate for the mean or + 1 SD

Standard Error (of the mean) (SE)

• equation: SD

SEn

• smaller value than SD • less often used

Confidence Interval

• percent confidence that the mean lies within a given range about the mean • usually set at 95% • the smaller the variance, the smaller the CI • CI gets smaller as variance gets smaller

Other descriptive statistics:

• Minimum (Lowest value) • Maximum (Highest value) • Skewness, Kurtosis

Summary

• X (sample mean)

estimates (population mean)

• 2s (sample variance)

estimates 2 (population variance) • s (sample standard deviation)

estimates (population standard deviation)

Page 6: Biometry Manual 2009

11

Lecture 2

Graphical Presentation of Data

Section Objectives: At the end of this section, students should be able to:

1. Summarize ecological data using various graphical methods 2. Apply proper techniques for designing and drawing graphs 3. Determine the suitability of various graphical methods to ecological data 4. Understand the importance of data types and data quality to graphical presentation of data 5. Understand how the scales of measurements relate to graphical data plots.

Why use graphs?

• Illustrations communicate trends more effectively and more efficiently than tables • “A picture paints a thousand words” • A graphic display can reveal at a glance the main characteristics of a data set • Both qualitative and quantitative data can be graphed using different methods (e.g. pie charts and

frequency distributions When to use graphs

• If data are too sparse, DO NOT Graph e.g. Total no. of patients, avg. no. of infections, avg. no. of days in the hospital

• In the above case, data is easier to describe in words and takes up less space • If data show pronounced trends, USE a graph • If data do not show pronounced trends, use a TABLE • DO NOT use both a graph and a table – Redundancy should be avoided • If exact values are important, they can be included in a graph • If the graph is too cluttered with exact values, it might be best to use a table instead

Types of Graphs:

1. The scatterplot or bivariate plot • Scatterplots are used to validate “hunches” about cause (independent - x axis) and effect

(dependent – y axis) variables • e.g. Do higher income households spend more money on food? I wonder if UWI students who

spend more time liming in the bar have higher or lower GPAs

Page 7: Biometry Manual 2009

12

2. The box and whisker plot • The mean is represented by the horizontal line

Income Food Expenditure

35 9

49 15

21 7

39 11

15 5

28 8

25 9

Page 8: Biometry Manual 2009

13

• The range is represented by the vertical line • The standard deviation is represented by the open box • Box and Whisker plots are therefore helpful in interpreting the distribution of data

DESCRIPTIVE STATISTICS VARIABLE N MEAN SD MINIMUM MAXIMUM MATH1 10 80.500 12.122 65.000 100.00 MATH2 10 59.900 20.113 23.000 90.000

3. Line Graphs

• Data should be continuous • Points may be used in conjunction to represent the actual data • Points are connected by lines • They are good at showing specific values of data, meaning that given one variable the

other can easily be determined • They show trends in data clearly, i.e. they visibly show how one variable is affected by the

other as it increases or decreases

0

5

10

15

20

25

30

35

40

45

0 2 4 6 8

Temp/ F

Page 9: Biometry Manual 2009

14

4. Bar graphs a. Histograms

• A graph that is drawn for a frequency distribution or percentage distribution • Classes are indicated on the horizontal or x-axis and frequencies on the y-axis • A Bar is drawn for each class so that its height repesents the frequency of that class • Bars in a histogram are adjacent with no gaps between them

Distribution of salaries of the British Gas Corporation

b. Regular Bar Graph

• A graph made of bars whose heights represent the frequencies of respective categories is called a bar graph or bar chart

• To construct a bar graph, the various categories are marked on the horizontal or x-axis • Frequencies are indicated on the vertical or y-axis

Page 10: Biometry Manual 2009

15

• One bar is drawn for each category such that the height of the bar represents the frequency of the corresponding category

• NOTE: A small gap is left between adjacent bars

Regular Bar Graph with error bars

Page 11: Biometry Manual 2009

16

c. Clustered Bar Graph • A direct comparision of two or three Y variables • Useful for visual comparison of limited data • A legend should be included in order to distinguish between Y variables being represented

d. Stacked Bar Graph • Usually for comparing percentages of several Y variables

Page 12: Biometry Manual 2009

17

5. Pie Charts

• Used for comparing percentages between several variables • By definition a pie chart is a circle divided into portions that represent the relative

frequencies or percentages of a population or a sample belonging to different categories • To construct a pie chart, multiply 360 degrees by the relative frequency of each category to

obtain the size of the angle

Stress on the Job

Relative Freq. Angle Size

Very 0.333 360 (0.333)= 119.88

Somewhat 0.467 360 (0.467)= 168.12

None 0.2 360 (0.2)= 72

Sum = 1.000 Sum = 360

Job Stress

0.333; 33%

0.467; 47%

0.2; 20%

Very

Somewhat

None

Page 13: Biometry Manual 2009

18

6. Cluster graph

• A cluster graph is defined in this case as a graph that examines the degree of relatedness among several variables

7. Double Y graph

• Used when scales differ dramatically for two Y variables • This allows the Y axis scales for each variable to vary, while the x axis scale remains the

same

The Effect of Light Intensity on Soil Temperature Along a Transect

18

19

20

21

22

23

24

25

26

0 5 10 15 20 25 30

Meters Along Transect

Tem

pera

ture

°C

300

350

400

450

500

550

600

650

Lig

ht

Inte

nsit

y (

foo

t can

dle

s)

Soil Temperature (°C) Light Intensity (foot candles)

A

B

D

E

C

o.5 01.0

Page 14: Biometry Manual 2009

19

Size and Arrangement of Graphs Axes

• Do not extend graphs far beyond what the data require e.g. if highest value is 76 – no need to go to 100

• Extending too far leaves large blank spaces • Breaks may be inserted into axes to include outliers

Tick marks

• Too few make data difficult to quantitatively estimate data • Too many can clutter a graph • Not all tick marks need to be numbered • Ticks should be on the outside of a graph • Ticks on the right side of a graph may be helpful

Axis labels

• Both axes should always be labeled • Y axis should always be labelled vertically • Units of measure should be included in the graph

Data points

• Symbols: Use contrasting symbols for scatter plots. Symbols should be of appropriate size • Patterns: Use contrasting patterns for histograms- patterns should not be too fine- plan for

reduction • Lines: Use contrasting lines e.g. solid, dashed, dotted

Legends

• Insert within graph if space is available • May also be inserted above or below the graph • Symbols, lines or patterns should clearly indicate data

Reductions

• Graphs are normally reduced for publication • Size of the journal must be considered and planned for

Alignment of multiple graphs

• Best to align two or more graphs vertically than horizontally

Page 15: Biometry Manual 2009

20

Figure numbers

• Should not be placed on graphs • Multiple graphs should be labeled A, B, C etc.

Captions

• Should be self- explanatory and concise Construction of Graphs

• Formally done by hand using rulers and stencils • Now computerized graph packages available e.g. Spreadsheets – Lotus, Supercalc, Excel • Statistical packages – SPSS, SYSTAT, STATISTIX • Graphics programs include Harvard Graphics, Cricket Graph • Draw programs include Designer, Corel Draw, Paint Shop Pro • Best to construct graph with a graphics program and import into a draw program for further editing

Summary

• Descriptive statistics includes measures of central tendency, measures of variability as well as graphical methods

• All descriptive statistics are very useful for efficiently summarizing data • Each descriptive statistic method has both advantages and disadvantages • Before attempting to apply descriptive statistics, data quality and scales of measurement should be

carefully examined in order to determine suitability of the test or graph.

Page 16: Biometry Manual 2009

21

Lecture 3

Inferential Statistics and Probability Section objectives: At the end of this section, students should be able to:

1. Distinguish between descriptive and inferential statistics 2. Define Null and alternative hypotheses 3. Understand how hypotheses are integrated into inferential statistics 4. Relate the probability theory to inferential statistics 5. Understand the requirements of inferential statistical tests 6. Define type I and type II errors

Inferential Statistics:

• Test for differences in the characteristics between groups of data or tests for strength of relationships between variables

• Techniques allow us to assess the degree of uncertainty associated with our inferences using probability theory

Hypotheses

• Hypotheses are possible explanations for observed phenomena • Predictions can be made and tested on the basis of hypotheses • Hypotheses and predictions can be evaluated using statistical tools • “Science marches on one funeral at a time” (Science advances by the rejection of hypotheses) • If we wish to determine whether two or more groups are the same or different

• We need to formulate a Null Hypothesis ( 0H )

• Always stated: No difference between 2 groups

• 0H : A = B (A and B are population parameters such as the population mean µ)

• This hypothesis may be rejected or provisionally accepted • An alternative hypothesis should also be formulated

• e.g. 1H : A ≠ B

• If we reject 0H , then we accept 1H

Requirements of Inferential Statistics

• Carefully defined population(s) - improves the accuracy of our estimate of the population parameter

• Samples must be drawn at random from population

Page 17: Biometry Manual 2009

22

- equal probability of selecting any individual or area - sample is representative of the population

• Independent samples - Independence means that the probability of one event occurring should not be affected by whether another event has or has not occurred - That is, choice of any individual or area being sampled is not influenced by choice of another individual or area being sampled

• These are not independent examples: - paired samples – samples from the same individual or area before and after some treatment or event - genetically related individuals are not independent

• Determination of the probability (p) that 0H is true, e.g. the 2 groups are the same

• The use of Probability Theory Probability Theory

• The probability of an event occurring is its frequency of occurrence in a long series of trials • Probabilities are calculated by the number of occurrences of a defined event divided by the number

of trials • The larger the number of trials the more precise our estimate of probability • For example: An unbiased coin will land either „heads‟ or „tails‟

No. throws 10 25 50 100

No. „heads‟ 7 16 29 54

Proportional frequency of „heads‟

0.7 0.64 0.58 0.54

• The proportional frequency of obtaining „tails‟ is 1- (proportional frequency of obtaining „heads‟) • Probabilities are numbers between 0 and 1 • If probability = 0, an event is impossible • If probability = 1, an event is certain to happen • For the coin example above, the probability of obtaining „heads‟ is 0.5 or there is a 50:50 chance of

obtaining either „heads‟ or „tails‟ We may also express probability as a percentage • What is the probability that 2 groups are the same? • p = 1.0 : probability is 100% that they are the same or 0% that they are different • p = 0.05 : probability is 5% that they are the same or 95% that they are different • p = 0.001 : probability is 0.1% that they are the same or 99.9% that they are different

Page 18: Biometry Manual 2009

23

Probability and Statistics

• Probability underlies all statistical methods

• What is the probability that our Null Hypothesis ( 0H ) is true?

• For example: Are there differences between 2 groups?

• 0H : A = B (where A and B are population parameters such as the population mean µ)

• 1H : A ≠ B

• We calculate a test statistic that determines the probability that 0H is true

• The test statistics used may be chi-square ( 2), t, U, F, H, etc. depending on the appropriate test to be used

Significance levels

• The significance level [alpha ( ) level] is the p level at which the null hypothesis is rejected

• = 0.05 is the level of p that is generally used in science

• If calculated p > 0.05, then we provisionally accept 0H (any observed differences are due to

sampling error alone)

• If calculated p < or = 0.05, then we reject 0H at = 0.05 (there are significant differences) and

provisionally accept 1H

• If p < or = 0.01, then we strongly reject 0H

Types of Errors

• Statistical tests will occasionally reject a null hypothesis that is true (Type I error) or • Accept (Fail to reject) a null hypothesis that is false (Type II error) • The accepted probability of errors occurring is 5% i.e. the tests will make a mistake 1 out of 20

times.

0H is True 0H is False

If 0H is rejected Type I error No error

If 0H is accepted No error Type II error

Page 19: Biometry Manual 2009

24

A generalized inferential statistical test procedure

• Formulate Null and Alternate hypotheses

• Calculate a statistic (may be 2, t, U, F, Z, H, etc.) for the appropriate test using the appropriate formula

• Determine the probability of obtaining the calculated value of that statistic from the appropriate statistical tables

• Decide whether to provisionally accept or reject the Null Hypothesis based on = 0.05 • State your conclusion in terms of the hypothesis you tested, i.e. „There is no difference between

fish lengths from Ponds A and B.‟ Summary

• Probability is the chance of occurrence of an independent event • Statistical tests are built around probability functions • Inferential statistics have several underpinning requirements that are essential for accurate

analysis of data • Statistical errors (Type I and II) occur when the requirements of a particular statistical test are not

met • The steps in the inferential statistical test procedure should be carefully followed in order to achieve

efficient and accurate results.

Page 20: Biometry Manual 2009

25

Lecture 4 Analysis of Frequency Data

Section objectives: At the end of this section, students should be able to: 1. Understand frequency data and the nominal (categorical) scale of measurement 2. Define the term “variates” 3. Compare “goodness-of-fit” tests and “tests of association” 4. Set up contingency tables 5. Apply the above Chi-squared tests to frequency data 6. Understand the limitations of Chi-squared tests Testing frequency data:

• Uses data on the nominal or categorical scale (qualitative scale) • Counts are made of the number of cases in each category or class e.g. how many of a given

colour? • Classification can be based on one or more criteria or variates (variables, samples or

treatments) • Example: Gender - Male, Female • Example: Species 1 (present, absent) and Species 2 (present, absent) • Example: Treatment A (survived, died) and Treatment B (survived, died)

Questions:

• Do the observed numbers in each category conform to a specified ratio? • Is there an association between variates?

Use the Chi-Square ( ) Test

• Ratio goodness-of-fit test • Test of association

• We must use raw counts not proportions, percentages, interval or ratio data • We compare observed counts with those expected by chance or on some theoretical basis

Page 21: Biometry Manual 2009

26

Ratio goodness-of-fit test

Example: One-sample chi-square ( 2) test

• 1 classification criterion, e.g. gender, with 2 or more categories, e.g. male, female • 1 classification criterion, e.g. flower colour, with more than 2 categories, e.g. yellow, pink, white • Obtain data of counts for each category • The test compares the frequency in each category with that expected from theoretical

considerations (a fixed ratio is hypothesized) • H0: There is no difference in frequencies (between observed and expected) • Do women outnumber men in a classroom? • Data: Men (13), Women (27) • From biological considerations we expect 50% men & 50% women • H0: There is no difference in frequencies between observed & expected • H1: There is a difference in frequencies between observed & expected

• Pearson‟s

2

O E

E

• O (Observed counts), E (Expected counts

Observed Expected O – E (O – E)2 / E

13 20 –7 2.45

27 20 7 2.45

2

O E

E = 4.90

• What is the probability of observing of 4.90 if our Null hypothesis is true? (Go to Table)

• Degrees of freedom (df) = (2 – 1) = 1 for 2 classes

Page 22: Biometry Manual 2009

27

Using the Chi-squared table

Probability (p) that H0 is true

0.9 - - - - - - - - - - - - - - - 0.1 0.05 - - - - 0.001

0.02 2.71 3.84 10.83

0.21 4.60 5.99 13.82

0.58 6.25 7.82 16.27

1.06 7.78 9.49 18.47

Accept H0 Reject H0

No significant differences between frequencies Significant differences

Test of association:

• Two or more classification criteria (variates) • Variates are classified (into categories or classes) and counts are obtained in each category • Data arranged in rows & columns (called contingency tables) • The test compares the frequency in each category with that expected on the basis that there is

no association between variates

• 0H : There is no association

Example

• Are two plant species (A, B) associated • H0: There is no association • Data (sites): both species present (34), only species A (36), only species B (6), both species

absent (24) • Total number of observations, N = 100 • Arrange data as (2 × 2) contingency table

Species B

Species A

Present Absent Totals

Present (Exp)

34 (28)

36 (42)

70

Absent (Exp)

6 (12)

24 (18)

30

Totals 40 60 100 (N)

Page 23: Biometry Manual 2009

28

Expected values = (column total × row total) / N

Two-Sample 2 Test – Example

Observed Expected O – E (O – E)2 / E

34 28 6 1.28

36 42 – 6 0.86

6 12 – 6 3.00

24 18 6 2.00

2 = { (O – E)2 / E } = 7.14

What is the probability of observing

2 = 7.14 (if H0 is true)? Degrees of freedom (df)

df = (rows – 1)(columns – 1) = 1

From 2 Table, P < 0.05, we reject H0 Conclusion:

The two species are associated (they are not independently dispersed) Yates correction:

• For goodness of fit tests with 2 categories we must apply Yates correction

2

0.5O E

ECorrected for continuity ( has continuous probability but our data

are discontinuous) • If any category has an expected value < 5 and there are > 2 categories, combine (pool)

categories until all have expected values > 5 Yates Chi-Squared

• For 2 × 2 contingency tables only, we can use a shortcut (called Yates Chi-square) • Corrected for continuity

Page 24: Biometry Manual 2009

29

2

2

NN AD BC

(N = A + B + C + D)

Limitations:

1. For 2x2 tests • if N < 20, use Fisher exact test

if smallest expected frequency is less than 5, use Fisher exact test

2. For other 2 sample tests • if > 20% of cells have an expected frequency of < 5, and if any cell has an expected

frequency of < 1, test cannot be used

Limitations can be met by collapsing the cells Fisher exact test

• use for small samples • need to use a table or a computer

Question: Are mortality and survival rates associated with species (A, B or C) when they are treated with a certain insecticide?

• 0H : There is no association between 2 variates (species & mortality)

• 1H : There is an association between 2 variates (species & mortality)

Data: 27 individuals of Species A treated, 12 survived, 15 died; 30 Species B treated, 18 survived, 12 died; 33 Species C treated, 17 survived, 16 died Total number of observations, N = 90 Steps:

A B

C D

Page 25: Biometry Manual 2009

30

• Arrange data as (2 × 3) contingency table

2 × 3 contingency Table

Outcome of treatment

Species

A B C Totals

Survived 12 18 17 47

Died 15 12 16 43

Totals 27 30 33 90

• Work out the expected values • Expected values = (column total × row total) / N

Observed Expected O – E 2

O E

2

O E

E

12 14.1 -2.1 4.41 0.31

18 15.7 2.3 5.29 0.34

17 17.2 -0.2 0.04 0.00

15 12.9 2.1 4.41 0.34

12 14.3 -2.3 5.29 0.37

16 15.8 0.2 0.04 0.00

2

O E

E = 1.36

Page 26: Biometry Manual 2009

31

• What is the probability of observing

• = 1.36 (if H0 is true)?

• Degrees of freedom (df) • df = (rows – 1)(columns – 1) = (2-1)(3-1) = 2

• From Table, 2

0.05,2 = 5.99

• p > 0.05, we Fail to reject (accept) H0 • Conclusion: There are no significant differences in mortality rates among the 3 species or there is

no significant association between mortality rates and species when treated with the insecticide.

Multi-way contingency tables

• e.g., 2 X 2 X 2; 3 X 2 X 3 etc. • use log-linear models • very complex, difficult to do and difficult to interpret • always try to avoid this kind of data

Summary:

• Frequency data (counts) are measured on a qualitative scale • Contingency tables best summarize frequency data • Frequency data can also be summarized using graphs • Chi-squared tests measure the differences between observed and expected frequencies in order to

test differences between or among datasets. • Chi-squared tests are faced with several limitations including small sample size (N<20) and small

expected frequencies ( <5)

Page 27: Biometry Manual 2009

32

Lecture 5

Parametric vs Non-parametric Tests Section objectives: At the end of this section, students should be able to:

1. Define parametric and non-parametric tests 2. Understand the assumptions of parametric and non-parametric tests 3. Understand what is meant by a normal distribution 4. Test for normality in data and homogeneity of variances 5. Apply the appropriate type of test to a particular dataset

Classes of inferential statistics:

• Parametric (compares parameters such as means, variances, etc.) • Non-parametric (compares entire data sets) • Certain tests make assumptions that must hold true • Important features of the data to note include: • The number of data points or sample size • The type of data whether nominal, ordinal, interval or ratio • Whether the shape of the frequency distribution is normal (bell-shaped) when the points are plotted

(f(X) vs. X)

Test assumptions:

• Parametric tests assume • Large sample sizes (large n), e.g. >30 measurements • Interval or ratio data • Data must fit a Normal frequency distribution • Assumes that variances for each group of data are equal (homogeneity of variances) or the

appropriate form of the test is used if they are not • Before any statistical test can be applied, the nature of the data must be scrutinised • If your data do not fit these assumptions, then a Non-parametric test might be more appropriate

Page 28: Biometry Manual 2009

33

The Normal Distribution:

Properties of the Normal Frequency distribution:

• bell-shaped curve (X values clustered about the mean) • symmetrical about the mean • Mean = Mode • Shown for many biological characteristics which are influenced by many factors (environmental,

genetic) • Central Limit theorem - tendency for distribution to approach Normal as sample size (n) increases;

variance decreases as n increases.

f(X)

X

Page 29: Biometry Manual 2009

34

Normality and Transformations: For a normal distribution (tests of normality)

• Skewness coefficient between –1 and +1 • Kurtosis coefficient between –1 and +1

Data Transformations:

• Transforming the data may normalize the distribution e.g. square root, square, log, etc. • Statistical tests are done on the transformed data • Use non-parametric tests if transformations fail to normalize the data

f(X)

f(X)

X

68% of values fall in the range mean ± 1 SD

SD SD

2 SD 2 SD

95% of values fall in the range mean ± 2 SD

x

Page 30: Biometry Manual 2009

35

Skewness (lack of symmetry)

7

f(X)

X

f(X)

X

Negatively

skewed

(non-Normal)

Positively

skewed

(non-Normal)

ModeMean

ModeMean

Kurtosis (height of Bell)

8

f(X)

X

f(X)

X

Negatively

kurtosed

(non-Normal)

Flat

PeakedPositively

kurtosed

(non-Normal)

Page 31: Biometry Manual 2009

36

Test for Homogeneity of variances:

Variance-ratio test or F-test • Used to test for differences in variances between two samples of interval or ratio data

• 0H : There is no difference between variances

• 1H : There is a difference between variances

Formula:

• 2

1

2

2

SF

S

• Where 2

1S is the greater of the two variances (F is always ≥ 1)

• 2

1S is the numerator, 2

2S is the denominator

• Number of observations: 1n for numerator,

2n for denominator

• Degrees of freedom: (1n -1) numerator, (

2n -1) denominator

Parametric vs Non-parametric tests: Parametric tests

• Makes certain restrictive assumptions about the nature of the data (sample size, data type, homogeneity of variances, normal frequency distribution)

• In many cases, ecological data do not meet these assumptions • Parametric tests extract more information from the sample and should be used if possible

• Greater probability of rejecting a false 0H

Non-parametric tests

• No assumptions needed regarding the frequency distribution of the data or homogeneity of variances or sample size

• Can use ordinal, interval or ratio data • Most parametric tests have an equivalent or analogous non-parametric test • Quick & easy to use (calculations usually involve ordering data or attaching signs) • Data collection is easier (counts, ranking or attaching signs), e.g. behavioural studies

Page 32: Biometry Manual 2009

37

Summary:

• Parametric tests compare means, variances etc. among datasets • Non-parametric tests compare entire datasets through ranking of data • Parametric tests relies on specific assumptions in the data e.g. normal distribution, equal variances • Non-parametric tests are distribution-free tests • Errors can occur if these assumption are not met • Skewness and kurtosis coefficients can be used to check for normality within the datasets • Variances can be compared using an F-test • The statistical power of any test (parametric or non-parametric depends heavily on data type and

quality

Page 33: Biometry Manual 2009

38

Lecture 6

Analysis of two groups: Independent Samples

Section objectives: At the end of this section, students should be able to:

1. Understand the concept of independent samples 2. Decide whether to use a parametric or non-parametric test given the characteristics of the data 3. Understand how measures of central tendency and variability are integrated into inferential

statistics 4. Rank data for analysis using non-parametric tests

Analysis of two groups

• 2 groups of data may be collected: • Independent of each other, e.g. derived from different areas or individuals • Paired samples, e.g. samples from the same individual or area before and after some treatment or

event We wish to determine whether these 2 groups are different from each other. The data may:

• Fit the assumptions for parametric tests: 2 groups of independent samples

o Comparison of Means (Students t-test) o Comparison of Variances (F-test)

2 groups of paired samples o Comparison of Means (Paired sample t-test)

• Not fit the assumptions for parametric tests 2 groups of independent samples

o Mann-Whitney U-test 2 groups of paired samples

o Wilcoxon Matched-Pairs test

Student’s t test

• Student‟s t test (a parametric test) • Tests for differences between means of two independent samples

• 0H : There is no difference between means ( )A B

Page 34: Biometry Manual 2009

39

• 1H : There is a difference between means ( )A B

Assumptions:

• Individual observations are independent • Measurements on interval or ratio scale • Distribution of observations is continuous • Observations are normally distributed • Variances are equal; if unequal, a different formula is used

Formula: For equal variances

• t = difference between group means ___________________________ variability of groups • Variability of groups is calculated as the standard error of difference between means (SED)

• 2 2

1 2

1 2

SEDn n

• 1 2

2 2

1 2

1 2

X Xt

n n

• With 1 2( 2)df n n

Pooled variance: • If we know that the population variances of the two groups are the same, we use the pooled

sample variance ( 2

ps ) to estimate SED as follows:

• 2 2

2 1 1 2 2

1 2

( 1) ( 1)

( 2)p

n s n ss

n n

• t {1 2( 2)df n n } can now be calculated as

Page 35: Biometry Manual 2009

40

• 1 2

2

1 2

1 1p

X Xt

sn n

A hint on setting up data:

• Setting up data in tabular form is more efficient and eliminates errors

• Using the machine formula to calculate 2s reduces rounding errors • Always show your workings for each step so you can trace errors easily

Example: comparing the body lengths in cm of two closely related species of fish Data: species A: 1.6, 1.7, 2.3, 1.8, 1.4, 1.9, 1.7, 1.3, 2.1 species B: 1.2, 0.9, 1.5, 1.3, 1.1, 0.8, 1.4, 1.1, 1.0 Solution:

Species A XA2 Species B XB2

1.6 2.56 1.2 1.44

1.7 2.89 0.9 0.81

2.3 5.29 1.5 2.25

1.8 3.24 1.3 1.69

1.4 1.96 1.1 1.21

1.9 3.61 0.8 0.64

1.7 2.89 1.4 1.96

1.3 1.69 1.1 1.21

2.1 4.41 1.0 1.0

AX =

15.8

2

AX

= 28.54

BX =

10.3

2

BX

= 12.21 2

AX

= 249.64

2

BX

= 106.09

Mean = 1.76

Mean = 1.14

Page 36: Biometry Manual 2009

41

• 2 (9 1)0.1 (9 1)0.05

(9 9 2)ps

• 2

ps = 0.075

• 1.76 1.14

0.075 0.22t

• calculated

t = 4.81

• df = (9+9-2) = 16

• Critical 0.05,16

t = 2.12

• calculated

t > 0.05,16

t

• Conclusion: Since calculated

t (4.81) > 0.05,16

t (2.12), we Reject 0H and conclude that there are

significant differences in the length of the 2 species. Formula: (For unequal variances)

• If we know that the population variances of the two groups are NOT the same, we use the following instead:

• 1 2

2 2

1 2

1 2

X Xt

s s

n n

• with

22 2

1 2

1 2

2 22 2

1 2

1 2

1

s s

n ndf

s s

n n

n

rounded to the nearest smaller integer.

Page 37: Biometry Manual 2009

42

Using the t distribution to calculate confidence intervals:

• The t distribution can be used to attach a confidence interval to the mean • Mean ± 95% Confidence Interval

• x ± [ t (p = 0.05, df = n-1) × SD

n ]

• Where SD

n = Standard error of the mean

• Use the critical t value at p = 0.05 and (n-1) degrees of freedom • There is a 95% probability that the true population mean lies within this interval

Comparison of two independent groups: a. Mann-Whitney U-test (Non-parametric test)

• Requires ordinal, interval or ratio data

• Number of observations: 1n ,

2n

• 0H : No differences between 2 groups of data

• 1H : Differences exist between 2 groups of data

• Data for both groups are ranked in one combined list • Where 2 or more values tie for the same rank, the average of the next 2 or more ranks is assigned

A note on ranking data

X1 X1 Rank X2 X2 Rank

5 3 10 3 X values = 10 Rank = (9+10+11)/3 = 10

10 3 X values = 10 Rank = (9+10+11)/3 = 10

8 5, 6 already assigned, next Rank = 7

7 2 X values = 7 Rank = (5+6)/2 = 5.5

7 2 X values = 7 Rank = (5+6)/2 = 5.5

4 2 9 8

3 Smallest X value Rank = 1

10 3 X values = 10 Rank = (9+10+11)/3 = 10

6 4 13 9, 10, 11 already assigned, next Rank = 12 Double check largest X value Rank = (n1+n2)

Page 38: Biometry Manual 2009

43

NB: It helps to order the X values in each column in terms of increasing size

• Ranks are summed for each group (calculate 1R ,

2R )

Example: Same dataset as above (fish body lengths)

Sp. A

A Rank Sp. B

B Rank

1.6 12 1.2 6

1.7 13.5 0.9 2

2.3 18 1.5 11

1.8 15 1.3 7.5

1.4 9.5 1.1 4.5

1.9 16 0.8 1

1.7 13.5 1.4 9.5

1.3 7.5 1.1 4.5

2.1 17 1.0 3

1R = 122

2R = 49

• let 1n = the number of samples in the smaller of two independent groups

• let 2n = the number of samples in the larger of two independent groups

• Calculate 1 1

1 2 1

1

2

n nU n n R

• or 2 2

1 2 2

1

2

n nU n n R

• where: R1 = sum of the ranks assigned to group whose sample

size is 1n

R2 = sum of the ranks assigned to group whose sample

size is 2n

• The highest of the two values of U is used for the table • To avoid calculating both U values, one U value may be calculated and the following formula

applied to find the other:

1 2unknown knownU n n U

Page 39: Biometry Manual 2009

44

• From the example, 9 9 1

(9)(9) 1222

U

• 9 10

81 1222

U

• 81 45 122U

• 4U

To calculateunknown

U :

• 1 2unknown knownU n n U

= (9)(9) – 4 = 81 – 4 = 77

• The higher of the two values of U is used in the table given in your manual

• 0.05,9,9

64U

• Conclusion: Since calculated

U (77) > 0.05,9,9

U (64), we Reject 0H and conclude that the body

lengths of the two species of fish are different. b. Rank Sum Test

• Known as Wilcoxon Rank Sum test in the statistical software package “Statistix 7.0” • Uses a slightly different formula • Results are essentially identical

Summary:

1. Analysis of two groups of data first requires a test of normality 2. If both datasets are normal then parametric tests (e.g. student‟s t) can be done 3. If EITHER of the datasets is skewed or kurtosed, non-parametric (distribution-free) tests (e.g. Mann

Whitney U) should be done. 4. Unlike parametric tests (comparison of means and variances), non-parametric tests compare

ranks. Hence data should be converted to ranks if necessary. 5. Note that the tests used in this chapter are strictly for INDEPENDENT samples.

Page 40: Biometry Manual 2009

45

Lecture 7

Analysis of two groups: Paired samples Section Objectives: At the end of this section, students should be able to:

1. Define paired samples and understand the concept of paired data 2. Understand how analysis of paired samples differs from the analysis of independent samples 3. Set up paired data for statistical analysis 4. Analyse paired samples through the application of parametric and non-parametric tests

Analysis of two groups: paired samples

• Paired samples are samples from the same individual or area before and after some treatment or event

• We wish to determine whether these 2 groups are different from each other. The data may:

a. Fit the assumptions for parametric tests (Normal distribution) • In this case, the data are analysed using a comparison of means • The test is known as a “paired t test”

b. Not fit the assumptions for parametric tests (Not normally distributed)

• In this case, the data are analysed by testing the differences between observations in the datasets

• The test is known as a “Wilcoxon matched pairs test” (Non-parametric) The paired t test:

• Tests for differences between means of two paired samples

• 0H : There is no difference between means A B

• 1H : There are differences between means A B

Assumptions:

• Individual observations in one group are not independent of equivalent observations in the other group (i.e. they are paired)

• Observations within a group are independent • Sample data need not be normally distributed but differences between pairs should be • Variances do not need to be equal • Data are organized in pairs

Page 41: Biometry Manual 2009

46

• Measurements are interval or ratio • Each specific data point in group 1 is related to one and only one specific data point in group 2 • Same number of data points for each sample • Paired individuals should be as alike as possible e.g. same location/individual sampled before and

after Note: For paired data that fit the assumptions of parametric tests, a paired t test is more powerful that Student‟s t test i.e. there is a greater probability of rejecting a false null hypothesis. Example:

• Comparison of number of butterflies in 1 hectare plots during the wet and dry seasons

Plot Number of butterflies

Wet ( 1 jX ) Dry ( 2 jX )

1 15 13

2 27 16

3 12 18

4 22 10

5 12 11

6 19 14

7 20 8

8 31 7

9 24 26

• 1 jX , 2 jX refer to the data group (1 - wet, 2- dry) and the data point within each group (j)

Formula:

• d

d

Xt

SE

• dX = mean of differences ( jd ) in values between the pairs of samples

• dSE = standard error of d

• df = (n – 1) (where n = number of paired samples)

Page 42: Biometry Manual 2009

47

Solution:

• Use data from the two groups to create the variable d (d should be normally distributed) Calculate

• For each pair of samples, jd = ( 1 jX – 2 jX )

• dX = jd

n

2

2

1

j dd Xsd

n

• 2

d

sdSE

n

• d

d

Xt

SE

• Accept 0H if calculated t < tabulated t

Plot Wet

( 1 jX )

Dry

( 2 jX )

Difference

( jd ) ( j dd X ) 2

j dd X

1 15 13 2 -4.56 20.79

2 27 16 11 4.44 19.71

3 12 18 -6 -12.56 157.75

4 22 10 12 5.44 29.59

5 12 11 1 -5.56 30.91

6 19 14 5 -1.56 2.43

7 20 8 12 5.44 29.59

8 31 7 24 17.44 304.15

9 24 26 -2 -8.56 73.27

jd = 59 2

j dd X =

668.19

Page 43: Biometry Manual 2009

48

• jd = 1 jX - 2 jX

• 59

6.569

dX

• 2

j dd X = 668.19

• 2sd = 668.19

8 = 83.52

• dSE = 83.52

9 = 3.04

• t = 6.56

3.04 = 2.16

• df = (9-1) = 8

• 0.05,8

t = 2.31

Conclusion: Since calculated

t (2.16) < 0.05,8

t (2.31), we Fail to reject (accept) 0H and conclude that the

numbers of butterflies in each plot did not vary by season.

Alternatively you can use the machine formula to calculate 2sd

2

2

2

1

j

j

dd

n

sdn

Example:

• 2

jd = 1055

• 2

jd = 592 = 3481

2

2

2

1

j

j

dd

n

sdn

Page 44: Biometry Manual 2009

49

34811055 -

9

8

• = 83.52

Plot Wet ( 1 jX ) Dry ( 2 jX ) Difference

( jd )

2

jd

1 15 13 2 4

2 27 16 11 121

3 12 18 -6 36

4 22 10 12 144

5 12 11 1 1

6 19 14 5 25

7 20 8 12 144

8 31 7 24 576

9 24 26 -2 4

jd = 59 2

jd = 1055

Wilcoxon matched pairs test:

• Also called Wilcoxon signed-ranks test (Statistix 7.0) • Non-parametric test for differences between two groups for paired samples

• 0H : There are no differences between 2 data sets

• 1H : There are differences between 2 data sets

• Uses ordinal, interval or ratio data • Normal distribution is not required for the raw data or derived differences between pairs (d)

Page 45: Biometry Manual 2009

50

Procedure:

• Calculate differences ( jd = 1 jX – 2 jX )

• Rank jd (average tied ranks, ignore zeros)

• Sign rank of jd as + or – (based on sign of jd )

• T+ = signed ranks > 0

• T – = signed ranks < 0 Decision: • Use smaller T value for comparison with critical value

• Accept 0H if calculated T > tabulated T

Note: This differs from the usual decision

Example:

Plot Wet ( 1 jX ) Dry

( 2 jX )

Difference

( jd = 1 jX - 2 jX ) Rank of | jd | Signed rank of

| jd |

1 15 13 2 2.5 2.5

2 27 16 11 6 6

3 12 18 -6 5 -5

4 22 10 12 7.5 7.5

5 12 11 1 1 1

6 19 14 5 4 4

7 20 8 12 7.5 7.5

8 31 7 24 9 9

9 24 26 -2 2.5 -2.5

• T+ = 37.5 • T_ = 7.5 • Use smaller of T values (7.5) • See Table 4 • T(0.05, n=9) = 5 Decision

• Since calculated

T (7.5) > 0.05,9

T (5), we Fail to reject, (accept) 0H and conclude that the numbers

of butterflies in each plot did not vary by season

Page 46: Biometry Manual 2009

51

Summary:

• Unlike independent samples, the observations in one group of paired data are related to the observations in the other group

• Since the assumptions for Student‟s t test or Mann-Whitney U test are violated, alternative tests are used

• These tests include the paired t-test (parametric) and Wilcoxon matched pairs test (non-parametric)

• Students should note: 1. The process of ranking seen in the Mann-Whitney U test is also used in the

Wilcoxon matched pairs test- both tests are non-parametric 2. In Wilcoxon matched pairs test the difference between the observations are

ranked, NOT the observations themselves

3. In Wilcoxon matched pairs test the decision to Reject 0H is when the calculated

T

value is LESS THAN the critical

T value.

Page 47: Biometry Manual 2009

52

Lecture 8

Analysis of three or more groups: Analysis of Variance Section Objectives: At the end of this section, students should be able to:

1. Understand the limitations of using Student‟s t-test or Mann-whitney U test for analysing more than two groups of data

2. Test for differences among three groups of data 3. Follow the steps involved in the construction of an ANOVA table 4. Define and carry out “a posteriori” tests 5. Understand how the Student‟s t-test can be modified to help in testing for differences among three

or more groups of data Analysis of Variance (Parametric test):

• Often referred to as ANOVA or AOV • Used to test for differences between means for three or more groups (parametric tests)

• Simultaneous testing ( 0H :A

= B

= C etc.)

• Many comparisons would be needed with the Student‟s t test • Each with p = 0.95 of not making errors (or a 5% probability of making an error) • Using a Student‟s t-test the probability of errors becomes unacceptably high as the number of

comparisons increase as follows: o By computing three separate tests, we increase the probability of making an error to 0.13,

or 13% o If we compare four means, and thus make six separate tests (A = B, A = C, A = D, B = C,

B = D, C = D), we increase the probability of making an error to 0.21, or 21% ANOVA- Assumptions:

• Individual observations are independent of each other • Measurements are interval or ratio • Distribution of observations is continuous • Observations are normally distributed • Variances are equal

o Can be tested with Bartlett‟s test (in Minitab) One-way ANOVA

• simplest design; most frequently used

Page 48: Biometry Manual 2009

53

Example: Comparing the diameter at breast height (DBH; cm) of a particular tree species at four sites differing in elevation above sea level

Site A (100m) Site B (200m) Site C (300m)

60.8 68.7 102.6

57.0 67.7 102.1

65.0 69.8 96.5

61.7 66.3 100.2

58.6 74.0

Solution

0H :A

= B

= C

1H : 0H is false

• let i jX represent datum j in experimental group i

-e.g., 23X = 3rd tree in 2nd group

Steps:

1. Calculate in (number of samples for each group)

n1 = 5 n2 = 5 n3 = 4

2. Calculate N (total sample size) = in = 5+5+4= 14

3. Calculate i jX (sum of data for each group)

1X = 60.8 + 57.0 + 65.0 + 58.6 + 61.7

= 303.1

2X = 68.7 + 67.7 + 74.0 + 66.3 + 69.8

= 346.5

3X = 102.6 + 102.1 + 100.2 + 96.5

= 401.4

Page 49: Biometry Manual 2009

54

4. Calculate iX (mean for each group)

1X = 60.62

2X = 69.30

3X = 100.35

5. Calculate

2

i j

i

X

n

(step #3 squared and divided by sample size for each group)

group 1 = (303.1)2 / 5 = 18373.922 group 2 = (346.5)2 / 5 = 24012.450 group 3 = (401.4)2 / 4 = 40280.490

6. Calculate

2

i j

i

X

n

(sum of step #5) = 18373.922+24012.450+40280.490

= 82666.862

7. Calculate i j

X

(sum of step #3) = 303.1 + 346.5 + 401.4 = 1051

8. Calculate 2

i jX

(all observations squared and summed)

2

1 jX = (60.8)2 = 3696.64

(57.0)2 = 3249 (65.0)2 = 4225 (58.6)2 = 3433.96 (61.7)2 = 3806.89

= 18411.49

2

2 jX = 24046.71

Page 50: Biometry Manual 2009

55

2

3 jX = 40303.46

2

i jX = 18411.49+24046.71+40303.46

= 82761.66

9. Calculate correction term (C) as C =

2

i jX

N

(step #7 squared and divided by step #2)

C =

2

i jX

N

= (1051)2 / 19 = 1104601 / 19 = 58136.89

10. Calculate total sum of squares (total SS) as 2

i jX - C

(step #8 minus step #9) total SS = 82761.66 - 58136.89

= 24624.77

11. Calculate groups sum of squares (groups SS) as: 2

i j

i

X

n- C

(step #6 minus step #9) groups SS = 82666.862 - 58136.89

= 24529.97

12. Calculate error sum of squares (error SS) as: total SS - group SS (step #10 - step #11)

error SS = 24624.77 - 24529.97 = 94.8

13. Calculate total degrees of freedom (total df) as N - 1 (step #2 minus 1)

total df = 14 - 1 = 13

Page 51: Biometry Manual 2009

56

14. Calculate groups degrees of freedom (groups df) as k - 1 where k is the number of groups compared (number of groups minus 1)

groups df = 3 - 1 = 2

15. Calculate error degrees of freedom (error df) as N - k (step #2 minus number of groups)

error df = 14 - 3 = 11

16. Calculate groups mean square (groups MS) as: groups SS / groups df (step #11 divided by step #14)

groups MS = 24529.97 / 2 = 12264.99

17. Calculate error mean square (error MS) as: error SS / error df (step #12 divided by step #15)

error MS = 94.8 / 11 = 8.62

18. Calculate F as groups MS / error MS (step #16 divided by step #17)

F = 12264.99 / 8.62 = 1422.85

19. Construct an ANOVA table

Source of variation

SS df MS F

Total 24624.77 13 1422.85

Groups 24529.97 2 12264.99

Error 94.8 11 8.62

Or Alternatively:

Source of variation

SS df MS F

Between 24529.97 2 12264.99 1422.85

Within 94.8 11 8.62

Total 24624.77 13

Page 52: Biometry Manual 2009

57

20. Compare F for df = 2, 11 at P = 0.05 in F table

Decision: if F < 0.05,2,11

F , Fail to reject (accept) 0H

if F > 0.05,2,11

F , Reject 0H

0.05,2,11F = 5.26

Conclusion: Since calculated

F (1422.85) > 0.05,2,11

F (5.26), we Reject 0H and conclude that the

trees differ in width at different elevations.

Now that we have concluded that significant differences occur among the three groups, we don't know that all groups differ from each other. Next we must conduct another test for multiple comparisons of means:

A = B A = C B = C

Multiple comparison tests:

• Often referred to as “a posteriori” tests

Conducted only if ANOVA rejects 0H i.e. if an ANOVA first rejects a multi-sample hypothesis of

equal means o Differences between means are significant

• Which means are different? • We need multiple comparisons of means • [k(k – 1)]/2 pair-wise comparisons for k groups • Probability of errors increase with number of comparisons made in Student‟s t test • Example of some of these tests include:

a. Bonferroni b. Tukey c. Student-Newman-Keuls (SNK) d. Duncan's multiple range e. Least significant difference f. Scheffé g. Multiplicative Sidak

Theoretically the Student's t test could be used for each pairwise comparison, but each time we compute it we increase the probability of making a type I error, that is, rejecting the null hypothesis when in fact it is true.

Page 53: Biometry Manual 2009

58

Although not the best test, the Bonferroni test actually does compute the student's t test. However, to compensate for the increased probability of a type I error, the alpha level is divided by the number of comparisons -i.e., for 3 means, 3 comparisons; α = 0.05 / 3 = 0.017

for 4 means, 6 comparisons; α = 0.05 / 6 = 0.008 - Problem: as k (number of groups) increases, the Bonferroni test becomes increasingly conservative,

making type II errors by not rejecting H0 when in fact 0H is false.

Tukey Test (‘honestly significant difference test’):

• A multiple comparison test conducted only after ANOVA rejects 0H

Steps:

• Arrange means in increasing order • Calculate differences between means for each pair compared (start with largest vs. smallest)

• 0H : A B

(no difference between two means)

• (A and B denote any possible pair of groups) • For each pairwise comparison:

• q = ( A BX X ) / SE

• SE calculated using Error MS as variance ( 2s ) – This is ANOVA step #17.

• SE = 2s

n (where n is same for all means)

• Calculate iX for each group (ANOVA step #4)

• Arrange all sample means iX in order of increasing magnitude, e.g. for 4 groups:

1 2 3 4X X X X

• Calculate the difference between the means for each pair compared. Start with the largest vs. the

smallest and then the largest vs. the next smallest and so on. There should be 1

2

k k

different pairwise comparisons e.g.

Comparison B vs. A

Difference

B AX X

4 vs. 1 4 1X X

4 vs. 2 4 2X X

4 vs. 3 4 3X X

3 vs. 1 3 1X X

3 vs. 2 3 2X X

2 vs. 1 2 1X X

Page 54: Biometry Manual 2009

59

• For each comparison calculate B AX X

qSE

, ANOVA step #4 divided by step #1

Decision:

• Compare the q value for each comparison with the critical q value i.e. 0.05, . ,Error df k

q , where Error

degrees of freedom (ANOVA step #15) and k= number of groups.

• If calculated

q < 0.05, . ,Error df k

q , Fail to Reject (accept) 0H for that comparison

• If calculated

q > 0.05, . ,Error df k

q , Reject 0H for that comparison

Rules of procedure:

• If no difference is found between 2 means then it is concluded that no difference exists between any of the means enclosed by them and such differences are not tested, e.g.

If means are arranged in increasing order of magnitude 1 2 3 4X X X X and no difference is

found between 4X and 2X , then it is concluded that no difference also exists between the

enclosed pairs of means, i.e. 4X vs. 2X and 3X vs. 2X and these comparisons are not tested.

Least significant difference (LSD):

• An extension of the Student‟s t test

• Formula: 0.05

LSD SED × t (at P = 0.05, error df)

– SED = Standard error of difference

– SED = 22s

SEDn

(where 2s = error MS)

– Means that differ from each other by at least the LSD are significantly different from each other

• Do not make all possible comparisons

– Define required comparisons before analysis e.g. comparisons only with control / standard Two-way Analysis of Variance (Two-way ANOVA):

• Much more complicated than one-way ANOVA Example:

Page 55: Biometry Manual 2009

60

We could use the same data, but compare the DBH for plots on ridges and valleys (slope aspect) for different elevations:

Elevation 100 m 200 m 300 m

────────────────────────────────────

60.8 68.7 102.6 57.0 67.7 102.1

ridges 65.0 74.0 100.2 58.6 66.3 96.5 61.7 69.8

────────────────────────────────────

65.3 79.8 105.8 62.1 75.6 103.4

valleys 67.3 68.9 113.2 63.4 72.4 99.3 66.2 108.4

────────────────────────────────────

• We would then conduct tests for three null hypotheses:

0H : for elevation, A B CX X X

0H : for slope aspect, A BX X

0H : there is no interaction between slope aspect and elevation on DBH

• Numerous designs are available, such as split plot, repeated measures, balanced and unbalanced,

etc. Summary:

• Analysis of 3 or more groups of data requires much more complicated analyses • Using student‟s t test to analyse 3 or more groups causes errors which increase progressively with

increasing number of groups compared • Parametric data (normal distribution) with independent observations can be analysed using

ANOVA • However, the results of ANOVA only give an indication of overall differences among the groups

compared • We also need to know exactly which groups differ. This is done by using “a posteriori” tests such as

the Tukey test, which does a pairwise comparison of means. • Another method of comparing between groups is by using an extension of the student‟s t-test

known as LSD. • Note that non-parametric data cannot be analysed using this method.

Page 56: Biometry Manual 2009

61

Lecture 9

Analysis of three of more groups: Non-parametric tests Section objectives: At the end of this section, students should be able to:

1. Understand the limitations of using ANOVA analysing more than two groups of non-parametric data

2. Test for differences among three groups of non-parametric data 3. Understand the steps involved in the carrying out a Kruskal-Wallis test 4. Test for differences between groups of data by performing a Tukey-type test (or the non-parametric

form of the Tukey test) Kruskal Wallis test:

• A non-parametric test corresponding to a one-way ANOVA • Requires ordinal, interval or ratio data • No assumptions needed regarding normality of data & homogeneity of variances

• 0H : There are no differences between groups

• Data for all groups are ranked from lowest to highest (tied ranks are averaged) Formula:

2123 1

1

i

i

RH N

N N n

where:

• in = number of observations in group i

• N = in , the number of observations in all groups

• iR = sum of ranks in group i

• k = number of groups compared Note:

• When k > 3 and in > 5, H approximates a chi-square distribution with df = k – 1

• When k=3 and in >= 5, H critical value will be given 0.05, 1, 2, 3n n n

H

Page 57: Biometry Manual 2009

62

Correction formula:

• A correction factor (C) is needed if ties occur in the data

3

31

i it tC

N N

where t is the number of ties in the thi group of ties. The corrected value of H is therefore:

c

HH

C

Example:

• Comparing the diameter at breast height (DBH; cm) of a particular tree species at four sites differing in elevation above sea level

0H : DBH is not different for trees at different elevations

1H : 0H is false

100 m rank 200 m rank 300 m rank 400 m rank 60.8 3 68.7 9 102.6 23.5 b=2 87.9 16 57.0 1 67.7 8 102.6 23.5 b=2 84.2 14 65.0 5 4.0 11 100.2 22 83.1 13 58.6 2 66.3 6 96.5 20 85.7 15 61.7 4 69.8 10 90.3 18 a=3 90.3 18 a=3 66.4 7 77.9 12 98.9 21 90.3 18 a=3 Steps:

1. Calculate in

(number of samples for each group) n1 = 6 n2 = 6 n3 = 6 n4 = 6

2. Calculate N (sum of step #1)

N = 6 + 6 + 6 + 6 = 24

Page 58: Biometry Manual 2009

63

3. Calculate iR

(sum of ranks for each group) R1 = 3 + 1 + 5 + 2 + 4 + 7 = 22 R2 = 9 + 8 + 11 + 6 + 10 + 12 = 56 R3 = 23.5 + 23.5 + 22 + 20 + 18 + 21 = 128 R4 = 16 + 14 + 13 + 15 + 18 + 18 = 94

4. Calculate 2

iR (step #3 squared)

R1 = (22)2 = 484 R2 = (56)2 = 3136 R3 = (128)2 = 16384 R4 = (94)2 = 8836

5. Calculate test statistic H using the formula

212

3 11

i

i

RH N

N N n

12 484 3136 16384 88363 24 1

24 24 1 6 6 6 6H

1280.67+522.67+2730.67+1472.67 3 25

24 25H

124806.68 75

600H

H = (0.02) (4806.68) - 75

H = 96.13 - 75

H = 21.13

6. If ties occurred, calculate 3

i it t where t = the number of ties in the ith group of ties; if no

ties occurred, got to step #9 3

i it t = (33 - 3) + (23 - 2)

= (27 - 3) + (8 - 2) = 24 + 6 = 30

7. Calculate the correction formula C as

Page 59: Biometry Manual 2009

64

3

31

i it tC

N N where 3

i it t = step #6

= 3

301

(24) - 24

= 30

113824 - 24

= 30

113800

= 1 - (0.00217) = 0.998

8. Calculate cH using the correction formula c

HH

C

(divide step #5 by step # 7)

cH =21.13

0.998

= 21.17

9. Calculate degrees of freedom (df) as k - 1 (number of groups compared minus one)

df = 4 - 1 = 3

10. Look up H or cH (if appropriate) in chi-square table for df = 3

Decision: if H < Fail to Reject (accept) 0H

if H > Reject 0H

= 7.82

Conclusion: Since cH (21.17) > (7.82), we Reject 0H and conclude that the trees differ in width

at different elevations.

Page 60: Biometry Manual 2009

65

Multiple comparison tests:

• Multiple comparisons are problematic • Zar gives several complicated equations that may be used

One example is the "nonparametric Tukey-type comparisons" for when there are equal observations for each group being compared

Tukey-type test:

• A non-parametric, multiple comparison test

• 0H : No difference between groups B and A (A and B denote any possible pair of groups)

Steps: (Using the above example)

1. Calculate SE using the formula:

1

12

n nk nkSE

6 6 4 (6 4) 1

12

x xSE

6 24 25

12

3600

12

300

17.32

2. Calculate the rank sum ( iR ) for each group

(step #3 for Kruskal-Wallis test)

1R = 22

2R = 56

3R = 128

4R = 94

Page 61: Biometry Manual 2009

66

3. Arrange all rank sums (Ri) in order of increasing magnitude:

i.e. 1 2 3 4R R R R = 22, 56, 94, 128

4. Calculate the absolute difference between iR for each comparison or

Calculate the difference between the rank sums for each pair compared. Start with the largest vs.

the smallest and then the largest vs. the next smallest and so on. There should be 1

2

k k

different pairwise comparisons e.g.

Comparison B vs. A

Difference

BR -AR

4 vs. 1 4 1R R

4 vs. 2 4 2R R

4 vs. 3 4 3R R

3 vs. 1 3 1R R

3 vs. 2 3 2R R

2 vs. 1 2 1R R

i.e. difference 1 vs. 2 = 56 - 22 = 34

1 vs. 3 = 128 - 22 = 106 1 vs. 4 = 94 - 22 = 72 2 vs. 3 = 128 - 56 = 72 2 vs. 4 = 94 - 56 = 38 3 vs. 4 = 128 - 94 = 34

5. Calculate q by dividing the difference by the SE for each comparison (step #4 divided by step#1)

q for 1 vs. 2 = 34 / 17.32 = 1.96 q for 1 vs. 3 = 106 / 17.32 = 6.12 q for 1 vs. 4 = 72 / 17.32 = 4.16 q for 2 vs. 3 = 72 / 17.32 = 4.16 q for 2 vs. 4 = 38 / 17.32 = 2.19 q for 3 vs. 4 = 34 / 17.32 = 1.96

Page 62: Biometry Manual 2009

67

6. Compare q with 0.05, ,k

q in Table B.5 of Zar, where df = and k = number of groups.

Decision:

If q < 0.05, ,4

q , Fail to Reject (accept) 0H

If q > 0.05, ,4

q , Reject 0H

0.05, ,4q = 3.633

Conclusion: significant differences occur between groups:

1 vs. 3 1 vs. 4 2 vs. 3

Rules of procedure:

• If no difference is found between 2 rank sums then it is concluded that no difference exists between any of the rank sums enclosed by them and such differences are not tested, e.g.

If means are arranged in increasing order of magnitude 1 2 3 4R R R R and no difference is

found between 4R and

2R , then it is concluded that no difference also exists between the enclosed

pairs of means, i.e. 4R vs.

2R and 3R vs. 2R and these comparisons are not tested.

Friedman’s test:

• Used for two-way analysis of variance Summary:

• Analysis of 3 or more groups of non-parametric data requires complicated analyses involving ranking of the observations in the data.

• Non-parametric data (non-normal distributions) can be analysed using Kruskal Wallis • However, the results of Kruskal Wallis only give an indication of overall differences among the

groups compared • We also need to know exactly which groups differ. This is done by using a multiple comparison test

such as the Tukey-type test (designed for non-parametric data), which does a pairwise comparison of rank sums..

• Note that non-parametric data cannot be analysed using LSD.

Page 63: Biometry Manual 2009

68

Lecture 10 Correlation

Section Objectives: At the end of this section, students should be able to:

1. Understand how the observations in two independent variables can have an association 2. Use scatterplots to show the relationship between independent variables 3. Measure the strength of association between independent variables 4. Understand the concept of a correlation coefficient 5. Carry out parametric and non-parametric correlation analyses based on data type and data quality

Correlation Analysis:

• Measures the strength of association between two independent variables (1X and

2X ).

• [This notation is preferred as one variable is NOT dependent upon the other as denoted by X and Y variables]

• Association may be positive or negative • The correlation coefficient is denoted by “ r ” and is always between -1 and 1 i.e. 1 1r

e.g., strong positive correlation

│ .

│ .

1X │ . :

│ .

│. :

└─────────────

2X

e.g., weak positive correlation

│ . .

│ .

1X │ . . .

│ . .

│. : .

└─────────────

2X

Page 64: Biometry Manual 2009

69

e.g., strong negative correlation

│ .

│ . .

1X │ :. .

│ .

│ .

└─────────────

2X

e.g., no correlation

│ .

│ . . .

1X │ : .

│ . ..

│ . : .

└─────────────

2X

Caution:

• Cause and effect may be inferred, but cannot be proved -e.g., correlation between wealth and age of death

-wealth does not cause longevity -wealthier people can afford better health care

Pearson’s (product-moment) correlation coefficient ( r ):

• A parametric test that measures the degree of association (linear) between two independent variables.

Assumptions:

• Measurements are interval or ratio • Independent observations within each group

Page 65: Biometry Manual 2009

70

• Observations are associated between groups • Distribution of observations is continuous • Normal distribution of data for each group (variances do not need to be equal)

Formula:

2 22 2

X YXY

nr

X X Y Y

n n

• denominator is always positive; numerator may be positive, negative or zero • absolute value of numerator never exceeds denominator; thus, r ranges from -1 to 1 • units appear in both numerator and denominator, thus cancelling each other out

Example:

• Correlation between number of insects and height (m) of plants.

insects height (X) (Y) X2 Y2 XY 14 3.2 196 10.24 44.8 19 2.8 361 7.84 53.2 8 2.1 64 4.41 16.8 23 5.4 529 29.16 124.2 18 3.9 324 15.21 70.2 14 3.3 196 10.89 46.2 21 4.3 441 18.49 90.3

• 0H : 0r

• 1 : 0H r

Steps:

1. Calculate sample size (n): (number of observations for each group) n = 7

2. Calculate X : (sum of observations for group X)

X = 14 + 19 + 8 + 23 + 18 + 14 + 21

= 117

Page 66: Biometry Manual 2009

71

3. Calculate Y : (sum of observations for group Y)

Y = 3.2 + 2.8 + 2.1 + 5.4 + 3.9 + 3.3 + 4.3

= 25

4. Calculate 2X : (sum of squared observations for group X)

2X = 142 + 192 + 82 + 232 + 182 + 142 + 212

= 196 + 361 + 64 + 529 + 324 + 196 + 441 = 2111

5. Calculate 2Y : (sum of squared observations for group Y)

2Y = 3.22+2.82+2.12+5.42+3.92+3.32+4.32

= 10.24+7.84+4.41+29.16+15.21+10.89+18.49 = 96.24

6. Calculate XY : (sum of the products X and Y for observation i)

XY = (14)(3.2) + (19)(2.8) + (8)(2.1)

+ (23)(5.4) + (18)(3.9) + (14)(3.3) + (21)(4.3)

= 44.8 + 53.2 + 16.8 + 124.2 + 70.2 + 46.2 + 90.3

= 445.7

7. Calculate r using the formula:

2 22 2

X YXY

nr

X X Y Y

n n

or

Page 67: Biometry Manual 2009

72

2 2

#2 #3#6

#1

#4 #2 #5 #3

#1 #1

step stepstep

stepr

step step step step

step step

2 2

117 25445.7

7

2111 117 96.24 25

7 7

r

2925445.7

7

2111 13689 96.24 625

7 7

r

445.7 417.86

2111 1955.57 96.24 89.29r

27.84

155.43 6.95r

27.84

1080.24r

27.84

32.87r

0.847r

8. Calculate df as (n – 2)

Page 68: Biometry Manual 2009

73

(number of observations per group - 2) df = n - 2 = 7 - 2 = 5

Decision:

• Compare r with 0.05,5

r in r table

• If 0.05,5

r r then Fail to Reject (accept) 0H

If 0.05,5

r r then Reject 0H

• 0.05,5

r = 0.755

Conclusion: Since r (0.847) >0.05,5

r (0.755), we Reject 0H and conclude that there is a significant

positive correlation between number of insects and height (m) of plants.

Spearman rank correlation coefficient ( sr ): Non-parametric test

• Correlation coefficient, sr

• Non-parametric test ( 0H : sr = 0)

• About 91% as powerful as the Pearson correlation coefficient

Assumptions:

• Individual observations are independent in each group • Observations are associated between groups • Data are ordinal, interval or ratio • Distribution of observations is continuous • Normal distribution of observations is not required • Does not assume linear association but assumes a monotonic relationship (continuously increasing

or decreasing, e.g. curves) Procedure:

• Data are ranked separately for each variable • Tied values are given the average of the ranks • n = number of pairs of data

• id = difference between 1X &

2X ranks for observation i

Formula:

2

3

61

i

s

dr

n n

Page 69: Biometry Manual 2009

74

• Test of significance of sr (p = 0.05, n)

Decision: Fail to Reject (accept) 0H if calculated sr < tabulated 0.05,s n

r

Example:

• Two variables: Number of insects (1X ) and Height of plants (m) (

2X ) where insects are found

(same as above example).

X1 Rank X1 X2 Rank X2 Difference id Difference 2

id

14 2.5 3.2 3 -0.5 0.25

19 5 2.8 2 3 9

8 1 2.1 1 0 0

23 7 5.4 7 0 0

18 4 3.9 5 -1 1

14 2.5 3.3 4 -1.5 2.25

21 6 4.3 6 0 0

2

id =12.5

0

1

: 0

: 0

H r

H r

2

3

61

i

s

dr

n n

• 3

6(12.5)1

7 7sr

• 75

1343 7

sr

= 1 - (75 / 336)

Page 70: Biometry Manual 2009

75

= 1 - 0.223

sr = 0.777

• Compare sr with 0.05,7sr in sr table

Decision: If sr < 0.05,7sr , Fail to Reject (accept) 0H

If sr > 0.05,7sr , Reject 0H

0.05,7sr = 0.786

Conclusion: Since sr (0.777) < 0.05,7sr (0.786), we Fail to Reject 0H and conclude that there is no

significant correlation between the number of insects and height (m) of plants. Summary:

• A scatterplot of one independent variable 1X against another

2X is an easy and useful way to

show trends that exist • However, a quantitative approach is needed to measure the association between independent

variables is correlation analyses • Correlation analyses may indicate cause and effect but cannot prove it • Pearson‟s correlation (parametric) and Spearman rank correlation (non-parametric) analyses are

provide quantitative measurements of association • The correlation coefficient is always between -1 and 1

Page 71: Biometry Manual 2009

76

Lecture 11

Simple Linear Regression

Section Objectives: At the end of this section, students should be able to:

1. Understand how the observations in two variables (one independent and one dependent variable) can have an association

2. Use scatterplots to show the relationship between a dependent and an independent variable 3. Plot a “best-fit” line through a scatterplot 4. Measure the significance of regression between variables 5. Understand the concept of a regression coefficient 6. Use the regression equation derived from regression analysis as a general predictive model of the

relationship between the dependent and independent variables. Simple Linear Regression:

• A simple version of a series of more complex predictive models • Allows us to plot the best fitting straight line (linear) relationship between 2 variables denoted X

(independent variable) and Y (dependent variable) • There is a functional dependence between the 2 variables • Different from Correlation analysis where the 2 variables may vary together but are not necessarily

dependent upon each other • X is called the independent variable

o Assume that X is not subject to sampling error o Assume that measurement errors are negligible o In lab experiments these can be set and controlled very precisely

• Y is called the dependent variable o Sampled randomly & subject to sampling error o If there are several replicates of Y values for each value of X, it is assumed that there is a

normal distribution & equal variances for the replicate Y values for each value of X Calculation of the regression equation:

• Regression equation seeks to draw the "best fit" line through the data • Criterion for best fit employs the concept of "least squares," considering the vertical deviation of

each point from the line • The best fit line is defined as that which results in the smallest value for the sum of the squares of

these deviations • Regression equation: Y a bX

where: a = y intercept b = slope

Page 72: Biometry Manual 2009

77

Calculation of the regression coefficient (slope):

2

2

X YXY

nb

XX

n

Calculation of Y intercept:

a Y bX

where X = mean of X

and Y = mean of Y Example: Rate of Oxygen consumption of fish (Y, ml/g/hr) measured at different water temperatures (X, °C) along a stream

Water temperature (°C) X

Rate of Oxygen consumption of fish (ml/g/hr) Y

20.1 5.3

20.3 5.2

20.9 5.0

21.7 4.9

22.0 4.8

22.3 4.7

22.8 4.4

• 1st Step – plot a scatter diagram (Y vs. X)

– Continue if a linear fit seems possible – Is there a strong correlation between the 2 variables?

Page 73: Biometry Manual 2009

78

• Regression utilises the concept of „least squares‟ – The best fit line minimizes the sum of squares of vertical deviations of points from the line

X Y 2X 2Y XY

20.1 5.3 404.01 28.09 106.53

20.3 5.2 412.09 27.04 105.56

20.9 5.0 436.81 25.00 104.5

21.7 4.9 470.89 24.01 106.33

22.0 4.8 484.00 23.04 105.60

22.3 4.7 497.29 22.09 104.81

22.8 4.4 519.84 19.36 100.32

X =

150.1

Y =

34.3

2X =

3224.93

2Y =

168.63

XY =

733.65

X = 150.1 / 7 = 21.44

Y = 34.3 / 7 = 4.9

2

2

X YXY

nb

XX

n

2

150.1 34.3733.65

7

150.13224.93

7

b

5148.43733.65

7

22530.013224.93

7

b

Page 74: Biometry Manual 2009

79

733.65 735.49

3224.93 3218.57b

1.84

6.36b

= -0.29

a Y bX

4.9 0.289 21.44a

4.9 6.196a

= 11.10

Results: Regression equation is: 0.29 11.10Y X

Predicting values of Y:

• With the regression equation, we can predict Y at a stated value of X • It is unsafe to extrapolate Y for outside the observed

values of X Testing the significance of a regression equation:

• Is Y functionally dependent on X? • To test this, we test the null hypothesis that the slope is equal to zero

H0: b ═ 0

H1: b ╪ 0

• Uses an analysis of variance procedure:

Steps:

1. Calculate total SS as:

2

2Y

Yn

total SS = 168.63 - [(34.3)2 / 7] = 168.63 - (1176.49 / 7) = 168.63 - 168.07 = 0.56

Page 75: Biometry Manual 2009

80

2. Calculate regression SS as: X Y

b XYn

regression SS = -0.29 [733.65 - [(150.1)(34.3)/7]]

= -0.29 [733.65 - (5148.43 / 7)] = -0.29 (733.65 - 735.49) = (-0.29) (-1.84) = 0.534

3. Calculate residual SS as: total SS - regression SS (step #1 - step #2)

residual SS = 0.56 - 0.534 = 0.026

4. Calculate total degrees of freedom as: n - 1 total df = 7 - 1

= 6 5. Calculate regression degrees of freedom as the

number of parameters being estimated minus 1 (always 1 for simple linear regression since we

are estimating parameters a and b)

6. Calculate residual degrees of freedom as: total df - regression df

residual df = 6 - 1 = 5

7. Calculate regression MS as: regression SS / regression df (step #2 divided by step #5)

regression MS = 0.534 / 1 = 0.534

8. Calculate residual MS as: residual SS / residual df

(step #3 divided by step #6) residual MS = 0.026 / 5

= 0.0052

9. Calculate F as: regression MS / residual MS (step #7 divided by step #8)

F = 0.534 / 0.0052

3,15F = 102.69

Page 76: Biometry Manual 2009

81

10. Compare F for df = 1, 5 at P = 0.05 in F table

0.05,1,5F = 10.0

Decision:

• If F < 0.05,1,5

F , Fail to Reject (accept) 0H

• If F > 0.05,1,5

F , Reject 0H

Conclusion: Since 3,15

F (102.69) > 0.05,1,5

F (10.0), we Reject 0H and conclude that there is a

significant linear relationship as defined by the regression equation between water temperature and 2O

consumption

Calculation of 2R

• Expresses the proportion of the total variability in Y attributable to the dependence of Y on all the

iX , as defined by the regression model fit to the data

• 2R simply represents 2r , or may be calculated as: regression SS / total SS (step #2 / step #1)

2R = 0.534 / 0.56 = 0.95

NOTE: As a rule of thumb, 2r >70% is acceptable but there is no generally significant level or test for significance.

Summary:

• In Linear regression, scatterplots are used to show “cause and effect” relationships • Plotting a “best fit” line through a scatterplot is done by calculation of slope (a) and intercept (b) • The regression equation once formulated, can be used to predict values of Y and is therefore very

useful

• The 2R value gives the proportion (or %) of variation in Y that is explained by the regression line (i.e. variation in X)

Page 77: Biometry Manual 2009

82

Lecture 12

Multiple Linear Regression Statistical Packages for Computers

Data entry Multiple linear regression -one dependent variable regressed on two or more independent

variables -used to determine which independent variable(s) is/are the most

important predictor(s) of a dependent variable -example: an ornithologist wished to determine which single

morphological variable (cm) is the best predictor of body weight (g) for a particular species of bird

Bill Wing Tarsus Tail Body Bird length length length length weight

1X

2X 3X 4X Y

1 1.7 10.4 2.4 7.4 33.4 2 1.8 10.8 2.6 7.6 35.9 3 1.7 11.1 2.7 7.9 36.3 4 1.6 10.2 2.4 7.2 34.2 5 1.6 10.3 2.5 7.4 34.1

-calculations too laborious to do by hand -several methods used to determine which independent variables

best predict the dependent variable -recommended procedure is a "step-down" stepwise multiple

regression

-use the equation Y = 1X +

2X + 3X + 4X

-compare the P values for the results of the student's t test for each regression coefficient (a) -the t statistic tests the null hypothesis that a=0

-for the variable(s) lacking a significant t value, delete the variable with the lowest t and recompute the equation until each variable has the slope a differing significantly from 0

-e.g., equation may be y = 0.132X + 0.20 3X + 0.15

4X

Page 78: Biometry Manual 2009

83

Statistical packages for the computer 1. command-driven

-earlier packages like SPSS, SAS, Systat 2. menu-driven

-much easier to use -many packages occur -older packages like SPSS and Systat are menu-driven, but

difficult to use -Statistica is huge, but fairly easy to use -Statistix is a simple program that is perhaps the easiest

to use, but is not very common and does not do everything Data entry -the most difficult part of statistical analysis 1. table format

-data are entered in columns under each variable name -example 1: data entry for chi-square

A B C 26 27 28 7 69 14

-example 2: data entry for analysis of variance

A B C 6 3 11 8 5 15 3 4 11 2 2 9 6 1 7

2. categorical variables

-data are entered in columns under treatment variables and measured variables

-example 1: data entry for chi-square (same data as above)

ROW COL Y 1 1 26 1 2 27 1 3 28 2 1 7 2 2 69 2 3 14

Page 79: Biometry Manual 2009

84

-example 2: data entry for analysis of variance (same data as above)

CAT X 1 6 1 8 1 3 1 2 1 6 2 3 2 5 2 4 2 2 2 1 3 11 3 15 3 11 3 9 3 7

Page 80: Biometry Manual 2009

85

KEY TO STATISTICAL TESTS

1. Data are nominal (categorical) scale ................................. 2 1. Data are ordinal, interval or ratio scale ............................ 5 GOODNESS OF FIT TESTS 2. Data form one row or one column ...... one-sample chi-square or binomial 2. Data form 2+ rows and 2+ columns ..................................... 3 3. Sample size < 20 or smallest expected frequency < 5 ....... Fisher exact 3. Sample > 20 and smallest expected frequency > 5 ...................... 4 4. Data form 2 X 2 contingency table .......... Yates two-sample chi-square 4. Data form 2+ X 3+ contingency table ...... Pearson two-sample chi-square 5. Data for each group have normal distribution and equal variances ..... 6 5. Data for each group are not normal or variances are unequal ......... 12 PARAMETRIC TESTS 6. Comparison of two or more means ...................................... 7 6. Association or linear relationship between two or more variables .... 10 7. Comparison of two means .............................................. 8 7. Comparison of three or more means .................................... 9 8. Comparison of two independent means ........................ student's t 8. Comparison of two paired means ................................ paired t 9. Comparison of three or more means for one factor ......... one-way ANOVA 9. Comparison of three or more means for two factors ........ two-way ANOVA 10. Association between two independent variables ...... Pearson correlation 10. Linear relationship between a dependent variable

and one or more independent variables ............................... 11 11. One independent variable ...................... simple linear regression 11. Two or more independent variables ........... multiple linear regression NON-PARAMETRIC TESTS 12. Comparison of two or more means ..................................... 13 12. Association between two independent variables ..... Spearman correlation 13. Comparison of two means ............................................. 14 13. Comparison of three or more means ................................... 15 14. Comparison of two independent means ..................... Mann-Whitney U 14. Comparison of two paired means .................. Wilcoxon matched-pairs 15. Comparison of three or more means for one factor ........ Kruskal-Wallis 15. Comparison of three or more means for two factors ............. Friedman

Page 81: Biometry Manual 2009

86

TABLE 1. Critical values of the chi-square ( 2) distribution.

Probability (P)

df

0.90

0.70

0.50

0.30

0.20

0.10

0.05

0.01

0.001

1

0.02

0.15

0.46

1.07

1.64

2.71

3.84

6.64

10.83

2

0.21

0.71

1.39

2.41

3.22

4.60

5.99

9.21

13.82

3

0.58

1.42

2.37

3.66

4.64

6.25

7.82

11.34

16.27

4

1.06

2.20

3.36

4.88

5.99

7.78

9.49

13.28

18.47

5

1.61

3.00

4.35

6.06

7.29

9.24

11.07

15.09

20.52

6

2.20

3.83

5.35

7.23

8.56

10.64

12.59

16.81

22.46

7

2.83

4.67

6.35

8.38

9.80

12.02

14.07

18.48

24.32

8

3.49

5.53

7.34

9.52

11.03

13.36

15.51

20.09

26.12

9

4.17

6.39

8.34

10.66

12.24

14.68

16.92

21.67

27.88

10

4.86

7.27

9.34

11.78

13.44

15.99

18.31

23.21

29.59

Page 82: Biometry Manual 2009

TABLE 2. Critical values of the two-tailed t distribution.

Probability (P)

df

0.50

0.20

0.10

0.05

0.01

0.001

1

1.00

3.08

6.34

12.71

63.66

636.62

2

0.82

1.89

2.92

4.30

9.93

31.60

3

0.77

1.64

2.35

3.18

5.84

12.92

4

0.74

1.53

2.13

2.78

4.60

8.61

5

0.73

1.48

2.02

2.57

4.03

6.87

6

0.72

1.44

1.94

2.45

3.71

5.96

7

0.71

1.42

1.90

2.37

3.50

5.41

8

0.71

1.40

1.86

2.31

3.36

5.04

9

0.70

1.38

1.83

2.26

3.25

4.78

10

0.70

1.37

1.81

2.23

3.17

4.59

11

0.70

1.36

1.80

2.20

3.11

4.44

12

0.70

1.35

1.78

2.18

3.06

4.32

13

0.69

1.35

1.77

2.16

3.01

4.22

14

0.69

1.34

1.76

2.15

2.98

4.14

15

0.69

1.34

1.75

2.13

2.95

4.07

16

0.69

1.34

1.75

2.12

2.92

4.02

17

0.69

1.33

1.74

2.11

2.90

3.97

18

0.69

1.33

1.73

2.10

2.88

3.92

19

0.69

1.33

1.73

2.09

2.86

3.88

20

0.69

1.33

1.73

2.09

2.85

3.85

21

0.69

1.32

1.72

2.08

2.83

3.82

22

0.69

1.32

1.72

2.07

2.82

3.79

23

0.69

1.32

1.71

2.07

2.81

3.77

24

0.69

1.32

1.71

2.06

2.80

3.75

25

0.68

1.32

1.71

2.06

2.79

3.73

26

0.68

1.32

1.71

2.06

2.78

3.71

27

0.68

1.31

1.70

2.05

2.77

3.69

28

0.68

1.31

1.70

2.05

2.76

3.67

Page 83: Biometry Manual 2009

TABLE 3. Critical values of the two-tailed Mann-Whitney U distribution for P = 0.05.

n1 (number of cases in the smaller group)

n2

2

3

4

5

6

7

8

9

10

11

12

13

14

4

-

-

16

5

-

15

19

23

6

-

17

22

27

31

7

-

20

25

30

36

41

8

16

22

28

34

40

46

51

9

18

25

32

38

44

51

57

64

10

20

27

35

42

49

56

63

70

77

11

22

30

38

46

53

61

69

76

84

91

12

23

32

41

49

58

66

74

82

91

99

107

13

25

35

44

53

62

71

80

89

97

106

115

124

14

27

37

47

57

67

76

86

95

104

114

123

132

141

15

29

40

50

61

71

81

91

101

111

121

131

141

151

Page 84: Biometry Manual 2009

TABLE 4. Critical values of the Wilcoxon T distribution.

Probability (P)

n

0.50

0.20

0.10

0.05

0.01

0.001

6

6

3

2

0

7

9

5

3

2

8

12

8

5

3

0

9

16

10

8

5

1

10

20

14

10

8

3

11

24

17

13

10

5

0

12

29

21

17

13

7

1

13

35

26

21

17

9

2

14

40

31

25

21

12

4

15

47

36

30

25

15

6

16

54

42

35

29

19

8

17

61

48

41

34

23

11

18

69

55

47

40

27

14

19

77

62

53

46

32

18

20

86

69

60

52

37

21

Page 85: Biometry Manual 2009

TABLE 5. Critical values of the two-tailed F distribution for P = 0.05.

Numerator (groups) (regression) df

Denominator (error) (residual) df

1

2

3

4

5

6

1

648.0

800.0

864.0

900.0

922.0

937.0

2

38.5

39.0

39.2

39.2

39.3

39.3

3

17.4

16.0

15.4

15.1

14.9

14.7

4

12.2

10.6

9.98

9.60

9.36

9.20

5

10.0

8.43

7.76

7.39

7.15

6.98

6

8.81

7.26

6.60

6.23

5.99

5.82

7

8.07

6.54

5.89

5.52

5.29

5.12

8

7.57

6.06

5.42

5.05

4.82

4.65

9

7.21

5.71

5.08

4.72

4.48

4.32

10

6.94

5.46

4.83

4.47

4.24

4.07

11

6.72

5.26

4.63

4.28

4.04

3.88

12

6.55

5.10

4.47

4.12

3.89

3.73

13

6.41

4.97

4.35

4.00

3.77

3.60

14

6.30

4.86

4.24

3.89

3.66

3.50

15

6.20

4.77

4.15

3.80

3.58

3.41

16

6.12

4.69

4.08

3.73

3.50

3.34

17

6.04

4.62

4.01

3.66

3.44

3.28

18

5.98

4.56

3.95

3.61

3.38

3.22

19

5.92

4.51

3.90

3.56

3.33

3.17

20

5.87

4.46

3.86

3.51

3.29

3.13

21

5.83

4.42

3.82

3.48

3.25

3.09

22

5.79

4.38

3.78

3.44

3.22

3.05

23

5.75

4.35

3.75

3.41

3.18

3.02

24

5.72

4.32

3.72

3.38

3.15

2.99

Page 86: Biometry Manual 2009

TABLE 6. Critical values of the two-tailed Pearson correlation coefficient, r.

Probability (P)

df

0.50

0.20

0.10

0.05

0.01

0.001

1

0.71

0.95

0.99

1.00

1.00

1.00

2

0.50

0.80

0.90

0.95

0.99

1.00

3

0.40

0.69

0.81

0.88

0.96

0.99

4

0.35

0.61

0.73

0.81

0.92

0.97

5

0.31

0.55

0.67

0.76

0.88

0.95

6

0.28

0.51

0.62

0.71

0.83

0.93

7

0.26

0.47

0.58

0.67

0.80

0.90

8

0.24

0.44

0.55

0.63

0.77

0.87

9

0.23

0.42

0.52

0.60

0.74

0.85

10

0.22

0.40

0.50

0.58

0.71

0.82

11

0.21

0.38

0.48

0.55

0.68

0.80

12

0.20

0.37

0.46

0.53

0.66

0.78

13

0.19

0.35

0.44

0.51

0.64

0.76

Page 87: Biometry Manual 2009

TABLE 7. Critical values of the two-tailed Spearman rank correlation coefficient, rs.

Probability (P)

n

0.50

0.20

0.10

0.05

0.01

0.001

4

0.60

1.00

1.00

5

0.50

0.80

0.90

1.00

6

0.37

0.66

0.83

0.89

1.00

7

0.32

0.57

0.71

0.79

0.93

1.00

8

0.31

0.52

0.64

0.74

0.88

0.98

9

0.27

0.48

0.60

0.70

0.83

0.93

10

0.25

0.46

0.56

0.65

0.79

0.90

11

0.24

0.43

0.54

0.62

0.76

0.87

12

0.22

0.41

0.50

0.59

0.73

0.85

13

0.21

0.39

0.48

0.56

0.70

0.82

14

0.20

0.37

0.46

0.54

0.68

0.80

15

0.19

0.35

0.45

0.52

0.65

0.78

16

0.18

0.34

0.43

0.50

0.64

0.76

17

0.18

0.33

0.41

0.49

0.62

0.75