Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Repeated ANOVA


From   David Airey <[email protected]>
To   [email protected]
Subject   st: Repeated ANOVA
Date   Tue, 23 Sep 2003 09:40:05 -0500

I don't know; seems to work. See below.

-dave
------------------------------------------------------------------------ --------
log: /Applications/Stata/Stata Data/ricard.txt
log type: text
opened on: 23 Sep 2003, 09:38:15

.
. clear

. set obs 80 /* 10 subject x 2 x 2 x 2 = 80 obs */
obs was 0, now 80

. egen subject = seq(), from(1) to(10) block(8)

. egen f1 = seq(), from(1) to(2) block(4)

. egen f2 = seq(), from(1) to(2) block(2)

. egen f3 = seq(), from(1) to(2) block(1)

. gen y = 10*invnorm(uniform())

.
. list

+------------------------------------+
| subject f1 f2 f3 y |
|------------------------------------|
1. | 1 1 1 1 -.669175 |
2. | 1 1 1 2 -4.684053 |
3. | 1 1 2 1 7.084165 |
4. | 1 1 2 2 1.249271 |
5. | 1 2 1 1 -5.305963 |
|------------------------------------|
6. | 1 2 1 2 9.615972 |
7. | 1 2 2 1 -9.83189 |
8. | 1 2 2 2 2.456799 |
9. | 2 1 1 1 9.184555 |
10. | 2 1 1 2 -4.613061 |
|------------------------------------|
11. | 2 1 2 1 10.02648 |
12. | 2 1 2 2 -4.037093 |
13. | 2 2 1 1 8.884632 |
14. | 2 2 1 2 -.6621271 |
15. | 2 2 2 1 -9.299623 |
|------------------------------------|
16. | 2 2 2 2 23.50853 |
17. | 3 1 1 1 -5.000916 |
18. | 3 1 1 2 -6.375933 |
19. | 3 1 2 1 3.150148 |
20. | 3 1 2 2 -10.03736 |
|------------------------------------|
21. | 3 2 1 1 1.626022 |
22. | 3 2 1 2 -.1011391 |
23. | 3 2 2 1 -3.856239 |
24. | 3 2 2 2 11.73656 |
25. | 4 1 1 1 -5.882869 |
|------------------------------------|
26. | 4 1 1 2 -12.48455 |
27. | 4 1 2 1 5.485632 |
28. | 4 1 2 2 6.549452 |
29. | 4 2 1 1 17.11606 |
30. | 4 2 1 2 -10.07228 |
|------------------------------------|
31. | 4 2 2 1 -4.122631 |
32. | 4 2 2 2 -7.181778 |
33. | 5 1 1 1 -3.937787 |
34. | 5 1 1 2 -7.912708 |
35. | 5 1 2 1 -5.622947 |
|------------------------------------|
36. | 5 1 2 2 -12.77129 |
37. | 5 2 1 1 -9.059765 |
38. | 5 2 1 2 -4.171543 |
39. | 5 2 2 1 -5.199472 |
40. | 5 2 2 2 -8.514087 |
|------------------------------------|
41. | 6 1 1 1 -31.90681 |
42. | 6 1 1 2 20.25146 |
43. | 6 1 2 1 6.167145 |
44. | 6 1 2 2 -2.160845 |
45. | 6 2 1 1 3.283273 |
|------------------------------------|
46. | 6 2 1 2 -1.328125 |
47. | 6 2 2 1 -9.189685 |
48. | 6 2 2 2 1.644604 |
49. | 7 1 1 1 2.125283 |
50. | 7 1 1 2 -7.302464 |
|------------------------------------|
51. | 7 1 2 1 4.963583 |
52. | 7 1 2 2 9.083357 |
53. | 7 2 1 1 -16.14481 |
54. | 7 2 1 2 -10.39951 |
55. | 7 2 2 1 -11.5256 |
|------------------------------------|
56. | 7 2 2 2 -12.77034 |
57. | 8 1 1 1 .3458641 |
58. | 8 1 1 2 1.295759 |
59. | 8 1 2 1 4.236438 |
60. | 8 1 2 2 24.45607 |
|------------------------------------|
61. | 8 2 1 1 -4.872988 |
62. | 8 2 1 2 -.7544302 |
63. | 8 2 2 1 -3.152115 |
64. | 8 2 2 2 -14.4615 |
65. | 9 1 1 1 -.4586687 |
|------------------------------------|
66. | 9 1 1 2 13.54083 |
67. | 9 1 2 1 .8798925 |
68. | 9 1 2 2 7.176355 |
69. | 9 2 1 1 3.513673 |
70. | 9 2 1 2 4.002752 |
|------------------------------------|
71. | 9 2 2 1 -2.711983 |
72. | 9 2 2 2 13.05697 |
73. | 10 1 1 1 -9.267018 |
74. | 10 1 1 2 10.07973 |
75. | 10 1 2 1 1.002743 |
|------------------------------------|
76. | 10 1 2 2 -4.517168 |
77. | 10 2 1 1 13.3716 |
78. | 10 2 1 2 -2.607474 |
79. | 10 2 2 1 17.58486 |
80. | 10 2 2 2 -6.293949 |
+------------------------------------+

.
. anova y subject ///
> f1 / f1*subject ///
> f2 / f2*subject ///
> f3 / f3*subject ///
> f1*f2 f2*f3 f1*f3 /, ///
> repeated(f1 f2 f3)

Number of obs = 80 R-squared = 0.4439
Root MSE = 10.4038 Adj R-squared = -0.1874

Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 3196.34551 42 76.1034645 0.70 0.8656
|
subject | 1040.03433 9 115.55937 1.07 0.4597
f1 | 32.3599924 1 32.3599924 0.30 0.5971
f1*subject | 970.35042 9 107.816713
-----------+----------------------------------------------------
f2 | 48.0192135 1 48.0192135 4.72 0.0578
f2*subject | 91.5262177 9 10.1695797
-----------+----------------------------------------------------
f3 | 20.4794157 1 20.4794157 0.24 0.6387
f3*subject | 780.772416 9 86.7524907
-----------+----------------------------------------------------
f1*f2 | 211.552237 1 211.552237 1.95 0.1704
f2*f3 | .17397846 1 .17397846 0.00 0.9682
f1*f3 | 1.07728387 1 1.07728387 0.01 0.9211
|
Residual | 4004.83992 37 108.238917
-----------+----------------------------------------------------
Total | 7201.18543 79 91.154246


Between-subjects error term: subject
Levels: 10 (9 df)
Lowest b.s.e. variable: subject

Repeated variable: f1
Huynh-Feldt epsilon = 1.0000
Greenhouse-Geisser epsilon = 1.0000
Box's conservative epsilon = 1.0000

------------ Prob > F ------------
Source | df F Regular H-F G-G Box
-----------+----------------------------------------------------
f1 | 1 0.30 0.5971 0.5971 0.5971 0.5971
f1*subject | 9
-----------+----------------------------------------------------

Repeated variable: f2
Huynh-Feldt epsilon = 1.0000
Greenhouse-Geisser epsilon = 1.0000
Box's conservative epsilon = 1.0000

------------ Prob > F ------------
Source | df F Regular H-F G-G Box
-----------+----------------------------------------------------
f2 | 1 4.72 0.0578 0.0578 0.0578 0.0578
f2*subject | 9
-----------+----------------------------------------------------

Repeated variables: f1*f2
Huynh-Feldt epsilon = 1.0000
Greenhouse-Geisser epsilon = 1.0000
Box's conservative epsilon = 1.0000

------------ Prob > F ------------
Source | df F Regular H-F G-G Box
-----------+----------------------------------------------------
f1*f2 | 1 1.95 0.1704 0.1704 0.1704 0.1704
Residual | 37
-----------+----------------------------------------------------

Repeated variable: f3
Huynh-Feldt epsilon = 1.0000
Greenhouse-Geisser epsilon = 1.0000
Box's conservative epsilon = 1.0000

------------ Prob > F ------------
Source | df F Regular H-F G-G Box
-----------+----------------------------------------------------
f3 | 1 0.24 0.6387 0.6387 0.6387 0.6387
f3*subject | 9
-----------+----------------------------------------------------

Repeated variables: f1*f3
Huynh-Feldt epsilon = 1.0000
Greenhouse-Geisser epsilon = 1.0000
Box's conservative epsilon = 1.0000

------------ Prob > F ------------
Source | df F Regular H-F G-G Box
-----------+----------------------------------------------------
f1*f3 | 1 0.01 0.9211 0.9211 0.9211 0.9211
Residual | 37
-----------+----------------------------------------------------

Repeated variables: f2*f3
Huynh-Feldt epsilon = 1.0000
Greenhouse-Geisser epsilon = 1.0000
Box's conservative epsilon = 1.0000

------------ Prob > F ------------
Source | df F Regular H-F G-G Box
-----------+----------------------------------------------------
f2*f3 | 1 0.00 0.9682 0.9682 0.9682 0.9682
Residual | 37
-----------+----------------------------------------------------

.
. /*
> anova lhdna subject ///
> type / type*subject ///
> inct / inct*subject ///
> coltime / coltime*subject ///
> inct*type coltime*type coltime*inct / , ///
> repeated(coltime inct type)
>
> */
.
. log close
log: /Applications/Stata/Stata Data/ricard.txt
log type: text
closed on: 23 Sep 2003, 09:38:22
------------------------------------------------------------------------ --------

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index