Example 1 – test of equality of variance for large... ————— 3/31/2004 8:27:58 PM ———————————————————— 252mvarex 4/06/05

advertisement

252mvarex 4/06/05 Minitab Examples of Tests for Equality of Variances

Example 1 – test of equality of variance for large samples.

————— 3/31/2004 8:27:58 PM ————————————————————

Welcome to Minitab, press F1 for help.

MTB > Retrieve "C:\Documents and Settings\RBOVE.WCUPANET\My Documents\Drive

D\MINITAB\bartlett1.MTW".

Retrieving worksheet from file: C:\Documents and Settings\RBOVE.WCUPANET\My

Documents\Drive D\MINITAB\bartlett1.MTW

# Worksheet was saved on Wed Mar 31 2004

Results for: bartlett1.MTW

MTB > describe c1-c4

Descriptive Statistics: s1, s2, s3, s4

Variable N Mean Median TrMean StDev SE Mean s1 31 -0.962 -1.145 -1.044 2.339 0.420 s2 15 0.052 -0.088 -0.051 2.154 0.556 s3 20 1.998 1.984 2.131 3.445 0.770 s4 42 0.066 0.008 -0.041 3.360 0.518

Variable Minimum Maximum Q1 Q3 s1 -5.408 5.268 -2.102 0.316 s2 -2.468 3.920 -2.093 1.394 s3 -5.201 6.797 -1.007 5.165 s4 -6.330 8.186 -2.129 1.587

1

252mvarex1 3/31/04

MTB > print c1-c4

Data Display This is the reconstructed data for

Bartlett Test

Example in 252mvar

Row s1 s2 s3 s4

1 -1.14481 -2.35661 -2.37257 -0.68164

2 -3.75468 1.28112 2.48574 -4.47822

3 0.31609 -2.38417 4.34545 0.12907

4 -3.32796 3.28997 6.79694 1.08077

5 -0.90303 -2.09316 4.56030 2.23035

6 -2.31875 0.56144 5.49388 1.14518

7 3.48176 -1.93507 6.06126 4.69290

8 -0.41916 0.45391 1.42648 1.71574

9 -4.98559 -2.46837 -2.03075 -1.58772

10 -1.59144 -0.08803 1.70938 -3.74374

11 -4.98725 -0.20482 5.23415 -4.56758

12 -1.40986 1.39435 -2.55932 -3.93202

13 0.14245 2.73224 2.25960 1.27105

14 0.52388 -1.31843 -0.51042 -0.66111

15 -1.39077 3.91964 1.15361 -4.50816

16 -1.54722 1.29051 2.49753

17 5.26812 6.02585 -1.97453

18 1.73404 -5.20091 -0.71953

19 -5.40784 4.95880 -4.27275

20 1.14133 -1.17221 2.83155

21 -1.17195 8.18588

22 -3.26684 1.07365

23 -2.01815 0.27719

24 -0.54529 -0.52695

25 -2.10166 -0.40461

26 0.19862 -6.32974

27 -0.51006 7.88240

28 -1.96248 -0.11337

29 0.55073 -5.41302

30 1.48555 -0.74814

31 0.10133 4.94961

32 -3.48670

33 0.38791

34 -0.32043

35 -2.59297

36 -0.31446

37 1.28942

38 6.13556

39 1.54460

40 0.33019

41 1.38072

42 3.10783

MTB > Stack c1-c4 c5; Data is put into a single column in c5 with labels in c6.

SUBC> UseNames.

SUBC> Subscripts c6;

2

252mvarex1 3/31/04

Note: The new version of Minitab has a change here. The subcommand is not needed unless you change the confidence level from 95% and the instruction below would simply read

Vartest c5 c6

But it really is unnecessary to stack the data and you could use vartest c2-c5; unstacked.

MTB > %Vartest c5 c6;

SUBC> Confidence 95.0.

Executing from file: W:\wminitab13\MACROS\Vartest.MAC

Macro is running ... please wait

Test for Equal Variances

Response stack

Factors labels

ConfLvl 95.0000

Bonferroni confidence intervals for standard deviations

Lower Sigma Upper N Factor Levels

1.76293 2.33860 3.40578 31 s1

1.45640 2.15411 3.90877 15 s2

2.44170 3.44504 5.64186 20 s3

2.62678 3.35969 4.59923 42 s4

Bartlett's Test (normal distribution)

Test Statistic: 7.438

P-Value : 0.059 Since the p-value is over 5%, do not reject the null hypothesis of equal variances at the

5% level.

Levene's Test (any continuous distribution)

Test Statistic: 2.083

P-Value : 0.107 Same Conclusion

Test for Equal Variances: stack vs labels

MTB > Retrieve "C:\Documents and Settings\RBOVE.WCUPANET\My Documents\Drive

D\MINITAB\bartlett2.MTW".

Retrieving worksheet from file: C:\Documents and Settings\RBOVE.WCUPANET\My

Documents\Drive D\MINITAB\bartlett2.MTW

# Worksheet was saved on Wed Mar 31 2004

Example 2: Test for equality of variances for small samples.

Results for: bartlett2.MTW

MTB > describe c1-c4

Descriptive Statistics: s1, s2, s3, s4

Variable N Mean Median TrMean StDev SE Mean s1 3 -0.24 0.26 -0.24 2.52 1.45 s2 3 0.730 1.349 0.730 1.153 0.666 s3 3 -0.57 0.32 -0.57 2.08 1.20 s4 4 1.93 1.67 1.93 2.08 1.04

3

Variable Minimum Maximum Q1 Q3 s1 -2.97 1.99 -2.97 1.99 s2 -0.600 1.442 -0.600 1.442 s3 -2.95 0.91 -2.95 0.91 s4 -0.13 4.50 0.07 4.04

252mvarex1 3/31/04

MTB > print c1-c4

Data Display This is the reconstructed data from another of Kanji’s examples.

Row s1 s2 s3 s4

1 1.98909 1.44173 0.32108 -0.13422

2 0.25843 1.34921 0.90819 2.67526

3 -2.96760 -0.59979 -2.95139 0.66330

4 4.49583

MTB > %Vartest c5 c6;

SUBC> Confidence 95.0.

Executing from file: W:\wminitab13\MACROS\Vartest.MAC

Macro is running ... please wait

Test for Equal Variances

Response stack

Factors labels

ConfLvl 95.0000

Bonferroni confidence intervals for standard deviations

Lower Sigma Upper N Factor Levels

1.11667 2.51566 31.7710 3 s1

0.51176 1.15289 14.5602 3 s2

0.92314 2.07967 26.2648 3 s3

1.02579 2.08202 12.4856 4 s4

Bartlett's Test (normal distribution)

Test Statistic: 0.947

P-Value : 0.814 Since the p-value is over 5%, do not reject the null hypothesis of equal variances at the

5% level.

Levene's Test (any continuous distribution)

Test Statistic: 0.379 See next example for computation of the test statistic. Note that conclusion is the same as for Bartlett’s test.

P-Value : 0.771

4

252mvarex1 3/31/04

Test for Equal Variances: stack vs labels

Graph for example 1

Test for Equal Variances for stack

95% Confidence Intervals for Sigmas Factor Levels s1

Bartlett's Test

Test Statistic: 7.438

P-Value : 0.059

s2 s3

Levene's Test

Test Statistic: 2.083

P-Value : 0.107

s4

1 2 3 4 5 6

Graph for example 2.

Test for Equal Variances for stack

95% Confidence Intervals for Sigmas Factor Levels s1

Bartlett's Test

Test Statistic: 0.947

P-Value : 0.814

s2 s3

Levene's Test

Test Statistic: 0.379

P-Value : 0.771

s4

0 10 20 30

5

252mvarex1 3/31/04

Example 3 – Explanation of Levene results in Example 2.

————— 3/31/2004 8:44:40 PM ————————————————————

Welcome to Minitab, press F1 for help.

MTB > Retrieve "C:\Documents and Settings\RBOVE.WCUPANET\My Documents\Drive

D\MINITAB\bartlett2.MTW".

Retrieving worksheet from file: C:\Documents and Settings\RBOVE.WCUPANET\My

Documents\Drive D\MINITAB\bartlett2.MTW

# Worksheet was saved on Wed Mar 31 2004

Results for: bartlett3.MTW

MTB > Save "C:\Documents and Settings\RBOVE.WCUPANET\My Documents\Drive

D\MINITAB\bartlett3.MTW";

SUBC> Replace.

Saving file as: C:\Documents and Settings\RBOVE.WCUPANET\My Documents\Drive

D\MINITAB\bartlett3.MTW

* NOTE * Existing file replaced.

MTB > describe c1-c4

Descriptive Statistics: s1, s2, s3, s4 This is original Bartlett 2 statistics

Variable N Mean Median TrMean StDev SE Mean s1 3 -0.24 0.26 -0.24 2.52 1.45 s2 3 0.730 1.349 0.730 1.153 0.666 s3 3 -0.57 0.32 -0.57 2.08 1.20 s4 4 1.93 1.67 1.93 2.08 1.04

Variable Minimum Maximum Q1 Q3 s1 -2.97 1.99 -2.97 1.99 s2 -0.600 1.442 -0.600 1.442 s3 -2.95 0.91 -2.95 0.91 s4 -0.13 4.50 0.07 4.04

MTB > let c1=c1-0.26

MTB > let c2=c2-1.349

MTB > let c3=c3-0.32

MTB > let c4=c4-1.67

MTB > describe c1-c4

Subtract medians from original data.

Descriptive Statistics: s1, s2, s3, s4

Variable N Mean Median TrMean StDev SE Mean s1 3 -0.50 -0.00 -0.50 2.52 1.45 s2 3 -0.619 0.000 -0.619 1.153 0.666 s3 3 -0.89 0.00 -0.89 2.08 1.20 s4 4 0.26 -0.00 0.26 2.08 1.04

Variable Minimum Maximum Q1 Q3 s1 -3.23 1.73 -3.23 1.73 s2 -1.949 0.093 -1.949 0.093 s3 -3.27 0.59 -3.27 0.59 s4 -1.80 2.83 -1.60 2.37

6

252mvarex1 3/31/04

MTB > let c1=abso(c1)

MTB > let c2=abso(c2)

MTB > let c3=abso(c3)

MTB > let c4=abso(c4)

MTB > print c1-c4

Data Display

Take absolute value of numbers after the median was subtracted.

This is what the Example 2 data looks like after medians are subtracted and absolute values taken.

Row s1 s2 s3 s4

1 1.72909 0.09273 0.00108 1.80422

2 0.00157 0.00021 0.58819 1.00526

3 3.22760 1.94879 3.27139 1.00670

4 2.82583

MTB > AOVOneway c1 c2 c3 c4. Do a one-way ANOVA on the revised data.

One-way ANOVA: s1, s2, s3, s4

Analysis of Variance

Source DF SS MS F P

Factor 3 2.02 0.67 0.38 0.770 Note that except for

Error 9 15.94 1.77

Total 12 17.96 rounding error this F and p are the same as in the

Previous example.

Individual 95% CIs For Mean

Based on Pooled StDev

Level N Mean StDev --------+---------+---------+-------- s1 3 1.653 1.614 (-----------*-----------) s2 3 0.681 1.099 (-----------*----------) s3 3 1.287 1.744 (-----------*----------) s4 4 1.661 0.863 (---------*---------)

--------+---------+---------+--------

Pooled StDev = 1.331 0.0 1.5 3.0

MTB >

7

Download