Re: [R] nested design

2014-05-15 Thread S Ellison
 I would like to apply a nested ANOVA on my dataset, but I cannot find a
 satisfying answer on how to implement it in R.

The simplest formula for a two-level nested design is resp~fac1/fac2

All of the models you list are equivalent to this after allowing for the fact 
that R drops duplicated model terms. For example, fac1+fac1/fac2 expands to 
fac1 + fac1 + fac1:fac2 ... which reduces to fac1+fac1:fac2.

All this is specified in some detail in ?formula.

S Ellison




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

__
R-help@r-project.org mailing list
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] nested design

2014-05-14 Thread Ivan Calandra

Dear useRs,

I would like to apply a nested ANOVA on my dataset, but I cannot find a 
satisfying answer on how to implement it in R.

For example, fac2 is nested within fac1:
df - data.frame(resp=rnorm(12), fac1=rep(LETTERS[1:2],each=6), 
fac2=rep(letters[1:6],each=2))


I have found three different ways that are said to be nested designs and 
I cannot understand whether they do the same or not. They all give 
similar results with this example but it might not always be the case.


1) following: 
http://www.personal.psu.edu/mar36/stat_461/nested/nested_designs.html

summary(aov(resp~fac1+fac1/fac2, data=df))

2) following: 
http://www.zoology.unimelb.edu.au/stats/Worksheets/nested%20two-way%20anova%20curdies.pdf

summary(aov(resp~fac1+fac2%in%fac1, data=df))
This notation is very intuitive to me.

3) following: 
http://cran.r-project.org/doc/contrib/Vikneswaran-ED_companion.pdf

summary(aov(resp~fac1+fac1:fac2, data=df))
For me, the : specifies the interaction. Is this then analogous since 
in a nested design the levels of fac2 are different in each level of fac1?



So my questions are: Are there differences between these notations? If 
yes, which ones? And then, which notation should I prefer?
And if they are identical, then why are there 3 (or more) ways to do it? 
Is there a reason not to have a single implementation?


Thank you in advance,
Ivan

--
Ivan Calandra
University of Franche-Comté
Laboratoire Chrono-Environnement
Bureau ATER -107L
16, Route de Gray
25030 Besançon Cedex, France
ivan.calan...@univ-fcomte.fr
+33 (0) 381 66 20 60
http://chrono-environnement.univ-fcomte.fr/spip.php?article1830

__
R-help@r-project.org mailing list
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] Nested design

2011-05-28 Thread unpeatable
Dear R-users, 
I have the following problem. I have performed an experiment for which I
gathered a lot of data which I now want to test. The problem is that I
cannot find an appropriate test in R (I am a starter) and someone might give
me a hand. This is what I have done: 
Across three sites (Site), I have laid out five transects (Trans)...meaning
five transects in each sites. In each transect I have five Microhabitats
(MH) which should be regarded as subplots (I think). In each transect, every
MH has the same position (so they are not randomized). I now want to test
the effect of Site and MH (nested in Trans) on my response variables. 

This is what I do now: model-aov(Response~Site*MH+error(Trans/MH)) 

I get the following output: 

Error: Trans 
 Df   Sum Sq  Mean Sq 
Site  1 0.030294 0.030294 

Error: Trans:MH 
 Df  Sum Sq Mean Sq 
Site  1 10.8367 10.8367 
MH3  0.2836  0.0945 

Error: Within 
  Df  Sum Sq Mean Sq F valuePr(F) 
Site   2 0.92504 0.46252 11.7304 5.880e-05 *** 
MH 4 1.86688 0.46672 11.8370 5.645e-07 *** 
Site:MH8 1.17041 0.14630  3.7105  0.001615 ** 
Residuals 54 2.12917 0.03943   
--- 
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

How do I read this? 
Any help appreciated! 

BTW: I also tried the lme function: model-lme(Response~Site*MH,
random=~1|Trans/MH) 
but then the output is really complicated.


-
Dr. Bjorn JM Robroek
Ecology and Biodiversity Group
Institute of Environmental Biology, Utrecht University
Padualaan 8, 3584 CH Utrecht, The Netherlands
Email address: b.j.m.robr...@uu.nl
http://www.researcherid.com/rid/C-4379-2008
Tel: +31-(0)30-253 6091
--
View this message in context: 
http://r.789695.n4.nabble.com/Nested-design-tp3557404p3557404.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] Nested design

2011-05-28 Thread Dennis Murphy
Hi:

Essentially, you are asking for free statistical advice, which is not
within the intended scope of R-help. It's always better to consult
with someone locally, and as luck would have it, your university
apparently provides free statistical consulting for faculty and grad
students:

http://www.uu.nl/faculty/socialsciences/EN/organisation/Departments/methodologystatistics/consultation/Pages/default.aspx

I would suggest that you contact someone there and have a face-to-face
discussion rather than a possibly extended back-and-forth on the Net.

Dennis

On Sat, May 28, 2011 at 6:09 AM, unpeatable bjorn.robr...@gmail.com wrote:
 Dear R-users,
 I have the following problem. I have performed an experiment for which I
 gathered a lot of data which I now want to test. The problem is that I
 cannot find an appropriate test in R (I am a starter) and someone might give
 me a hand. This is what I have done:
 Across three sites (Site), I have laid out five transects (Trans)...meaning
 five transects in each sites. In each transect I have five Microhabitats
 (MH) which should be regarded as subplots (I think). In each transect, every
 MH has the same position (so they are not randomized). I now want to test
 the effect of Site and MH (nested in Trans) on my response variables.

 This is what I do now: model-aov(Response~Site*MH+error(Trans/MH))

 I get the following output:

 Error: Trans
     Df   Sum Sq  Mean Sq
 Site  1 0.030294 0.030294

 Error: Trans:MH
     Df  Sum Sq Mean Sq
 Site  1 10.8367 10.8367
 MH    3  0.2836  0.0945

 Error: Within
          Df  Sum Sq Mean Sq F value    Pr(F)
 Site       2 0.92504 0.46252 11.7304 5.880e-05 ***
 MH         4 1.86688 0.46672 11.8370 5.645e-07 ***
 Site:MH    8 1.17041 0.14630  3.7105  0.001615 **
 Residuals 54 2.12917 0.03943
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 How do I read this?
 Any help appreciated!

 BTW: I also tried the lme function: model-lme(Response~Site*MH,
 random=~1|Trans/MH)
 but then the output is really complicated.


 -
 Dr. Bjorn JM Robroek
 Ecology and Biodiversity Group
 Institute of Environmental Biology, Utrecht University
 Padualaan 8, 3584 CH Utrecht, The Netherlands
 Email address: b.j.m.robr...@uu.nl
 http://www.researcherid.com/rid/C-4379-2008
 Tel: +31-(0)30-253 6091
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Nested-design-tp3557404p3557404.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 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-help@r-project.org mailing list
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] Nested design

2011-05-28 Thread unpeatable
Dear Dennis,
In my opinion I am not at all asking for any stats help, just a question how
to read this output. 
Thanks, Bjorn

-
Dr. Bjorn JM Robroek
Ecology and Biodiversity Group
Institute of Environmental Biology, Utrecht University
Padualaan 8, 3584 CH Utrecht, The Netherlands
Email address: b.j.m.robr...@uu.nl
http://www.researcherid.com/rid/C-4379-2008
Tel: +31-(0)30-253 6091
--
View this message in context: 
http://r.789695.n4.nabble.com/Nested-design-tp3557404p3557472.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] Nested design

2011-05-28 Thread Joshua Wiley
Hi,

If you are not asking for stats help, then do you understand the model
and are just confused by how R labels it?  We can help match R's
labels to the ones you are used to, if you tell us what you are used
to.

Cheers,

Josh

On Sat, May 28, 2011 at 6:54 AM, unpeatable bjorn.robr...@gmail.com wrote:
 Dear Dennis,
 In my opinion I am not at all asking for any stats help, just a question how
 to read this output.
 Thanks, Bjorn

 -
 Dr. Bjorn JM Robroek
 Ecology and Biodiversity Group
 Institute of Environmental Biology, Utrecht University
 Padualaan 8, 3584 CH Utrecht, The Netherlands
 Email address: b.j.m.robr...@uu.nl
 http://www.researcherid.com/rid/C-4379-2008
 Tel: +31-(0)30-253 6091
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Nested-design-tp3557404p3557472.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 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.




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

__
R-help@r-project.org mailing list
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] Nested design

2011-05-28 Thread Mike Marchywka












 Date: Sat, 28 May 2011 09:33:03 -0700
 From: jwiley.ps...@gmail.com
 To: bjorn.robr...@gmail.com
 CC: r-help@r-project.org
 Subject: Re: [R] Nested design

 Hi,

 If you are not asking for stats help, then do you understand the model
 and are just confused by how R labels it? We can help match R's
 labels to the ones you are used to, if you tell us what you are used
 to.


I would not suggest as a rule to use a tool to validate itself but
you can use R to make sure your interpretation of other R output is right by 
giving 
contrived datasets to the analysis package and see what you get back.
Comparison can be to examples from text book or your own paper and pencil
analysis.  This is also a good way to learn things from basic terms to
things like sign or unit conventions in different fields etc. 

You can generate samples from normal distro and feed that to
the questionable package to see what comes back. 



 Cheers,

 Josh

 On Sat, May 28, 2011 at 6:54 AM, unpeatable  wrote:
  Dear Dennis,
  In my opinion I am not at all asking for any stats help, just a question how
  to read this output.
  Thanks, Bjorn
 
  -
  Dr. Bjorn JM Robroek
  Ecology and Biodiversity Group
  Institute of Environmental Biology, Utrecht University
  Padualaan 8, 3584 CH Utrecht, The Netherlands
  Email address: b.j.m.robr...@uu.nl
  http://www.researcherid.com/rid/C-4379-2008
  Tel: +31-(0)30-253 6091
  --
  View this message in context: 
  http://r.789695.n4.nabble.com/Nested-design-tp3557404p3557472.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@r-project.org mailing list
  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.
 



 --
 Joshua Wiley
 Ph.D. Student, Health Psychology
 University of California, Los Angeles
 http://www.joshuawiley.com/

 __
 R-help@r-project.org mailing list
 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-help@r-project.org mailing list
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] nested design

2010-02-25 Thread ixi10

This is a nested design where team is nested in group. Method is fixed, while
team and group are random. Is this the correct R code for this?

gunload.aov - aov(rounds ~ method+group + Error((team %in%
group)/method),data=gunload, qr=T)
-- 
View this message in context: 
http://n4.nabble.com/nested-design-tp1569449p1569449.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.