the multinomial distribution and elementary tests for categorical data

Post on 22-Feb-2016

59 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

THE MULTINOMIAL DISTRIBUTION AND ELEMENTARY TESTS FOR CATEGORICAL DATA. It is useful to have a probability model for the number of observations falling into each of k mutually exclusive classes. Such a model is given by the multinomial random variable , for which it is assumed that : - PowerPoint PPT Presentation

TRANSCRIPT

THE MULTINOMIAL DISTRIBUTION AND ELEMENTARY TESTS FOR CATEGORICAL

DATA

It is useful to have a probability model for the number of observations falling into each of k mutually exclusive classes. Such a model is given by the multinomial random variable, for which it is assumed that :1. A total for n independent trials are made2. At each trial an observation will fall into exactly one of k mutually exclusive classes3. The probabilities of falling into the k classes are p1, p2,……., pk where pi is the probability of falling into class i, i = 1,2,…k These probabilities are constant for all trials, with

1

If k =2 , we have the Binomial distribution.

Let us define :X1 to be the number of type 1 outcomes in the n

trials,X2 to be the number of type 2 outcomes,..Xk to be the number of type k outcomes.

As there are n trials, 2

The joint probability function for these RV can be shown to be :

where

For k=2, the probability function reduces to

which is the Binomial probability of - successes in n trials, each with probability of success .

3

EXAMPLEA simple example of multinomial trials is the tossing of a die n times. At each trial the outcome is one of the values 1, 2, 3, 4, 5 or 6. Here k=6. If n=10 , the probability of 2 ones, 2 twos, 2 threes, no fours, 2 fives and 2 sixes is :

To testing hypotheses concerning the , the null hypothesis for this example,

states that the die is fair. vs

is false which, of course, means that the die is not fair4

The left-hand side can be thought of as the sum of the terms :

Which will be used in testing

versus

where the are hypothesized value of the  5

In the special case of k=2, there are two-possible outcomes at each trial, which can be called success and failure.A test of is a test of the same null hypothesis ( ). The following are observed an expected values for this situation :

Success Failure TotalExpected nObserved X n-X n

6

For an α-level test, a rejection region for testing versus is given byWe know that Hence,

By definition,

We have, , and using

if and only if

7

GOODNESS - of – FIT TESTSThus far all our statistical inferences have involved population parameters like : means, variances and proportions. Now we make inferences about the entire population distribution. A sample is taken, and we want to test a null hypothesis of the general form ;

H0 : sample is from a specified distributionThe alternative hypothesis is always of the form

H1 : sample is not from a specified distributionA test of H0 versus H1 is called a goodness-of-fit test. Two tests are used to evaluate goodness of fit :1. The test, which is based on an approximate statistic.2. The Kolmogorov – Smirnov (K-S) test. This is called a non parametric test, because it uses a test statistic that makes no assumptions about distribution.The test is best for testing discrete distributions, and the K-S test is best on continuous distributions.8

Goodness of Fit ??

A goodness of fit test attempts to determine if a conspicuous discrepancy exists between the observed cell frequencies and those expected under H0 .A useful measure for the overall discrepancy is given by :

where O and E symbolize an observed frequency and the corresponding expected frequency.

The discrepancy in each cell is measured by the squared difference between the observed and the expected frequencies divided by the expected frequency.9

The statistic was originally proposed by Karl Pearson (1857 – 1936) , who found the distribution for large n to be approximately a distribution with degrees of freedom = k-1.Due to this distribution, the statistic is denoted by and is called Pearson’s

statistic for goodness of fit .

Null hypothesis : H0 : pi = pio ; i = 1,2, ….k

H1 : at least one pi is not equal to its specified value.

Test statistic :

Rejection Region : distribution with d.f = (k-1) 10

Chi – square statistic first proposed by Karl Pearson in 1900, begin with the Binomial case.Let X1 ~ BIN (n, p1) where 0 < p1 < 1.According to the CLT :

for large n, particularly when np1 ≥ 5 and n(1- p1) ≥ 5.As you know, that Q1 = Z2 ≈ χ2 (1) If we let X2 = n - X1 and p2 = 1 - p1 ,

Because, Hence,

11

Pearson the constructed an expression similar to Q1 ; which involves X1 and

X2 = n - X1 , that we denote by Qk-1 , involving X1 , X2 , ……., Xk-1 and

Xk = n - X1 - X2 - …….- Xk-1

Hence,

or

12

EXAMPLEWe observe n = 85 values of a – random variable X that is thought to have a Poisson distribution, obtaining :

The sample average is the appropriate estimate of λ = E(X)It is given by

The expected frequencies for the first three cells are : npi , i= o,1,2 85 p0 = 85 P(X=0) = 85 (0,449) = 38,285 p1 = 85 P(X=1) = 85 (0,360) = 30,685 p2 = 85 P(X=2) = 85 (0,144) = 12,2

x 0 1 2 3 4 5

Frequency

41 29 9 4 1 1

13

The expected frequency for the cell { 3, 4, 5 } is : 85 (0,047) = 4,0 ; WHY ???

The computed Q3 , with k=4 after combination,

no reason to reject H0

H0 : sample is from Poisson distribution

vs H1 : sample is not from Poisson distribution

14

EXERCISEThe number X of telephone calls received each minute at a certain switch board in the middle of a working day is thought to have a Poisson distribution.Data were collected, and the results were as follows :

Fit a Poisson distribution. Then find the estimated expected value of each cell after combining {4,5,6} to make one cell.

Compute Q4 , since k=5, and compare it to Why do we use three degrees of freedom?Do we accept or reject the Poisson distribution?

x 0 1 2 3 4 5 6

frequency

40 66 41 28 9 3 1

15

CONTINGENCY TABLESIn many cases, data can be classified into categories on the basis of two criteria.For example, a radio receiver may be classified as having low, average, or high fidelity and as having low, average, or high selectivity; or graduating engineering students may be classified according to their starting salary and their grade-point-average.In a contingency table, the statistical question is whether the row criteria and column criteria are independent.The null and alternative hypotheses are H0 : The row and column criteria are independent

H1 : The row and column criteria are associatedConsider a contingency table with r rows and c columns. The number of elements in the sample that are observed to fall into row class i and column class j is denoted by 16

The row sum for the ith row is

And the column sum for jth column is

The total number of observations in the entire table is

The contingency table for the general case is given ON THE NEXT SLIDESHOW :

17

The General r x c Contingency TableX11 X12 …................ X1j .................... X1c

X21 X22 …………….X2j …………… X2c

.

.

.

.

Xi1 Xi2 ................... Xij ………………Xic

.

.

.

.

Xr1 Xr2 ……………Xrj ……………... Xrc

R1

R2

Ri

Rr

C1 C2 ……………Cj ……………….Cc

n

18

There are several probabilities of importance associated with the table.The probability of an element’s being in row class i and column class j in the population is denoted by pij The probability of being in row class i is denoted by pi• , and the probability of being in column class j is denoted by p•j Null and alternative hypotheses regarding the independence of these probabilities would be stated as follows :

for all pairs (i , j)versus

is false

As pij , pi• , p•j are all unknown, it is necessary to estimate these probabilities.19

and

under the hypothesis of independence, , so would be estimated

by

The expected number of observations in cell (i,j) isUnder the null hypothesis, , the estimate of is

The chi-square statistic is computed as 20

The actual critical region is given by

If the computed gets too large,

namely, exceeds

we reject the hypothesis

that the two attributes are independent.

21

EXAMPLE

Ninety graduating male engineers were classified by two attributes : grade-point average (low, average, high) and

initial salary (low, high).

The following results were obtained.Salary

Grade-Point Average Low Average High

Low

High

15 18 7

5 22 23

40

50

20 40 30 90

22

SOLUTION

;

;

;

APA ARTINYA ???23

EXERCISES1. Test of the fidelity and the selectivity of 190 radios

produced. The results shown in the following table :

Fidelity Low Average High Low

Selectivity Average

High

Use the 0,01 level of significance to test the null hypothesis that fidelity is independent of selectivity.

7 12 31

35 59 18

15 13 0

24

2. A test of the quality of two or more multinomial distributions can be made by using calculations that are associated with a contingency table. For example, n = 100 light bulbs were taken at random from each of three brands and were graded as A, B, C, or D.

Brand

GradeTotals A B C

D1

2

3

27 42 21 10

23 39 25 13

28 36 23 19

100

100

100

72 117 69 42

300

25

Clearly, we want to test the equality of three multinomial distributions, each with k=4 cells. Since under the probability of falling into a particular grade category is independent of brand, we can test this hypothesis by computing and comparing it with .Use .

26

ANALYSIS OF VARIANCE

1927

The Analysis of Variance

ANOVA(AOV)

is generalization of the two sample t-test, so that the means of k > 2 populations may be compared

ANalysis Of VAriance, first suggested by Sir Ronald Fisher, pioneer of the theory of design of experiments. He is professor of genetics at Cambridge University.The F-test, name in honor of Fisher

28

The name Analysis of Variance stems from the somewhat surprising fact that a set of computations on several variances is used to test the equality of several means

IRONICALLY

29

ANOVA

The term ANOVA appears to be a misnomer, since the objective is to analyze differences

among the group means

The terminology

of ANOVA can be confusing,

this procedure is

actually concerned

with levels of means

The ANOVA deals with means, it

may appear to be

misnamed

The ANOVA belies its name in that it is not concerned with analyzing variances but rather

with analyzing variation in means

30

ANOVA

DEFINITION:ANOVA, or one-factor analysis of variance, is a procedure to test the hypothesis that several populations have the same means.

FUNCTION:Using analysis of variance, we will be able to make inferences about whether our samples are drawn from populations having the same means

INTRODUCTION

31

The Analysis of Variance (ANOVA) is a statistical technique used to compare the locations (specifically, the expectations) of k>2 populations.The study of ANOVA involves the investigation of very complex statistical models, which are interesting both statistically and mathematically.The first is referred to as a one-way classification or a completely randomized design.The second is called a two-way classification or a randomized block design.The basic idea behind the term “ANOVA” is that the total variability of all the observations can be separated into distinct portions, each of which can be assigned a particular source or cause.This decomposition of the variability permits statistical estimation and tests of hypotheses.

32

Suppose that we are interested in k populations, from each of which we sample n observations. The observations are denoted by:

Yij , i = 1,2,…k ; j = 1,2,…nwhere Yij represents the jth observation from population i.A basic null hypothesis to test is :

H0 : µ1 = µ2 = … =µk that is , all the populations have the same expectation.The ANOVA method to test this null hypothesis is based on an F statistic.

THE COMPLETELY RANDOMIZED DESIGN WITH EQUAL SAMPLE SIZES

33

First we will consider comparison of the true expectation of k > 2 populations, sometimes referred to as the k – sample problem.For simplicity of presentation, we will assume initially that an equal number of observations are randomly sampled from each population. These observations are denoted by: Y11 , Y12 , …… , Y1n

Y21 , Y22 , …… , Y2n

.

.

.

Yk1 , Yk2 , …… , Ykn

34

where Yij represents the jth observation out of the n randomly sampled observations from the ith population.Hence, Y12 would be the second observation from the first population.In the completely randomized design, the observations are assumed to :1. Come from normal populations2. Come from populations with the same variance3. Have possibly different expectations, µ1 , µ2 , … , µk These assumptions are expressed mathematically as follows :Yij ~ NOR (µi , σ2) ; i = 1,2,...k (*) j = 1,2,…n

This equation is equivalent to………….

35

Yij = µi + εij , with εij ~ NID (0, σ2)

Where N represents “normally”, I represents “ independently” and D represents “ distributed”.The 0 means for all pairs of indices i and j, and σ2 means that Var ( ) = σ2 for all such pairs. The parameters µ1 , µ2 , … ,µk are the expectations of the k populations, about which inference is to be made.The initial hypotheses to be tested in the completely randomized design are :

H0 : µ1 = µ2 = … =µk versus H1 : µi ≠ µj for some pair of indices i ≠ j (**)

36

The null hypothesis states that all of the k populations have the same expectation. If this is true, then we know from equation (*) that all of the Yij observations have the same normal distribution and we are observing not n observations from each of k populations, but nk observations, all from the same population.The random variable Yij may be written as :

where,

defining,

So,

37

Hence, , with

and

The hypotheses in equation (**) may be restated as :

VS

(***)

The observation has expectation,

38

The parameters are differences or deviations from this common part of the individual population expectations . If all of the are equal (say to ), then . In this case all of the deviation are zero, because :

Hence, the wall hypothesis in equation (***) means that, , these expectations consist only of the common part .The total variability of the observations :

, where , is the means of all of the observations.It can be shown, that :

39

The notation represents the average of the observations from the ith population ; that is

The last equation, is represented by :SST = SSA + SSEwhere SST represents the total sum of squares, SSA represents the sum of squares due to differences among populations or treatments, and SSE represents the sum of squares that is unexplained or said to be “ due to error”.The result of ANOVA, usually reported in an analysis of variance table.

ANOVA table……….

ANOVA Table for the Completely Randomized Design with Equal Sample Sizes :

40

Source of Variation

Degrees of Freedom

Sum of Squares Mean Square F

Among populations or treatments

k-1 SSA  

Error k(n-1) SSE

Total kn-1 SSTFor an -level test, a reasonable critical region for the alternative hypotheses in equation (**) is

THE COMPLETELY RANDOMIZED DESIGN WITH UNEQUAL SAMPLE SIZES

41

In many studies in which expectation of k>2 populations are compared, the samples from each population are not ultimately of equal size, even in cases where we attempt to maintain equal sample size. For example, suppose we decide to compare three teaching methods using three classes of students. The teachers of the classes agree to teach use one of the three teaching methods.The plan for the comparison is to give a common examination to all of the students in each class after two months of instruction.Even if the classes are initially of the same size, they may differ after two months because students have dropped out for one reason or another. Thus we need a way to analyze the k-sample problem, when the samples are of unequal sizes.

42

In the case of UNEQUAL SAMPLE SIZE, the observations are denoted by :

. . .

where, represents the jth observation from the ith population. For the ith population there are ni observations.In the case of equal sample sizes, ni = n for i = 1,2,…,k.The model assumptions are the same for the unequal sample size case as for the equal sample size case. The are assumed to : 1. Come from normal populations 2. Come from populations with the same variance

3. Have possibly different expectations, µ1, µ2, …, µk

43

These assumptions are expressed formally as ; i = 1, 2, …, k j = 1, 2, …, ni or as Yij = µi + εij , with εij ~ NID (0, σ2)The first null and alternative hypotheses to test are exactly the same as those in the previous section-namely : H0 : µ1 = µ2 = … =µk

versusH1 : µi ≠ µl for some pair of indices i ≠ lThe model for the completely randomized design may be presented as :

with and εij ~ NID (0, σ2)

In this case the overall mean, , is given by where is the total number of

observations.

44

Here is a weighted average of the population expectations , where the weights are , the proportion of observations coming from the ith population. The hypotheses, can also be restated as

versus for at least one i.The observation Yij has expectation ,If H0 is true, then , hence all of the have a common distribution. Thus, , under H0. The total variability of the observations is again partitioned into two portions by

or SST = SSA +SSE,here

45

where

As before : represents the average of the observations from the ith population.

N is the total number of observations is the average of all the observations

Again, SST represents the total sum of squares. SSA represents the sum of squares due to differences among populations or

treatments. SSE represents the sum of squares due to error.

46

The number of Degrees of Freedom for :

TOTAL = TREATMENTS +

ERROR (N-1) = (k-1) + (N-

k)

DEGREE OF FREEDOM

47

The mean square among treatments and the mean square for error are equal to appropriate sum of squares divided by corresponding dof.That is,

It can be shown that MSE is an unbiased estimate of σ2 , that is : , similarly ;

Under hypothesis, has an F-distribution with (k-1) and (N-k) dof.

Finally, we reject the null hypothesis at significance level α if :

ANOVA TABLEfor the Completely Randomized Design with

unequal sample sizes

48

SOURCE dof SS MS FAmong Populations or Treatments

k-1 SSA

ERROR N-k SSE

TOTAL N-1 SST

Sometimes, SSA be denoted SSTR SSE be denoted SSER SST be denoted SSTO

SUMMARY NOTATION FOR A CRD

49

1 2 3 …………..... k

MEAN

VARIANCE

µ1 µ2 µ3

………………… µk

……………..

POPULATIONS (TREATMENTS)

1 2 3 …………… k

SAMPLE SIZE

SAMPLE TOTALS

SAMPLE MEANS

n1 n2 n3 …................ nk

T1 T2 T3 …................ Tk

…………….

Total number of measurements N = n1 + n2 + n3 +…+ nk

INDEPENDENT RANDOM SAMPLES

ANOVA F-TEST FOR A CRDwith k treatments

50

H0 : µ1 = µ2 = … =µk

(i.e., there is no difference in the treatment means)versus

Ha : At least two of the treatment means differ.

Test Statistic :

Rejection Region :

PARTITIONING OF THE TOTAL SUM OF SQUARES FOR THE COMPLETELY RANDOMIZED DESIGN

51

TOTAL SUM OF SQUARES

(SSTO)

SUM OF SQUARES FOR TREATMENTS

(SSTR)

SUM OF SQUARES FOR ERROR (SSER)

FORMULAS FOR THE CALCULATIONS IN THE CRD

52

SSTR = sum of squares for treatments

= (sum of squares of treatment totals with each square divided by number of observations for

that treatment) - CM =

53

where k is the total of treatments and N is the total number of observations.

EXAMPLE

54

For group of students were subjected to different teaching techniques and tested at the end of a specified period of time. As a result of drop outs from the experimental groups (due to sickness, transfer, and so on) the number of students varied from group to group. Do the data shown in table (below) present sufficient evidence to indicate a difference in the mean achievement for the four teaching techniques ??

DATA FOR EXAMPLE 1

1 2 3 4 65 75 59 94 87 69 78 89 73 83 67 80 79 81 62 88 81 72 83 69 79 76 90 454 549 425 351 6 7 6 4 75,67 78,43 70,83 87,75

S O L U T I O N

55

The mean squares for treatment and error are

56

The test statistic for testing H0 : µ1 = µ2 = µ3= µ4 is

The critical value of F for α = 0.05 is

reject H0

CONCLUDE ?????

THE RANDOMIZED BLOCK DESIGN

57

The randomized block design implies the presence of two quantitative independent variables, “blocks” and “treatments”Consequently, the total sum of squares of deviations of the response measurements about their mean may be partitioned into three parts, the sum of squares for blocks, treatments and error.

58

CRD RBD

SSTO

SSTR

SSER

SSBL

SSTR

SSER

59

Definition :A randomized block design is a design devised to compare the means for k treatments utilizing b matches blocks of k experimental unit each. Each treatment appears once in every block.The observations in a RBD can be represented by an array of the following type :

.

.

.

60

As before, the expectation of Yij the ith observation from the jth treatment (population), was given by : In this section / RBD, the assumption about Yij is that :

(i) ; i = 1,2, … , t j = 1, 2, … , b

with and

The observation Yij is said that to be the observation from block j on treatment i.As equation (i), it’s assumed that there are t different treatments and b blocks.

61

Hence,

overall effect block effect

treatment effect

One task is to test the null hypothesis

which states that there are no treatment differences.

62

Here, the ith treatment mean is :

The jth block mean is :

And the overall mean is :

Expression above can be abbreviated as SSTO = SSTR + SSBL +SSER

63

The degrees of freedom are partitioned as follows :

dof TO = dof TR + dof BL + dof ER

bt – 1 = (t-1) + (b-1) + (b-1)(t-1)

If the null hypothesis of no treatment differences given in is true, . Then both MSTR and MSER are unbiased estimate of .

64

It can be further shown, under :

Hence, using an level test, we reject in favor of if :

For reasons analogous, a test of :

versus , can be carried out using the

critical region :

65

Data Structure of a RBD with b blocks and k treatments

T R E A T M E N T S1 2 3 ………………… k

Block means

B 1

L 2

O . . C . . K b

………………..

……………….. . . . . . . . . . . . . . . . …………………

Treatment means

GENERAL FORM OF THE RANDOMIZED BLOCK DESIGN (TREATMENT i IS

DENOTED BY Ai)

66

BLOCK 1 2 ………………………

b

Although we show thetreatments in order within the blocks, in practice they would be assigned to the experimental units in a random order (thus the name randomized block design)

.

.

.

A1 A1 A1

A2 A2 A2

A3 A3A3

Ak AkAk

FORMULAS FOR CALCULATIONS IN RBD

67

where,

N = total number of observations

b = number of blocks

k = number of treatments

68

ANOVA Summary Table For RBD

SOURCE DOF SS MS F

Treatme

nts

Blocks

Error

k-1

b-1

N-k-

b+1

SSTR

SSBL

SSER

MSTR

MSBL

MSER

TOTAL N-1 SSTO

EXAMPLE

69

A study was conducted in a large city to compare the supermarket prices of the four leading brands of coffee at the end of the year. Ten supermarkets in the city were selected, and the price per pound was recorded for each brand.1. Set up the test of the null hypothesis that the mean

prices of the four brands sold in the city were the same at the end of the year. Use α = 0,05

2. Calculate the F statistic3. Do the data provide sufficient evidence to indicate a

difference in the mean prices for the four brands of coffee?

70

SUPERMARKE

T

BRAND A B C D

TOTALS

1 $ 2,43 $ 2,47 $ 2,27 $2,41

9,78

2 2,48 2,52 2,53 2,48

10,01

3 2,38 2,44 2,42 2,35

9,59

4 2,40 2,47 2,46 2,39

9,72

5 2,35 2,42 2,44 2,32

9,53

6 2,43 2,49 2,47 2,42

9,81

7 2,55 2,62 2,64 2,56

10,37

8 2,41 2,49 2,47 2,39

9,76

9 2,53 2,60 2,59 2,49

10,21

10 2,35 2,43 2,44 2,36

9,58

TOTALS 24,31 24,95 24,93 24,17

71

S O L U T I O N

72

73

Since the calculation F >F0,05 , there is very strong evidence that at least two of the means for the populations/treatments of prices of four coffee brands differ.

Treatments : H0 : µ1 = µ2 = µ3= µ4

H1 : at least two brands have different mean pricesTest Statistic

Blocks :H0 :Mean coffee prices are the same for all ten supermarketsH1 : Mean coffee prices differ for at least two supermarketsTest Statistic

74

dof for the test statistic are b - 1 = 9 and N – k – b +1=27F0,05 = 2,25

ANOVA TABLESOURC

EDOF SS MS F

Treatme

nt

Block

Error

3

9

27

0,05000

0,17451

0,00485

0,01666

7

0,01939

0

0,00017

963

92,8

107,9

TOTAL 39 0,22936

NON PARAMETRIC TEST

75

The majority of hypothesis tests discussed so far have made inferences about population parameters, such as the mean and the proportion. These parametric tests have used the parametric statistics of samples that came from the population being tested.

To formulate these tests, we made restrictive assumptions about the populations from which we drew our samples. For example, we assumed that our samples either were large or came from normally distributed populations. But populations are not always normal.

76

And even if a goodness-of-fit test indicates that a population is approximately normal. We cannot always be sure we’re right, because the test is not 100 percent reliable.Fortunately, in recent times statisticians have develops useful techniques that do not make restrictive assumption about the shape of population distribution.These are known as distribution – free or, more commonly, nonparametric test.Non parametric statistical procedures in preference to their parametric counterparts.The hypotheses of a nonparametric test are concerned with something other than the value of a population parameter.A large number of these tests exist, but this section will examine only a few of the better known and more widely used ones :

77

NON PARAMETRIC TESTS

SIGN TEST

WILCOXON SIGNED RANK TEST

MANN – WHITNEY TEST(WILCOXON RANK SUM TEST)

RUN TEST

KRUSKAL – WALLIS TEST

KOLMOGOROV – SMIRNOV TEST

LILLIEFORS TEST

THE SIGN TEST

78

The sign test is used to test hypotheses about the median of a continuous distribution. The median of a distribution is a value of the random variable X such that the probability is 0,5 that an observed value of X is less than or equal to the median, and the probability is 0,5 that an observed value of X is greater than or equal to the median. That is,

Since the normal distribution is symmetric, the mean of a normal distribution equals the median. Therefore, the sign test can be used to test hypotheses about the mean of a normal distribution.

79

Let X denote a continuous random variable with median and let

denote a random sample of size n from the population of interest. If denoted the hypothesized value of the population median, then the usual forms of the hypothesis to be tested can be stated as follows :

(right-tailed test)

(left-tailed test)

(two-tailed test)

VERSUS

80

Form the differences : Now if the null hypothesis is true,

any difference is equally likely to be positive or negative. An appropriate test statistic is the number of these differences that are positive, say . Therefore, to test the null hypothesis we are really testing that the number of plus signs is a value of a Binomial random variable that has the parameter p = 0,5 .A p-value for the observed number of plus signs can be calculated directly from the Binomial distribution. Thus, if the computed p-value.

is less than or equal to some preselected significance level α , we will reject and conclude is true.

81

To test the other one-sided hypothesis,

vs

is less than or equal α, we will reject . The two-sided alternative may also be tested. If the hypotheses are:

vs p-value is :

82

It is also possible to construct a table of critical value for the sign test.As before, let denote the number of the differences that are positive and let denote the number of the differences that are negative.Let , table of critical values for the sign test that ensure that If the observed value of the test-statistic , the the null hypothesis should be reject and accepted

83

If the alternative is , then reject if .If the alternative is ,then reject if .The level of significance of a one-sided test is one-half the value for a two-sided test.

84

Since the underlying population is assumed to be continuous, there is a zero probability that we will find a “tie” , that is , a value of exactly equal to .When ties occur, they should be set aside and the sign test applied to the remaining data.

TIES in the SIGN TEST

85

When , the Binomial distribution is well approximated by a normal distribution when n is at least 10. Thus, since the mean of the Binomial is and the variance is , the distribution of is approximately normal with mean 0,5n and variance 0,25n whenever n is moderately large.Therefore, in these cases the null hypothesis can be tested using the statistic :

THE NORMAL APPROXIMATION

86

Critical Regions/Rejection Regions for α-level tests of :

versus

are given in this table :CRITICAL/REJECTION REGIONS FOR Alternative CR/RR

THE WILCOXON SIGNED-RANK TEST

87

The sign test makes use only of the plus and minus signs of the differences between the observations and the median (the plus and minus signs of the differences between the observations in the paired case).Frank Wilcoxon devised a test procedure that uses both direction (sign) and magnitude.This procedure, now called the Wilcoxon signed-rank test.The Wilcoxon signed-rank test applies to the case of the symmetric continuous distributions.Under these assumptions, the mean equals the median.

88

Description of the test :We are interested in testing,

versus

89

Assume that is a random sample from a continuous and symmetric distribution with mean/median : .Compute the differences , i = 1, 2, … nRank the absolute differences , and then give the ranks the signs of their corresponding differences.Let be the sum of the positive ranks, and be the absolute value of the sum of the negative ranks, and let .

Critical values of , say .1. If , then value of the statistic , reject 2. If , reject if 3. If , reject if

90

If the sample size is moderately large (n>20), then it can be shown that or has approximately a normal distribution with mean

andvariance

Therefore, a test of can be based on the statistic

LARGE SAMPLE APPROXIMATION

Wilcoxon Signed-Rank Test

91

Test statistic :

Theorem : The probability distribution of when is true, which is based on a random sample of size n, satisfies :

92

Proof :

Let if , then

where

For a given , the discrepancy has a 50 : 50 chance being “+” or “-”. Hence, where

93

94

95

The Wilcoxon signed-rank test can be applied to paired data.Let ( ) , j = 1,2, …n be a collection of paired observations from two continuous distributions that differ only with respect to their means. The distribution of the differences is continuous and symmetric.The null hypothesis is : , which is equivalent toTo use the Wilcoxon signed-rank test, the differences are first ranked in ascending order of their absolute values, and then the ranks are given the signs of the differences.

PAIRED OBSERVATIONS

96

Let be the sum of the positive ranks and be the absolute value of the sum of the negative ranks, and .If the observed value , then is rejected and accepted.If , then reject , ifIf , reject , if

EXAMPLE

97

Eleven students were randomly selected from a large statistics class, and their numerical grades on two successive examinations were recorded.

Use the Wilcoxon signed rank test to determine whether the second test was more difficult than the first. Use α = 0,1.

Student

Test 1 Test 2 Difference

Rank

Sign Rank

1234567891011

9478896249788082628379

8565925652747984487182

913-36-341-21412-3

8104746121194

810-47-461-2119-4

98

solution :Jumlah ranks positif :

TOLAK H00 1,28 1,69

EXAMPLE

99

Ten newly married couples were randomly selected, and each husband and wife were independently asked the question of how many children they would like to have. The following information was obtained.

Using the sign test, is test reason to believe that wives want fewer children than husbands?Assume a maximum size of type I error of 0,05

COUPLE 1 2 3 4 5 6 7 8 9 10

WIFE XHUSBAND Y

3 2 1 0 0 1 2 2 2 0 2 3 2 2 0 2 1 3 1 2

SOLUSI

100

Tetapkan dulu H0 dan H1 :H0 : p = 0,5

vs H1 : p < 0,5

Ada tiga tanda +.Di bawah H0 , S ~ BIN (9 , 1/2)P(S ≤ 3) = 0,2539Pada peringkat α = 0,05 , karena 0,2539 > 0,05maka H0 jangan ditolak.

Pasangan

1 2 3 4 6 7 8 9 10

Tanda + - - - - + - + -

THE WILCOXON RANK-SUM TEST

101

Suppose that we have two independent continuous populations X1 and X2 with means µ1 and µ2. Assume that the distributions of X1 and X2 have the same shape and spread, and differ only (possibly) in their means.The Wilcoxon rank-sum test can be used to test the hypothesis H0 : µ1 = µ2. This procedure is sometimes called the Mann-Whitney test or Mann-Whitney U Test.

Description of the Test

102

Let and be two independent random samples of sizes from the continuous populations X1 and X2. We wish to test the hypotheses :

H0 : µ1 = µ2 versus H1 : µ1 ≠ µ2 The test procedure is as follows. Arrange all n1 + n2 observations in ascending order of magnitude and assign ranks to them. If two or more observations are tied, then use the mean of the ranks that would have been assigned if the observations differed.

103

Let W1 be the sum of the ranks in the smaller sample (1), and define W2 to be the sum of the ranks in the other sample.Then,

Now if the sample means do not differ, we will expect the sum of the ranks to be nearly equal for both samples after adjusting for the difference in sample size. Consequently, if the sum of the ranks differ greatly, we will conclude that the means are not equal.Refer to table with the appropriate sample sizes n1 and n2 , the critical value wα can be obtained.

104

H0 : µ1 = µ2 is rejected, if either of the observed values

w1 or w2 is less than or equal wα If H1 : µ1 < µ2, then reject H0 if w1 ≤ wα For H1 : µ1 > µ2, reject H0 if w2 ≤ wα.

LARGE-SAMPLE APPROXIMATION

105

When both n1 and n2 are moderately large, say, greater than 8, the distribution of W1 can be well approximated by the normal distribution with mean :

and variance :

106

Therefore, for n1 and n2 > 8, we could use :

as a statistic, and critical region is : two-tailed test

upper-tail test

lower-tail test

EXAMPLE

107

A large corporation is suspected of sex-discrimination in the salaries of its employees. From employees with similar responsibilities and work experience, 12 male and 12 female employees were randomly selected ; their annual salaries in thousands of dollars are as follows :

Is there reason to believe that there random samples come from populations with different distributions ? Use α = 0,05

Females

22,5

19,8

20,6

24,7

23,2

19,2

18,7

20,9

21,6

23,5

20,7

21,6

Males 21,9

21,6

22,4

24,0

24,1

23,4

21,2

23,9

20,5

24,5

22,3

23,6

SOLUSI

108

H0 : f1(x) = f2(x) APA ARTINYA??

random samples berasal dari populasi dengan distribusi yang sama

H1 : f1(x) ≠ f2(x)Gabungkan dan buat peringkat salaries :

SEX GAJI PERINGKAT

F 18,7 1F 19,2 2F 19,8 3M 20,5 4F 20,6 5

F 20,7 6F 20,9 7M 21,2 8M 21,6 10F 21,6 10F 21,6 10

CONT’D...........

109

M 21,9 12M 22,3 13M 22,4 14F 22,5 15F 23,2 16M 23,4 17F 23,5 18M 23,6 19M 23,9 20M 24,0 21M 24,1 22M 24,5 23F 24,7 24

110

Andaikan, kita pilih sampel dari female, maka jumlah peringkatnya R1 = RF = 117

Statistic

nilai dari statistic U adalah

111

Grafik

α = 0,05 Zhit =

1,91 maka

terima H0

-1,96 1,96 ARTINYA ???

KOLMOGOROV – SMIRNOV TEST

112

The Kolmogorov-Smirnov Test (K-S) test is conducted by the comparing the hypothesized and sample cumulative distribution function.A cumulative distribution function is defined as : and the sample cumulative distribution function, S(x), is defined as the proportion of sample values that are less than or equal to x.The K-S test should be used instead of the to determine if a sample is from a specified continuous distribution.To illustrate how S(x) is computed, suppose we have the following 10 observations :110, 89, 102, 80, 93, 121, 108, 97, 105, 103.

113

We begin by placing the values of x in ascending order, as follows :80, 89, 93, 97, 102, 103, 105, 108, 110, 121.Because x = 80 is the smallest of the 10 values, the proportion of values of x that are less than or equal to 80 is : S(80) = 0,1.

x S(x) = P(X ≤ x)

80 0,189 0,293 0,397 0,4102 0,5103 0,6105 0,7108 0,8110 0,9121 1,0

114

The test statistic D is the maximum- absolute difference between the two cdf’s over all observed values. The range on D is 0 ≤ D ≤ 1, and the formula is

where x = each observed value S(x) = observed cdf at x F(x) = hypothesized cdf at x

115

Let X(1) , X(2) , …. , X(n) denote the ordered observations of a random sample of size n, and define the sample cdf as :

is the proportion of the number of sample values less than

or equal to x.

116

The Kolmogorov – Smirnov statistic, is defined to be :

For the size α of type I error, the critical region is of form :

EXAMPLE 1

117

A state vehicle inspection station has been designed so that inspection time follows a uniform distribution with limits of 10 and 15 minutes.A sample of 10 duration times during low and peak traffic conditions was taken. Use the K-S test with α = 0,05 to determine if the sample is from this uniform distribution. The time are :11,3 10,4 9,8 12,6 14,813,0 14,3 13,3 11,5 13,6

SOLUTION

118

1. H0 : sampel berasal dari distribusi Uniform (10,15)versus H1 : sampel tidak berasal dari distribusi Uniform (10,15)

2. Fungsi distribusi kumulatif dari sampel : S (x) dihitung dari,

Hasil Perhitungan dari K-S

119

WaktuPengamata

n xS(x) F(x)

9,8 0,10 0,00 0,1010,4 0,20 0,08 0,1211,3 0,30 0,26 0,0411,5 0,40 0,30 0,1012,6 0,50 0,52 0,0213,0 0,60 0,60 0,0013,3 0,70 0,66 0,0413,6 0,80 0,72 0,0814,3 0,90 0,86 0,0414,8 1,00 0,96 0,04

120

, untuk x = 10,4Dalam tabel , n = 10 , α = 0,05 D10,0.05 = 0,41

f(D)

α = P(D ≥ D0)

D0 D

0,12 < 0,41 maka do not reject H0

EXAMPLE 2

121

Suppose we have the following ten observations 110, 89, 102, 80, 93, 121, 108, 97, 105, 103 ;were drawn from a normal distribution, with mean µ = 100 and standard-deviation σ = 10.Our hypotheses for this test are H0 : Data were drawn from a normal distribution, with µ = 100 and σ = 10.

versusH1 : Data were not drawn from a normal distribution, with µ = 100 and σ = 10.

SOLUTION

122

F(x) = P(X ≤ x)x F(x)

80899397102103105108110121

P(X ≤ 80) = P(Z ≤ -2) = 0,0228

P(X ≤ 89) = P(Z ≤ -1,1) = 0,1357

P(X ≤ 93) = P(Z ≤ -0,7) = 0,2420

P(X ≤ 97) = P(Z ≤ -0,3) = 0,3821

P(X ≤ 102) = P(Z ≤ 0,2) = 0,5793

P(X ≤ 103) = P(Z ≤ 0,3) = 0,6179

P(X ≤ 105) = P(Z ≤ 0,5) = 0,6915

P(X ≤ 108) = P(Z ≤ 0,8) = 0,7881

P(X ≤ 110) = P(Z ≤ 1,0) = 0,8413

P(X ≤ 121) = P(Z ≤ 2,1) = 0,9821

123

x F(x) S(x)80 0,0228 0,1 0,077289 0,1357 0,2 0,064393 0,2420 0,3 0,058097 0,3821 0,4 0,0179102 0,5793 0,5 0,0793 = 103 0,6179 0,6 0,0179105 0,6915 0,7 0,0085108 0,7881 0,8 0,0119110 0,8413 0,9 0,0587121 0,9821 1,0 0,0179

124

Jika α = 0,05 , maka critical value, dengan n=10 diperoleh di tabel = 0,409.

Aturan keputusannya, tolak H0 jika D > 0,409Karena H0 jangan ditolak atau terima H0 .

Artinya, data berasal dari distribusi normal dengan µ = 100 dan σ = 10.

LILLIEFORS TEST

125

In most applications where we want to test for normality, the population mean and the population variance are known.In order to perform the K-S test, however, we must assume that those parameters are known. The Lilliefors test, which is quite similar to the K-S test.The major difference between two tests is that, with the Lilliefors test, the sample mean and the sample standard deviation s are used instead of µ and σ to calculate F (x).

EXAMPLE

126

A manufacturer of automobile seats has a production line that produces an average of 100 seats per day. Because of new government regulations, a new safety device has been installed, which the manufacturer believes will reduce average daily output.A random sample of 15 days’ output after the installation of the safety device is shown:93, 103, 95, 101, 91, 105, 96, 94, 101, 88, 98, 94, 101, 92, 95The daily production was assumed to be normally distributed.Use the Lilliefors test to examine that assumption, with α = 0,01

SOLUSI

127

Seperti pada uji K-S, untuk menghitung S (x) urutkan, sbb : x S(x)

88 1/15 = 0,06791 2/15 = 0,13392 3/15 = 0,20093 4/15 = 0,26794 6/15 = 0,40095 8/15 = 0,53396 9/15 = 0,60098 10/15 = 0,667101 13/15 = 0,867103 14/15 = 0,933105 15/15 = 1,000

128

Dari data di atas, diperoleh dan s = 4,85 . Selanjutnya F(x) dihitung sbb :

x F(x)889192....

101103105

129

Akhirnya, buat rangkuman sbb :

Tabel, nilai kritis dari uji Lilliefors : α = 0,01 , n = 15 Dtab = 0,257 maka terima H0

x F(x) S(x)88 0,0401 0,067 0,026991 0,1292 0,133 0,003892 0,1788 0,200 0,021293 0,2358 0,267 0,031294 0,3050 0,400 0,095095 0,3821 0,533 0,1509 = D96 0,4602 0,600 0,139898 0,6255 0,667 0,0415101 0,8238 0,867 0,0432103 0,9115 0,933 0,0215105 0,9608 1,000 0,0392

TEST BASED ON RUNS

130

Usually a sample that is taken from a population should be random.The runs test evaluates the null hypothesis

H0 : the order of the sample data is randomThe alternative hypothesis is simply the negation of H0. There is no comparable parametric test to evaluate this null hypothesis.The order in which the data is collected must be retained so that the runs may be developed.

131

DEFINITIONS :1. A run is defined as a sequence of the same

symbols.Two symbols are defined, and each sequence must contain a symbol at least once.

2. A run of length j is defined as a sequence of j observations, all belonging to the same group, that is preceded or followed by observations belonging to a different group.

For illustration, the ordered sequence by the sex of the employee is as follows :F F F M F F F M M F F M M M F F M F M M M M M FFor the sex of the employee the ordered sequence exhibits runs of F’s and M’s.

132

The sequence begins with a run of length three, followed by a run of length one, followed by another run of length three, and so on.The total number of runs in this sequence is 11.Let R be the total number of runs observed in an ordered sequence of n1 + n2 observations, where n1 and n2 are the respective sample sizes. The possible values of R are 2, 3, 4, …. (n1 + n2 ).The only question to ask prior to performing the test is, Is the sample size small or large?We will use the guideline that a small sample has n1 and n2 less than or equal to 15.In the table, gives the lower rL and upper rU values of the distribution f(r) with α/2 = 0,025 in each tail.

133

If n1 or n2 exceeds 15, the sample is considered large, in which case a normal approximation to f(r) is used to test H0 versus H1.

f(r)

rARrL r

U

134

The mean and variance of R are determined to be

normal approximation

THE KRUSKAL - WALLIS H TEST

135

The Kruskal – Wallis H test is the nonparametric equivalent of the Analysis of Variance F test.It test the null hypothesis that all k populations possess the same probability distribution against the alternative hypothesis that the distributions differ in location – that is, one or more of the distributions are shifted to the right or left of each other.The advantage of the Kruskall – Wallis H test over the F test is that we need make no assumptions about the nature of sampled populations. A completely randomized design specifies that we select independent random samples of n1, n2 , …. nk observations from the k populations.

136

To conduct the test, we first rank all :n = n1 + n2 + n3 + … +nk observations and compute the rank sums, R1 , R2 , …, Rk for the k samples.The ranks of tied observations are averaged in the same manner as for the WILCOXON rank sum test.Then, if H0 is true, and if the sample sizes n1 , n2 , …, nk each equal 5 or more, then the test statistic is defined by :

will have a sampling distribution that can be approximated by a chi-square distribution with (k-1) degrees of freedom.Large values of H imply rejection of H0 .

137

Therefore, the rejection region for the test is , where is the value that located α in the upper tail of the chi- square distribution.

The test is summarized in the following :

KRUSKAL – WALLIS H TESTFOR COMPARING k POPULATION PROBABILITY DISTRIBUTIONS

138

H0 : The k population probability distributions are identicalH1 : At least two of the k population probability distributions differ in location

Test statistic :

where, ni = Number of measurements in sample iRi = Rank sum for sample i, where the rank of each measurement

is computed according to its relative magnitude in the totality

of data for the k samples.

139

n = Total sample size = n1 + n2 + … +nk Rejection Region : with (k-1) dofAssumptions :

1. The k samples are random and independent

2. There are 5 or more measurements in each sample

3. The observations can be rankedNo assumptions have to be made about the shape of the population probability distributions.

Example

140

Independent random samples of three different brands of magnetron tubes (the key components in microwave ovens) were subjected to stress testing, and the number of hours each operated without repair was recorded. Although these times do not represent typical life lengths, they do indicate how well the tubes can withstand extreme stress. The data are shown in table (below). Experience has shown that the distributions of life lengths for manufactured product are often non normal, thus violating the assumptions required for the proper use of an ANOVA F test.Use the K-S H test to determine whether evidence exists to conclude that the brands of magnetron tubes tend to differ in length of life under stress. Test using α = 0,05

141

BRAND A B C 36 49 71 48 33 31 5 60 140 67 2 59 53 55 42

Solusi

142

Lakukan ranking/peringkat dan jumlahkan peringkat dari 3 sample tersebut.

H0 : the population probability distributions of length of life under stress are identical for the three brands of magnetron tubes.versusH1 : at least two of the population probability distributions differ in location

A peringkat

B peringkat

C peringkat

36 5

49 8

71 14

48 7

33 4

31 3

5 2

60 12

140 15

67 13

2 1

59 11

53 9

55 10

42 6

R1 = 36

R2 = 35

R3 = 49

143

Test statistic :

H0 ???

f(H)

H1,22

5,99

top related