Você está na página 1de 139

# Hypothesis Testing

Chapter 6

Hypothesis Testing
In the last chapter we learned that thre are two types of statistical infrence
Estimation Hypothesis Testing

Hypothesis testing is about making a decision concerning a population by examining a sample from that population

Hypothesis Testing
A Hypothesis is defined as a statement about one or more populatiobs t is always about the parameters of the populations and samples such as mean, standard deviation, variance For that, the techniques that are used in hypothesis testing are also called as parametric tests

Hypothesis Testing
With hypothesis testing we van answer many different questions such as
An administrator in an hospital may hypothesize that the average length of stay of patients is five day A doctor my hypothesize that a certain drug will be effective in 90% of all the cases

By means of hypothesis testing, one determines whether or not such statements are compatible with the vailable data

Hypothesis Testing
Here we are interested in two types of hypothesis
Research hypotheses Statistical hypotheses

Research hypothesis lead directly to statistical hypotheses For that reason, here we will assume that the research hypotheses for the examples and the exercises have already been concidered

Hypothesis Testing
In this book, the general procedures for hypothesis testing are outlined in 9 steps
1. Data 2. Assumptions 3. Hypothses 4. Test Statistic 5. Distribution of the Test Statistic 6. Decision Rule 7. Calculation of the Test Statistic 8. Statistical Decision 9. Conclusion

Data
Here we need to examine the data and understand it for the appropriate test to analyze it For example, we need to know whether the data consist of counts of objects or measurements on objects

Assumtions
As we made several assumtions about the data in the previous chapter, we also need to do almost same assumtions about the data These are
Normality of the population distribution Equality of the variances Independence of the samples

Hypotheses
There are two statistical hypotheses involved in hypothesis testing These are
Null hypothesis (Ho) : it is the hypothesis to be stated. t is also called hypothesis of no diffrence Alternative hypothesis (HA) : it is the hypothesis about the diffrence

Hypotheses
For an example Can ve conclude that a certain population mean is not 50? The nul hypothesis Ho =50 Alternative hypothesis HA 50 Now, if we want to know if we can conclude that the population mean is greater than 50. The the hypotheses will be HA: >50 Ho: 50 If it is about concluding that the population mean is less than 50, the the hypotheses are HA: <50 Ho: 50

Hypotheses
In summary We may state the following rules of thumb for deciding what statement goes in the null hypothesis and what statement goes in the alternative hypothesis
1. What you hope or expect to be able to conclude as a result of the test usually should be placed in the alternative hypothesis 2. The null hypothesis should contain a statement of equality, either =, , or . 3. The null hypothesis is the hypothesis that is tested 4. The null and alternative hypotheses are complementary. That is, the two together exhoust all possibilities regarding the value that the hypothesized parameter can assume

Hypotheses
Here you need to ralize that: In general, either hypothesis testing nor statistical inference leads to the proof of a hypothesis It just indicates whether the hypothesis is supported or is not supported by available data

Test Statistic
One example for test statistic can be given as

x 0 z= n
Where o is hypothesized value of a population mean This test statistic is related to the statistic we have seen in previous chapter

x z= n

Test Statistic
The geral equation for test statistic can be given as
relevant statistic - hypothesized parameter test statistic = standard error of the relevant statistic

x 0 z= n

## Distribution of the Test Statistic

Here, we say that the distribution of the tst statistic:

x 0 z= n

follows the standard normal distribution if the null hypothesis is true and assumptions are met

Decision Rule
Distribution graph will have two regions
Acceptance region Rejection region

Here is called the probability of rejecting a true null hypothesis The error committed when a true null hypothesis is rejected is called the type I error The probability of accepting a false null hypothesis is called And, the error committed when a false null hypothesis is accepted is called type II error

Decision Rule
The goal is to make small However we do not have control on In practice, is larger than With all this, there is one thing that is for sure and it is the fact that we never know whether we have committed one of these errors when we reject or fail to reject a null hypothesis since the true state of affairs is unknown

True False

Type II error

Reject Ho

Type I error

Correct action

## Calculation of the Test statistic

From the data contained in the sample we have we can calculate the test statistic

x 0 z= n
And compare it with the acceptnce and rejection regions that have been specified

8. Statistical Decision
The statistical decision consist of rejecting or of not rejecting the null hypothesis It is rejected if the computed value of the test statistic falls in the rejection region It is not rejected if the computed value of the test statistic falls in the acceptance region

9. Conclusion
In the end If Ho is rejected, we conclude that HA is true. If Ho is not rejected, we conclude that Ho may be true Here It is impotant to realize that when the null hyothesis is not rejected one should not say that the null hypothesis is accepted. We should say that the null hypothesis is not rejected. Now with all this precautions, we will look at some tests

## HYPOTHESIS TESTING: A SINGLE POPULATION MEAN

Here we will cover the testing of a hypothesis about a population mean under three different conditions
1. when sampling is from a normally distributed population of values with known variance 2. when sampling is from a normally distributed population with unknown variance 3. when sampling from a population that is not normally distributed

## HYPOTHESIS TESTING: A SINGLE POPULATION MEAN

When sampling is from a normall distributed population the population varianve is known, the test statistic for testing Ho: = o

x 0 z= n

## Sampling from Normally Distributed Populations: population Varianves Known

Example 6.2.1: Researchers are interested in the mean level of some enzyme in a certain population. Let say that they are asking the following question Can we conclude that the mean enzyme level in this population is different from 25? The data available to the researchers are the determinations made on a sample of 10 with a mean of 22 and it is known that the sample comes from a population with a known variance of 45 Let us also say that we want to probability of rejecting a true null hypothesis to be = 0.05 (that means we want 95% confidence )

## Sampling from Normally Distributed Populations: population Varianves Known

Now we need to look at the rejection and acceptance regions of example From Table C, the value of z for 0.975 is 1.96 So we may state the decision rule for the test as: Reject Ho if the computed value of the test statistic is either 1.96 or -1.96 Otherwise do not reject Ho For that reason this test is called a two sided test
=6.71

=2.5

x=22

=10

25

15

=1

=1 /2=0.025
2

/2=0.025

0.95 =0
0

- 1.96

1.96

## Sampling from Normally Distributed Populations: population Varianves Known

Here we set the hypotheses as Ho: = 25

o 25
Now we can calculate the test statistic as
x 0 z= n 22 25 z= = 1.41 6.78 10

## Sampling from Normally Distributed Populations: population Varianves Known

Since the calculated value of z (-1.41) lies between the table values of -1.96 and 1.96, the we do not reject the null hypothesis Then we can say that the computed value of the test statistic is not significant at the 0.05 level So the conclusion is that may be equal to 25

## Sampling from Normally Distributed Populations: population Varianves Known

p Values: Instead of saying that an observed value of the test statistic is significant or not significant we may want to report the exact probability of getting a value as extreme or more extreme than the observed if the null hypothesis is true Now for our example, p value is given as p=0.1586 The satatement p=0.1586 means that the probability of getting a value as extreme as 1.41 in either direction when the null hypothesis is true is 0.1586

## Sampling from Normally Distributed Populations: population Varianves Known

The value 0.1586 is obtained from Table C as we look at the area for z=1.41 which is 0.9207 and area for z=-1.41 which is 0.0793 Since p value is the probability of observing z 1.41 or a z -1.41when the null hypothesis is true, the we divide 0.1586 by 2 (0.1586 / 2 = 0.0793) This means that, when Ho is true, the probability of obtaining a value of z as large as or larger than 1.41 is 0.0793 The probability of observing a value of z as small as or smaller than -1.41 is also 0.0793

## Sampling from Normally Distributed Populations: population Varianves Known

The probability one or the other of these events occuring, when Ho is true, is equal to the sum of the two individual probabilities So that p = 0.0793 + 0.0793 = 0.1586 The quantity p is referred to as the p value for the test

## Sampling from Normally Distributed Populations: population Varianves Known

The p value for a test may be defined also as the smallest value of for which the null hypothesis can be rejected So the general rule is then If the p value is less than or equal to , we reject the null hypothesis If the p value is greather than , we do not reject the null hypothesis

## Testing Ho by Means of a Confidence Interval

One can also use confidence intervals as we seen in previous chapter to test the hypotheses In example 6.2.1 we tested the hypothese as Ho: = 25 o 25

22 25 z= = 1.41 6.78 10

And concluded that we are not able to reject Ho since the computed value of the test statistic fall in the acceptance region We can also arrive the same conclusion using a 100(1- ) percent confidence interval

## Testing Ho by Means of a Confidence Interval

The 95 percent confidence interval for is

22 1.96 45

22 1.96 45

## 10 22 1.96( 2.1213) 22 4.16 17.84, 26.16

Since the interval include 25, then we make the same conclusion as we did with the test statistic

## Testing Ho by Means of a Confidence Interval

In general When testing a null hypothesis by means of a two sided confidence interval, we reject Ho at the level of significance if the hypothesized parameter is not contained within the 100(1-) percent confidence interval If the hypthesized parameter is containeed within the interval, Ho can not be rejected at the level of significance

## One sided Hypothesis Tests

A hypothesis test may be one sided in which case all the rejection region is in one or the other tail of the distribution Whether a one sided or a two sided test is used depends on the nature of the qustion being asked by the researcher If both large and small values will cause rejection of the null hypothesis, a two sided test is indicated When either sufficiently small values only or sufficiently large values only will cause rejection of the null hypothesis, one sided test is indicated

## One sided Hypothesis Tests

Example 6.2.2: Now for example 6.2.1, suppose that instead of asking if they could conclude that 25, the researcher had asked the following question Can we conclude that < 25? To this question we could reply that they can so conclude if they can reject the null hypothesis that 25

## One sided Hypothesis Tests

Example 6.2.2: Now let us set up the hypotheses first and calculate test statistic as

H 0 : 25
H A : < 25

x 0 z= n

22 25 z= = 1.41 45 10

## One sided Hypothesis Tests

The question is which z value from the Table C will be used? Let say agin that = 0.05 Since we are only intersed in the values less than 25 we say that the test is one sided and that will go in the one tail of the distribution as

=1
f(x)

x

## One sided Hypothesis Tests

So, now we know that the table value of z for 0.05 will be -1.645 Then this value will be compared with the value for the test statistic (-1.41) Since -1.41 > -1.645, we are unable to reject the null hypothesis So, the conclusion is that the population mean may be greather than or equal to 25 and act accordingly If the question was can we conclude that the mean is greather than 25? then the Table C value would be +1.645

## One sided Hypothesis Tests

The p value for the test statistic is now 0.0793, since P(z -1.41),when Ho is true, is 0.0793 as given in Table C when we determine the magnitude of the area to the left of -1.41 under the standard normal curve

## Sampling from a Normally Distributed Population: Population Variance Unknown

In reality, most of the time we do not know the population variance In cases like that the test statistic for

H 0 : = 0
becomes

x 0 t= s n

## Sampling from a Normally Distributed Population: Population Variance Unknown

Example 6.2.3 Researchers collected serum amylase values from a random sample of 15 apparently healty subjects. They want to know whether they can conclude that the mean of the population from which the samples of serum amylase determinations came is different from 120. The mean and the standard deviation computed from the samples are 96 and 35 units / 100 mL, respectively. Here we want the = 0.05

## Sampling from a Normally Distributed Population: Population Variance Unknown

As the way question is asked we see that the test is two sided as

H 0 : = 120
H A : 120
x 0 t= s n

## Sampling from a Normally Distributed Population: Population Variance Unknown

Now we need to look at the t value from Table E for = 0.05 (remember it is a two sided test so we look at the value at 0.975 The t values to the right and left of which 0.025 of the area lies are 2.1448 and -2.1448 Since the calculated t value is outside of the acceptance region we reject the null hypotesis So the conclusion is that based on the data, the mean of the population from which the sample came is not 120

## Sampling from a Normally Distributed Population: Population Variance Unknown

The expected p value for this test can not be obtained from Table E since it gives t values only for the selected percentiles The p value can be stated as an interval however. In this example, -2.65 is less than -2.624, the value of the t to the left of which lies 0.01 of the area under the t with 14 degrees of freedom, but greater than -2.9768, to the left of which lies 0.005 of the area Consequently, when Ho is true, the probability of obtaining a value of t as small as or smaller than -2.65 is less than 0.01 but greater than 0.005 So we can state this as: 0.005 < P(t -2.65) < 0.01

## Sampling from a Normally Distributed Population: Population Variance Unknown

Here, since the test is two sided, it must be allowed for the possibility of a computed value of the test statistic as large in the opposite direction as that observed Table E reveals that 0.005 < P(t 2.65) < 0.01 The p value,then, is 0.01 < p < 0.02

## Sampling from a Normally Distributed Population: Population Variance Unknown

If in the previous example the hypotheses had been

H 0 : 120
H A : < 120
The testing procedure would have led to a one sided test with all the rejection region at the lower tail of the distribution

## Sampling from a Normally Distributed Population: Population Variance Unknown

If the hypotheses had been

H 0 : 120
H A : > 120
We would have had a one sided test with all the rejection region at the upper tail of the distribution

## Sampling from a Population That is Not Normally Distribution

In this case, we must have a sample that is equal or greather that 30 If so, we can use the test statistic as

x 0 z= n
If the population standard deviation is not known then the test statistic is

x 0 t= s n

## Sampling from a Population That is Not Normally Distribution

Example 6.2.4 In a healt survey of a certain community 150 persons were interviewed One of the items of informaion obtained was the number of prescriptions each person had had filled during the past year The average number for the 150 people was 5.8 with a standard deviation of 3.1 The investigator wishes to know if these data provide sufficient evidence to indicate that the population mean is greater than 5. Here we take the = 0.05

## Sampling from a Population That is Not Normally Distribution

Based on the question is asked we set the hypotheses as

H0 : 5

HA : > 5
Then the tst statistic is

x 0 z= s n

## Sampling from a Population That is Not Normally Distribution

Since the question is asked as one sided, the critical value of the test statistic at 0.95 is 1.645

=1
f(x)

0.95 =0

0.05 1.645
x

## Sampling from a Population That is Not Normally Distribution

Since the calculated z value ( z=3.2) is greater than the table value (z=1.645) we reject Ho Then we conclude that the mean number of prescriptions filled per person per year for this population is greater than 5 The p value for this test is 0.0007

Computer Analysis
The following are the head circumferences (centimeters) at bird of 15 infants The goal is to test H 0 : = 34.5 H A : 34.5 33.38 34.34 33.46 32.15 33.95 34.13 33.99 33.85 34.45 34.10 34.23 34.19 33.97 32.73 34.05

Computer Analysis
The following are the head circumferences (centimeters) at bird of 15 infants H 0 : = 34.5 The goal is to test

H A : 34.5
33.38 34.34 33.46 32.15 33.95 34.13 15 33.798 0.630297 0.397274 34.5 0.05 -4.31358 2.144789 1.761309

## 33.97 32.73 34.05

n mean stdev var t (cal) t (table) t (table) ttest Since calculated t value is outside of the table values (-2.145 and 2.145) we say that the mean of our sample is not 34.5 and alternative hypothesis is accepted

## Hypothesis Testing: The Difference Between Two Population Means

Here we can formulate the following hypotheses

## 1.H 0 : 1 2 = 0, 2.H 0 : 1 2 0, 3.H 0 : 1 2 0,

H A : 1 2 0 H A : 1 2 < 0 H A : 1 2 > 0

## Hypothesis Testing: The Difference Between Two Population Means

As we discussed in previous case, we will discuss this issue under three subcategories as:
1. when sampling is from a normally distributed population of values with known variance 2. when sampling is from a normally distributed population with unknown variance 3. when sampling from a population that is not normally distributed

## Sampling From Normally Distributed Population Of Known Variance

The test statistic will be

z=

( x1 x 2 ) ( 1 2 ) 0
+ n1 n 2
2 1 2 2

## Sampling From Normally Distributed Population Of Known Variance

Example 6.3.1 The task is to find out if there is a sufficient evidence to indicate a difference in mean serum uric acid levels between normal individuals and individuals with mongolism A samples of 12 mongolism case and 15 normal individuals were taken The means are 4.5 mg/100 mL and 3.4 mg/100 mL The =0.05

## Sampling From Normally Distributed Population Of Known Variance

The hypotheses are

H 0 : 1 2 = 0 H A : 1 2 0
Alternatively, we can also set the hypotheses as:

H 0 : 1 = 2 H A : 1 2

## Sampling From Normally Distributed Population Of Known Variance

Since we are dealing with a case where we know the variance, then the test statistic will be based on the z=1.96 (at 0.975) Here we will be able to reject the null hypothesis if the calculated z value is outside of the range -1.96 < zcalculated < 1.96

## Sampling From Normally Distributed Population Of Known Variance

Now if calculate the z value as
z=

( x1 x 2 ) ( 1 2 ) 0
2 1 2 + 2 n1 n 2

( 4 .5 3 .4 ) 0 z= =
1 / 12 + 1 / 15

1 .1 = 2.82 0.39

Since the calculated value is outside of the range we just described we reject the Ho and conclude that on the basis of this data there is an indication of that the two population means are not equal The p value for the test is p=0.0048

## Sampling From Normally Distributed Population Of Unknown Variance

If the variances are not known than there are two possibbilitis
Population variances equal Population variances unequal

## Lets look at the first case Here we calculate a pooled variance as

2 2 ( ) n1 1 s1 + (n 2 1)s 2 2 s = p

n1 + n 2 2

## Sampling From Normally Distributed Population Of Unknown Variance

The tset statistic is then calculated as

( x1 x 2 ) (1 2 ) 0 t=
s
2 p

n1

2 p

n2

## Sampling From Normally Distributed Population Of Unknown Variance

Example 6.3.2 The data is about the serum amylase determibation of n2=15 healty subjects and n1= 22 hospitalized subjects The sample means and standard deviations are given as
x1 = 120 units / mL x2 = 96 units / mL s1 = 40 units / mL s2 = 35 units / mL

They wish to know if they would be justified in concluding that the population means are different

## Sampling From Normally Distributed Population Of Unknown Variance

The hypotheses are set as

H 0 : 1 2 = 0 H A : 1 2 0
For =0.05 at 22+15 2 degrees of freedom the t value from table is 2.0301 So, we reject Ho if calculated t value is outside the range -2.0301 < t < 2.0301

2 p

( n1 1) s =

+ (n2 1) s n1 + n2 2
2 1

2 2

2 2 ( ) 22 1 ( 40 ) + ( 15 1 )( 35 ) s2 = p

22 + 15 2

= 1450

( x1 x2 ) ( 1 2 ) 0 t=
s
2 p

n1

2 p

(120 96) 0
1450 1450 + 22 15

= 1.88

n2

## Sampling From Normally Distributed Population Of Unknown Variance

Since the calculated t value is in the range of -2.0301 < 1.88 < 2.0301 We are unable to reject Ho So, the conclusion is that based on the data, we can not conclude that the two population means are different Also, for this test 0.10 > p > 0.05 since 1.6896 < 1.88 < 2.0301

## Sampling From Normally Distributed Population Of Unknown Variance

If the population variances unequal
t =

( x1 x2 ) ( 1 2 ) 0
2 s12 s2 + n1 n2

## The table value for t at two sided test is obtained as wt +w t

/ 2 = t1
11 2 2

w1 + w2 s12 w1 = n1

s12 w1 = n1

## Sampling From Normally Distributed Population Of Unknown Variance

Example 6.3.3 t is about to determine if two population differ with respect to the mean value of a total serum complement activith (CH50). The data given for CH50 activity determination on n2=20 normal subjects and n1=10 subjects with disease The following data is obtained
x1 = 62.6 s1 = 33.8 x2 = 47.2 s2 = 10.1

## Sampling From Normally Distributed Population Of Unknown Variance

The hypotheses are set as
H 0 : 1 2 = 0 H A : 1 2 0

## For =0.05 we obtain the t table value as

/ 2 = t1 w1t1 + w2t 2 w1 + w2
2 s2 (10.1) 2 w2 = = = 5.1005 n2 20

## Sampling From Normally Distributed Population Of Unknown Variance

So we can oly reject Ho if t calculated is either tcal 2.2555 or tcal -2.255

( x1 x2 ) ( 1 2 ) 0 t =
s s + n1 n2
2 1 2 2

( 62.6 47.2) 0
(33.8) (10.1) + 10 20
2 2

= 1.41

Here -2.255 < 1.41 < 2.255 Then we can not reject Ho So, we can not conclude that the two population means are different

## Sampling From Non-normally Distributed Populations

In this case we approximate the normal distribution if we have large samples (based on central limit theorem) and use the z statistic as

z=

( x1 x 2 ) ( 1 2 ) 0
+ n1 n 2
2 1 2 2

## Sampling From Non-normally Distributed Populations

Example 6.3.4 A hospital administrator want to know that if the population that patronize hospital A has a larger mean family income than does the population that patronize hospital B. The data consist of the family incomes of 75 patients admitted to hospital A andf 80 patients admitted to hospital B The sample means are:

x1 = \$6800 x2 = \$5450

## Sampling From Non-normally Distributed Populations

Example 6.3.4 Now let us assume that the data constitute two independent random samples, each drawn from a nonnormally distributed population with a standard deviation
x1 = \$6800 x2 = \$5450

1 = \$600 2 = \$500

## Sampling From Non-normally Distributed Populations

Example 6.3.4
z=

( x1 x 2 ) ( 1 2 ) 0
2 1 2 + 2 n1 n 2

H 0 : 1 2 0 H A : 1 2 > 0
z=

H 0 : 1 2 H A : 1 > 2
= 1350 = 15.17 89

( 6800 5450) 0
(600) 2 (500) 2 + 75 80

## Sampling From Non-normally Distributed Populations

Example 6.3.4

H 0 : 1 2 0 H A : 1 2 > 0
z=

H 0 : 1 2 H A : 1 > 2

( 6800 5450) 0
(600) 2 (500) 2 + 75 80

1350 = 15.17 89

The fact that the calculated z value is larger than z-critical (z-table=2.33) we conclude that the population patronizing hospital A has a larger mean family income than the population patronizing hospital B.

PAIRED COMPARISONS
The test proceduses so far we have been concidered assume that the samples are independent. Thet are not appropriate for the related observations resulting from nonindependent samples. For this type of problems paired comparison test procedures are used The objective of paired comparison is to eliminate a maximum number of sources of extraneous variation by making the pairs similar with respect to as many variables as possible

PAIRED COMPARISONS
The paired test statistic can ber applied either as a z-test or ttest depending on the knowledge of variance of the differences f the variance of the differences is known we can use a z test as

d d z= d / n

PAIRED COMPARISONS
f the variance of the differences is NOT known we can use a t-test as

d d t= sd sd

sd =

Example 6.4.1 Twelve subjects participated in an experiment to study the effectivenes of a certain diet combined with a program of exercise, in reducing serum cholestrol levels Table below show the data Do the data provide sufficient evidence for us to conclude that the diet-exercise program is effective in reducing serum cholestrol levels?
Serum cholestrol levels Subjects 1 2 3 4 5 6 7 8 9 10 11 12 Before (x1) 201 231 221 260 228 237 326 235 240 267 284 201 After(x2) 200 236 216 233 224 216 296 195 207 247 210 209 Difference (x2-x1) -1 5 -5 -27 -4 -21 -30 -40 -33 -20 -74 8

Example: 6.4.1

H 0 : d 0 H A : d < 0
d d= n
i

## (1) + (5) + (5) + .... + (8) 242 = = = 20.17 12 12

2

2 d

( d =
t=

i d)

n 1

n d i2 ( d i ) 2 n (n 1)

## 20.17 0 20.17 = = 3.02 6.68 535.06 12

So the diet program is effective And we reject the nul hypothesis (Ho)

ttable = 1.7959

## d t(1 / 2 ) sd 20.17 2.201(6.68) 20.17 14.70 34.87,5.47

As seen the confidence interval do not contain zero so we can reject the nul hypothesis

Two machines are used for filling plastic bottles with a net volume of 16.0 ounces. The fill volume can be assumed normal with standard deviation

1=0.020 and

2=0.025 ounces. A member of quality engineering staff suspects that both machines fill to the same mean net volume, whether or not this volume is 16.0 ounces. below.
Machine 1 16.03 16.04 16.05 16.05 16.02 16.01 15.96 15.98 16.02 15.99 Machine 2 16.02 15.97 15.96 16.01 15.99 16.03 16.04 16.02 16.01 16.00

A random sample of 10 bottles is taken from the output of each machine as given

## HYPOTHESIS TESTING: A SINGLE PROPORTION

p0 p z= poq o n

p0 p z= poq o n

Example 6.5.1

H 0 : p = 0. 5 H A : p 0. 5
0.41 0.50 0.9 z= = = 3.11 (0.5)(0.5) 0.0289 300
ztable =1.96

## HYPOTHESIS TESTING: THE DIFFERENCE BETWEEN TWO POPULATION PRPOPORTIONS

x1 + x 2 p= n1 + n 2

p 1 p 2 =

p (1 p ) p (1 p ) + n1 n2

z=

1 p 2 ) ( p1 p 2 ) 0 (p p 1 p 2

Example 6.6.1

1 = 78 / 100 = 0.78, p

2 = 90 / 100 = 0.90 p
H 0 : p1 p 2 0 H A : p1 p 2 > 0

z=

ztable =1.645

= (n 1)s /
2 2
Example 6.7.1

H 0 : = 2500
2

H A : 2 2500

## 2 = (14)(1225) / 2500 = 6.86

X2table =5.629 and 26.119

2 H 0 : 1 2 2

HA : >
2 1

2 2

V.R. = s s
2 1

2 2

Example 6.8.1

## 1600 V.R. = = 1.31 1225

Ftable =2.39 for numerator 20 (21 is not given so the closest value is used)

## Test For Outliers

One of the important aim in the statistical tests is to recognize the presene or absence of outliers Outliers in a series of measurements are extraordinarily small or large observations compared with the bulk of the data There are test procedures in order to detect outliers in data and we will look at the Dixons Q-test Q-test is one of the nost frequently used outlier test procedure

## Test For Outliers

The Q-test uses the range of measurements and can be applied even when only few data are available The n measurements are arranged in ascending order If the very small value to be tested as an outlier is denoted by x1 and the very large value by xn Then the test statistic is calculated as given on the next slide

## Test For Outliers

For the smallest one

Q1 =

x2 x1 xn x1

## Test For Outliers

For the Largest one

Qn =

xn xn 1 xn x1

## Test For Outliers

The null hypothesis, i.e, that the concidered measurement is not an outlier, is accepted if the quantity Q<Q(1-;n). If the calculated Q value is greather than the Table value [Q>Q(1-a;n)], then we reject the null hypothesis and
say that the value is an outlier

Q values for selected significance and degrees of freedom are given in standard tables

Example
Trace analysis of polycyclic aromatic hydrocarbons (PAH) in a soil revealed for the trace constituent benzo[a]pyrene the following values in mg/kg dry weight 5.30, 5,00, 5.10, 5.20, 5.10, 6.20, 5.15 Apply the Q-test to check whether the smallest and largest value might be an outlier

Example
First we need to arrange the data in an ascending order as 5.00, 5,10, 5.10, 5.15, 5.20, 5.30, 6.20 The we can calculate the Q value for both smallest and largest values as

Q1 =

x2 x1 xn x1

## 5.10 5.00 6.20 5.00

= 0.083

Example
For the largest value

Qn =

xn xn 1 xn x1

## 6.20 5.30 6.20 5.00

= 0.75

For an =0.01 we can obtain the table value as Q(1-0.01=0.99;n=7)=0.64 Since the Q1 value is much smaller (0.083) than the table value we can not eliminate the smallest value as outlier However, the Q2 value is in fact larger than the table value and for this reason we can eliminate the largest as outlier

## Grubbss Test for Outlier

It can be applied for series of measurements consisting of 3 to 150 measuremets The null hypothesis, according to which x* is not an outlier within the measurement series of n values is accepted at level , if the test quantitity T is:

T=

x x* s

< Ttable (1 ; n)

By use of the test quantity T, the distances of the suspicious values from the mean are determined and related to the standard deviation of the measurements

## Grubbss Test for Outlier

Exmaple The data for the trace analysis of benzo[a]pyrene from previous example are also used in Grubbss test The mean of the data was 5.29 and the standard deviation was 0.411) The we can calculate the T values for the smallest ans the largest vales as
T1 = x x* s x x* s = 5.29 5.00 0.411 5.29 6.20 0.411 = 0.71

Tn =

= 2.21

## Grubbss Test for Outlier

Exmaple The table value at an a=0.01 is T(1-0.01=0.99;n=7) =2.10 As a result, the test results is not significant for the smallest value but is significant for the largest value So the largest one is an outlier
T1 = x x* s x x* s = 5.29 5.00 0.411 5.29 6.20 0.411 = 0.71

Tn =

= 2.21

## Non-parametric Tests for Method Comparison

The Tests that we have seen so far all requires that the data must be normaly distributed. In this case distribution free methods needs to be used These methods do not require the parameters such as mean and standard deviation used in the previous tests For that reason, they are non-parametric methods These methods require more replicate mesurements The do not use the values of the quantitative variables They use the rank of the data and are based on the counting

## Non-parametric Tests for Method Comparison

We will look at two example of non-parametric tests These are: The Mann-Whitney U-test for the comparison of the independent samples Wilcoxon T-test for for paqired measurements When Normality isw doubtful, you should always check these tests especially in the case of small samples

## The Mann-Whitney U-test

This test is based on the ranking the samples by taking the both gruops (group A and group B ) of the data together It gives the rank 1 to the lowest result and rank 2 to the second ect. If n1 and n2 are the number of data in the group with the smallest and largest number of results, respectively, and R1 and R2 are the sum of the ranks in these two groups, then we can we can set up the equations as:

n1 ( n1 + 1) U1 = n1n2 + R1 2 n2 ( n2 + 1) U 2 = n1n2 + R2 2

## The Mann-Whitney U-test

H 0 : U1 = U 2
n1 ( n1 + 1) U1 = n1n2 + R1 2 n2 ( n2 + 1) U 2 = n1n2 + R2 2

H1 : U1 U 2

The smaller of the two U values is used to evaluate the test When we have tie, the the average of the ranks are given. The Mann-whitney test compares the median of the two samples The smaller the diffrerence between the medians, the smaller the difference between U1and U2

## The Mann-Whitney U-test

Example: The following two grops of measuremets are to be compared Here the lowest results, 10.8 is given the rank 1. Since we have 10.8 twice in group A and B, they are both given the rank of 1.5 as their average

Rank =

(1 + 2 )
2

= 1 .5

A 11.1 13.7 14.8 11.2 15.0 16.1 17.3 10.9 10.8 11.7

## The Mann-Whitney U-test

If we set the hypothesis as

H 0 : U1 = U 2 H1 : U1 U 2
result 10.8 10.8 10.9 10.9 11.1 11.2 11.2 11.7 12.1 rank 1.5 1.5 3.5 3.5 5 6.5 6.5 8 9

## This will be a two sided test

Group A B A B A A B A B

Group B B A B A A B A A

result 12.4 13.5 13.7 14.6 14.8 15.0 15.5 16.1 17.3

rank 10 11 12 13 14 15 16 17 18

## The Mann-Whitney U-test

R1 is the sum of the ranks in group B as: R1=1.5+3.5+6.5+9+11+13+16=70.5 R2 is the sum of the ranks in group A as: R2=1.5+3.5+6+6.5+8+10+12+14+15+17+18=100.5
n1 ( n1 + 1) 8 * ( 8 + 1) R1 = 8 *10 + 70.5 = 45.5 2 2 n ( n + 1) 10(10 + 1) U 2 = n1n2 + 2 2 R2 = 8 *10 + 100.5 = 34.5 2 2 U1 = n1n2 + notice that U1 + U 2 = n1 n2 U = min(U1 ,U 2 ) = 34.5

## The Mann-Whitney U-test

n1 ( n1 + 1) 8 * ( 8 + 1) R1 = 8 *10 + 70.5 = 45.5 2 2 n ( n + 1) 10(10 + 1) U 2 = n1n2 + 2 2 R2 = 8 *10 + 100.5 = 34.5 2 2 U1 = n1n2 + notice that U1 + U 2 = n1 n2 U = min(U1 ,U 2 ) = 34.5

From the table for a two sided test with n1=8 and n2=10, a value of 17 is found. If an observed U value is les than or equal to the value in the table, the null hypothesis may be rejected at the level of the significance of the table. Since our calculated value is larger than 17, we conclude that no difference between the two groups.

We can now check the data used in this test have any tendency to show normal distribution or not.
sample 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 raw A 11.10 13.70 14.80 11.20 15.00 16.10 17.30 10.90 10.80 11.70 raw B 10.90 11.20 12.10 12.40 15.50 14.60 13.50 10.80 ranked 10.80 10.90 11.10 11.20 11.70 13.70 14.80 15.00 16.10 17.30 ranked 10.80 10.90 11.20 12.10 12.40 13.50 14.60 15.50 (j-0.5)/10 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 (j-0.5)/8 0.06 0.19 0.31 0.44 0.56 0.69 0.81 0.94 ranked 10.80 10.80 10.90 10.90 11.10 11.20 11.20 11.70 12.10 12.40 13.50 13.70 14.60 14.80 15.00 15.50 16.10 17.30 (j-0.5)/18 0.03 0.08 0.14 0.19 0.25 0.31 0.36 0.42 0.47 0.53 0.58 0.64 0.69 0.75 0.81 0.86 0.92 0.97

## The Mann-Whitney U-test

We can now check the data used in this test have any tendency to show normal distribution or not.

## Normal probabilty plot

1.00 Probability 0.75 0.50 0.25 0.00 10.00 Group A Group B A and B 12.00 14.00 Measurement 16.00 18.00

## Wilcoxon Matched Pairs Signed-Rank test

In this test, difference of the (di) paired data first calculated These di values are ranked first without regard to sign starting with the smallest value. Then the same sign is given as to corresponding difference If there are ties, the same rule (take average) is applied as in the Mann-Whitney test If any di value is zero the you can either drop them from analysis or assign a rank of (p+1)/2, in which p is the number of zero differences In this case half of the zero difference takes negative and the other half positive rank

## Wilcoxon Matched Pairs Signed-Rank test

The null hypohesis is that the methods A and B are equivalet If Ho is true, it would be expected that that the sum of all ranks for positive differences (T+) would be close to the sum for negative differences (T-). H0 : A = B The test statistic is than for two sided case: H1 : A B Wilcoxon T-test is calculated as: T= min (T+, T-) The smaller the value of T, the larger the significance of the difference

## Wilcoxon Matched Pairs Signed-Rank test

Lets now do the example
sample 1 2 3 4 5 6 7 8 9 10 R 114 49 100 20 90 106 100 95 160 110 T 116 42 95 10 94 100 96 102 150 104 d=R-T -2 7 5 10 -4 6 4 -7 10 6 rank 1 7.5 4 9.5 2.5 5.5 2.5 7.5 9.5 5.5 signed rank -1 7.5 4 9.5 -2.5 5.5 2.5 -7.5 9.5 5.5

## Wilcoxon Matched Pairs Signed-Rank test

The critical (Table) value of T as a function of n and are given tables. In our example, all positive differences adds up to T+=44.0 And all negative differences T-=11.0 If the calulated T value is equal to or smaller than the table value, the null hyothesis is rejected. For an =0.05 and n=10 in our two sided test, the table value is T=8. Thus the nul hypothesis is accepted and we can conclude that there is no diffrence between the two method

Q.1 A liquid dietary product implies in its advertising that use of the product for one month results in an average weight loss of at least 3 pounds. Eight subjects use the product for one month, and the resulting weight loss data are reported below. Use hypothesis-testing procedures to answer the following questions. (a) Do the data support the claim of the producer of the dietary product at 95% confidence? (b) Do the data support the claim of the producer of the dietary product at 99% confidence? (c) In an effort to improve sales, the producer is considering changing its claim from at least 3 pounds to at least 5 pounds. Repeat parts (a) and (b) to test this new claim.

Q.2 The overall distance traveled by a golf ball is tested by hitting the ball with Iron Byron, a mechanical golfer with a swing that is said to emulate the legendary champion, Byron Nelson. Ten randomly selected balls of two different brands are tested and the overall distance measured. The data follow: Brand 1: 275, 286, 287, 271, 283, 271, 279, 275, 263, 267 Brand 2: 258, 244, 260, 265, 273, 281, 271, 270, 263, 268 (a) Is there evidence that overall distance is approximately normally distributed? (b) Test the hypothesis that both brands of ball have equal mean overall distance.at 95% confidence.