Re: [R] aov and Error function

2015-02-02 Thread peter dalgaard

On 02 Feb 2015, at 13:09 , S Ellison s.elli...@lgcgroup.com wrote:

 
 aovsubj - aov(value~group+time+Error(subject),data=dataRMANOVA)
 and
 aovsubjgroup - aov(value~group+time+Error(subject/group),data=dataRMANOVA)
 
 Since no-one else seems to have answered you let me point out that your first
 formulation treats subject 1 in the int group as being the same as subject 
 1 in
 the cont group, and similarly for subject 2 and so on.
 
 The second formulation (subject nested within group) treats subject 1 in the
 int group as being *different* from subject 1 in the cont group.
 
 Yes, but that isn't all, is it? 
 
 subject/group
 
 means group nested in subject, expanding to 
 ~subject+subject:group.
 
 so Error(subject/group) asks for a subject effect across groups _as well as_ 
 one within groups.
 


Or maybe more usefully stated, a group effect within subjects. This could be 
relevant if each individual goes to two different groups labeled say 1 and 2, 
but the groups are not related between different subjects (subj.1 attends AA 
and Boy Scouts, subj 2 School Board and Church, etc.) so there is no main 
effect of group. In statistics, it is usually the other way around: subjects 
arbitrarily numbered 1-20 within each group, but no relation between subj.1 
in one group and subj.2 of the other, in which case ~group + 
Error(group:subject) makes sense. 


 S Ellison
 
 
 ***
 This email and any attachments are confidential. Any =...{{dropped:24}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] aov and Error function

2015-02-02 Thread S Ellison

  aovsubj - aov(value~group+time+Error(subject),data=dataRMANOVA)
  and
  aovsubjgroup - aov(value~group+time+Error(subject/group),data=dataRMANOVA)
 
 Since no-one else seems to have answered you let me point out that your first
 formulation treats subject 1 in the int group as being the same as subject 
 1 in
 the cont group, and similarly for subject 2 and so on.
 
 The second formulation (subject nested within group) treats subject 1 in the
 int group as being *different* from subject 1 in the cont group.

Yes, but that isn't all, is it? 

subject/group

means group nested in subject, expanding to 
~subject+subject:group.

so Error(subject/group) asks for a subject effect across groups _as well as_ 
one within groups.

S Ellison


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] aov and Error function

2015-02-01 Thread Rolf Turner

On 01/02/15 02:17, John Sorkin wrote:

I am trying to understand the Error function and its use in ANOVA. In
particular I want to understand the difference between two models
that differ only with respect to the Error statement:


aovsubj - aov(value~group+time+Error(subject),data=dataRMANOVA)
and
aovsubjgroup - aov(value~group+time+Error(subject/group),data=dataRMANOVA)

You will note that in my data I have two subject identifiers,
subject and subject2. I am also trying to trying to understand how I
should identify subjects, within group (i.e. intervention vs.
control) or within time (0=baseline, 1=post)


Since no-one else seems to have answered you let me point out that your 
first formulation treats subject 1 in the int group as being the same

as subject 1 in the cont group, and similarly for subject 2 and so on.

The second formulation (subject nested within group) treats subject 1 in 
the int group as being *different* from subject 1 in the cont group.


If you were using subject2 instead of subject there would (I *think*) be 
no difference between the two formulations.


HTH

cheers,

Rolf Turner

--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] aov and Error function

2015-01-31 Thread John Sorkin
I am trying to understand the Error function and its use in ANOVA. In 
particular I want to understand the difference between two models that differ 
only with respect to the Error statement:


aovsubj- aov(value~group+time+Error(subject),data=dataRMANOVA)
and
aovsubjgroup-aov(value~group+time+Error(subject/group),data=dataRMANOVA)
 
You will note that in my data I have two subject identifiers, subject and 
subject2. I am also trying to trying to understand how I should identify 
subjects, within group (i.e. intervention vs. control) or within time 
(0=baseline, 1=post)


 dataRMANOVA
   value time group subject subject2
1   1.000   int   11
2   2.000   int   22
3   3.000   int   33
4   4.000   int   44
5   5.000   int   55
6   6.000   int   66
7   7.000   int   77
8   8.000   int   88
9   9.000   int   99
10 10.000   int  10   10
11 11.000   int  11   11
12 12.000   int  12   12
13 13.000   int  13   13
14 14.000   int  14   14
15 15.000   int  15   15
16 16.000   int  16   16
17 17.000   int  17   17
18 18.000   int  18   18
19 19.000   int  19   19
20 20.000   int  20   20
21 21.000  cont   1   21
22 22.000  cont   2   22
23 23.000  cont   3   23
24 24.000  cont   4   24
25 25.000  cont   5   25
26 26.000  cont   6   26
27 27.000  cont   7   27
28 28.000  cont   8   28
29 29.000  cont   9   29
30 30.000  cont  10   30
31 31.000  cont  11   31
32 32.000  cont  12   32
33 33.000  cont  13   33
34 34.000  cont  14   34
35 35.000  cont  15   35
36 36.000  cont  16   36
37 37.000  cont  17   37
38 38.000  cont  18   38
39 39.000  cont  19   39
40 40.000  cont  20   40
41  2.8791311   int   11
42  1.5336511   int   22
43  2.4877561   int   33
44  3.4460681   int   44
45  5.1798541   int   55
46  5.7758191   int   66
47  6.9239791   int   77
48  8.1637341   int   88
49  9.5459741   int   99
50  8.7921861   int  10   10
51 11.6575031   int  11   11
52 12.6813931   int  12   12
53 15.0586881   int  13   13
54 13.7576731   int  14   14
55 15.4590291   int  15   15
56 15.5355491   int  16   16
57 16.4332371   int  17   17
58 17.2473301   int  18   18
59 19.0619271   int  19   19
60 21.1650031   int  20   20
61 20.4367051  cont   1   21
62 23.1432301  cont   2   22
63 23.4569461  cont   3   23
64 23.1322841  cont   4   24
65 24.9020171  cont   5   25
66 26.4503991  cont   6   26
67 27.3569431  cont   7   27
68 27.4020231  cont   8   28
69 29.7598831  cont   9   29
70 27.9696281  cont  10   30
71 30.0614751  cont  11   31
72 32.5324271  cont  12   32
73 33.3788771  cont  13   33
74 34.8522441  cont  14   34
75 34.9585941  cont  15   35
76 35.6732251  cont  16   36
77 37.9082081  cont  17   37
78 37.9824711  cont  18   38
79 39.0169171  cont  19   39
80 39.5075831  cont  20   40


Thank you,
John


John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 


Confidentiality Statement:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized use, disclosure or distribution is prohibited. If you are not 
the intended recipient, please contact the sender by reply email and destroy 
all copies of the original message. 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.