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

re: st: Re: ancova for repeated designs


From   David Airey <[email protected]>
To   [email protected]
Subject   re: st: Re: ancova for repeated designs
Date   Sun, 15 Aug 2004 08:48:33 -0500

Ammending my comments after Joseph Coveney's comments:

. clear

.
. set obs 30
obs was 0, now 30

.
. egen id = seq(), from(1) to(10) block(3)

. egen t = seq(), from(1) to(3) block(1)

. egen g = seq(), from(1) to(3) block(3)

.
. gen y = invnorm(uniform())

.
. sort id t

. bysort id: gen x = y[1]

.
. list in 1/9, sep(3)

+------------------------------------+
| id t g y x |
|------------------------------------|
1. | 1 1 1 -.2711983 -.2711983 |
2. | 1 2 1 1.305697 -.2711983 |
3. | 1 3 1 -.9267018 -.2711983 |
|------------------------------------|
4. | 2 1 2 1.007973 1.007973 |
5. | 2 2 2 .1002743 1.007973 |
6. | 2 3 2 -.4517168 1.007973 |
|------------------------------------|
7. | 3 1 3 1.33716 1.33716 |
8. | 3 2 3 -.2607474 1.33716 |
9. | 3 3 3 1.758486 1.33716 |
+------------------------------------+

.
. anova y g / id|g x x*g t g*t if t > 1, repeated(t) continuous(x)

Number of obs = 20 R-squared = 0.4821
Root MSE = .906211 Adj R-squared = -0.4058

Source | Partial SS df MS F Prob > F

-----------+----------------------------------------------------
Model | 5.35051558 12 .445876298 0.54 0.8317
|
g | .354589496 2 .177294748 0.31 0.7500
id|g | 2.29205779 4 .573014447

-----------+----------------------------------------------------
x | .832198807 1 .832198807 1.01 0.3476
x*g | .20357273 2 .101786365 0.12 0.8853
t | .13150485 1 .13150485 0.16 0.7010
g*t | .869877597 2 .434938799 0.53 0.6107
|
Residual | 5.74852951 7 .821218502

-----------+----------------------------------------------------
Total | 11.0990451 19 .584160268


Between-subjects error term: id|g
Levels: 10 (4 df)
Lowest b.s.e. variable: id
Covariance pooled over: g (for repeated variable)

Repeated variable: t
Huynh-Feldt epsilon = 2.6667
*Huynh-Feldt epsilon reset to 1.0000
Greenhouse-Geisser epsilon = 1.0000
Box's conservative epsilon = 1.0000

------------ Prob > F ------------
Source | df F Regular H-F G-G Box

-----------+----------------------------------------------------
t | 1 0.16 0.7010 0.7010 0.7010 0.7010
g*t | 2 0.53 0.6107 0.6107 0.6107 0.6107
Residual | 7

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

.
. adjust x if id<=4, by(g t id)

--------------------------------------------------------------------------------
Dependent variable: y Command: anova
Covariate set to mean: x = .36113495
--------------------------------------------------------------------------------

------------------------------------------------------------------------
| id and t
| ------------- 1 ------------ ------------- 2 ------------
g | 1 2 3 1 2 3
----------+-------------------------------------------------------------
1 | -.135936 -.135706
2 | .740559 .470278
3 |
------------------------------------------------------------------------

------------------------------------------------------------------------
| id and t
| ------------- 3 ------------ ------------- 4 ------------
g | 1 2 3 1 2 3
----------+-------------------------------------------------------------
1 | -.252478 -.252248
2 |
3 | .562489 1.32355
------------------------------------------------------------------------
Key: Linear Prediction

.
.
.
end of do-file

.



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