加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

问题9、如何用SPSS作方差分析比较?(转)

(2010-12-11 10:23:41)
标签:

方差

自变量

因素

显著性

分析

分类: 统计

问题9、如何用SPSS作方差分析比较?


我们的实例是Kirk (1968, 第一版)的数据库crf24

get file 'd:\crf24.sav'.

这些数据来源于2因素4水平的析因设计,不过仍可以作为单因素方差分析的实例。变量y是因变量。变量a是2水平的自变量,b是4水平的自变量。

用单因素方差分析的比较命令

glm y by b.

Between-Subjects Factors

 

N

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

194.500(a)

3

64.833

44.276

.000

Intercept

924.500

1

924.500

631.366

.000

B

194.500

3

64.833

44.276

.000

Error

41.000

28

1.464

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .826 (Adjusted R Squared = .807)

means tables = y by b
 / cells mean. 

Case Processing Summary

 

Cases

Included

Excluded

Total

N

Percent

N

Percent

N

Percent

Y * B

32

100.0%

0

.0%

32

100.0%

Report
Mean

B

Y

1

2.75

2

3.50

3

6.25

4

9.00

Total

5.38

显而易见,自变量b的全部F检验都有显著性。现在,设计一些能够进行检验的比较:
(1)第3组与第4组比较
(2)第1,2组的均数与第3,4组的均数比较
(3)第1,2,3组的均数与第4组比较

glm y by b     /contrast(b)=special (0 0 1 -1).

Between-Subjects Factors

 

N

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

194.500(a)

3

64.833

44.276

.000

Intercept

924.500

1

924.500

631.366

.000

B

194.500

3

64.833

44.276

.000

Error

41.000

28

1.464

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .826 (Adjusted R Squared = .807)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.605

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.989

Upper Bound

-1.511


Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

30.250

1

30.250

20.659

.000

Error

41.000

28

1.464

 

 

glm y by b   /contrast(b)=special (1 1 -1 -1).

Between-Subjects Factors

 

N

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

194.500(a)

3

64.833

44.276

.000

Intercept

924.500

1

924.500

631.366

.000

B

194.500

3

64.833

44.276

.000

Error

41.000

28

1.464

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .826 (Adjusted R Squared = .807)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-9.000

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-9.000

Std. Error

.856

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-10.753

Upper Bound

-7.247

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

162.000

1

162.000

110.634

.000

Error

41.000

28

1.464

 

 

glm y by b   /contrast(b)=special (1 1 1 -3). 

Between-Subjects Factors

 

N

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

194.500(a)

3

64.833

44.276

.000

Intercept

924.500

1

924.500

631.366

.000

B

194.500

3

64.833

44.276

.000

Error

41.000

28

1.464

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .826 (Adjusted R Squared = .807)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-14.500

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-14.500

Std. Error

1.482

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-17.536

Upper Bound

-11.464

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

140.167

1

140.167

95.724

.000

Error

41.000

28

1.464

 

 

注意到可对每一因素作多重比较,如下所示。每次比较必须用逗号隔开。当每次检验的差异有显著性时,便不输出t值。若想获得t值,就不得不在比较结果表(K 矩阵)中按标准误将比较的估计值分开。

glm y by b   ?/contrast(b)=special (0 0 1 -1, 1 1   -1 -1,? 1 1 1 -3).

Between-Subjects Factors

 

N

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

194.500(a)

3

64.833

44.276

.000

Intercept

924.500

1

924.500

631.366

.000

B

194.500

3

64.833

44.276

.000

Error

41.000

28

1.464

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .826 (Adjusted R Squared = .807)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.605

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.989

Upper Bound

-1.511

L2

Contrast Estimate

-9.000

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-9.000

Std. Error

.856

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-10.753

Upper Bound

-7.247

L3

Contrast Estimate

-14.500

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-14.500

Std. Error

1.482

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-17.536

Upper Bound

-11.464

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

192.250

2

96.125

65.646

.000

Error

41.000

28

1.464

 

 

用双因素方差分析的比较命令我们用双因素方差分析对变量b作同样的比较。

glm y by a b.

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

glm y by a b    /contrast(b)=special (0 0 1 -1).

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.439

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.656

Upper Bound

-1.844

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

30.250

1

30.250

39.243

.000

Error

18.500

24

.771

 

 

glm y by a b    /contrast(b)=special (1 1 -1 -1).

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-9.000

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-9.000

Std. Error

.621

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-10.281

Upper Bound

-7.719

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

162.000

1

162.000

210.162

.000

Error

18.500

24

.771

 

 

glm y by a b   /contrast(b)=special (1 1 1 -3).

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-14.500

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-14.500

Std. Error

1.075

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-16.719

Upper Bound

-12.281

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

140.167

1

140.167

181.838

.000

Error

18.500

24

.771

 

 

注意到双因素方差分析的F值要比单因素方差分析的F值大。是因为均方残差变小的缘故。
SPSS有许多可用的内置比较方法,每一种都是仅有的(如上例)。下面给出带有解释的比较结果列表以及语句如何执行的实例。比较第1和第2组,第2和第3组,第3和第4组,见比较结果表(K矩阵)。


Name of contrast

Comparison made

Simple

Compares each level of a variable to the last level (or whichever level is specified).

Deviation

Compares deviations from the grand mean.

Difference

Compares levels of a variable with the mean of the previous levels of the variable.

Helmert

Compare levels of a variable with the mean of the subsequent levels of the variable.

Polynomial

Orthogonal polynomial contrasts.

Repeated

Adjacent levels of a variable.

Special

User-defined contrast.

glm y by a b   /contrast(b)=repeated.

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Repeated Contrast

Y

Level 1 vs. Level 2

Contrast Estimate

-.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-.750

Std. Error

.439

Sig.

.100

95% Confidence Interval for Difference

Lower Bound

-1.656

Upper Bound

.156

Level 2 vs. Level 3

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.439

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.656

Upper Bound

-1.844

Level 3 vs. Level 4

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.439

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.656

Upper Bound

-1.844

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

194.500

3

64.833

84.108

.000

Error

18.500

24

.771

 

 

用双因素方差分析的比较命令我们用双因素方差分析对变量b作同样的比较。

glm y by a b.

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

 

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

glm y by a b   /contrast(b)=special (0 0 1 -1).

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.439

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.656

Upper Bound

-1.844

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

30.250

1

30.250

39.243

.000

Error

18.500

24

.771

 

 

glm y by a b     /contrast(b)=special (1 1 -1 -1).

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-9.000

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-9.000

Std. Error

.621

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-10.281

Upper Bound

-7.719

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

162.000

1

162.000

210.162

.000

Error

18.500

24

.771

 

 

glm y by a b    /contrast(b)=special (1 1 1 -3).

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Special Contrast

Y

L1

Contrast Estimate

-14.500

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-14.500

Std. Error

1.075

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-16.719

Upper Bound

-12.281

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

140.167

1

140.167

181.838

.000

Error

18.500

24

.771

 

 

注意到双因素方差分析的 F值要比单因素方差分析的F值大。这是因为均方残差变小的缘故。
SPSS有许多可用的内置比较方法,每一种都是仅有的(如上例)。下面给出带有解释的比较结果列表以及语句如何执行的实例。比较第1和第2组,第2和第3组,第3和第4组,见比较结果表(K矩阵)。


Name of contrast

Comparison made

Simple

Compares each level of a variable to the last level (or whichever level is specified).

Deviation

Compares deviations from the grand mean.

Difference

Compares levels of a variable with the mean of the previous levels of the variable.

Helmert

Compare levels of a variable with the mean of the subsequent levels of the variable.

Polynomial

Orthogonal polynomial contrasts.

Repeated

Adjacent levels of a variable.

Special

User-defined contrast.

glm y by a b        /contrast(b)=repeated.

Between-Subjects Factors

 

N

A

1

16

2

16

B

1

8

2

8

3

8

4

8

Tests of Between-Subjects Effects
Dependent Variable: Y

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Corrected Model

217.000(a)

7

31.000

40.216

.000

Intercept

924.500

1

924.500

1199.351

.000

A

3.125

1

3.125

4.054

.055

B

194.500

3

64.833

84.108

.000

A * B

19.375

3

6.458

8.378

.001

Error

18.500

24

.771

 

 

Total

1160.000

32

 

 

 

Corrected Total

235.500

31

 

 

 

a R Squared = .921 (Adjusted R Squared = .899)

Contrast Results (K Matrix)

 

Dependent Variable

B Repeated Contrast

Y

Level 1 vs. Level 2

Contrast Estimate

-.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-.750

Std. Error

.439

Sig.

.100

95% Confidence Interval for Difference

Lower Bound

-1.656

Upper Bound

.156

Level 2 vs. Level 3

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.439

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.656

Upper Bound

-1.844

Level 3 vs. Level 4

Contrast Estimate

-2.750

Hypothesized Value

0

Difference (Estimate - Hypothesized)

-2.750

Std. Error

.439

Sig.

.000

95% Confidence Interval for Difference

Lower Bound

-3.656

Upper Bound

-1.844

Test Results
Dependent Variable: Y

Source

Sum of Squares

df

Mean Square

F

Sig.

Contrast

194.500

3

64.833

84.108

.000

Error

18.500

24

.771

 

 

 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有