anovas ss typeI vs typeIII

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

anovas ss typeI vs typeIII

jacaranda
Hi all,
I have been struggling with ANOVAs on R. I am new to R, so I created a simple data frame, and I do some analyses on R just to learn R and then check them on SPSS to make sure that I am doing fine. Here is the problem that I've run into:

when we use the aov function, it uses SS Type I as default (on SPSS it is Type III). Then I used the Anova function under cars package using the command:

mod <- lm(DV
~ IV1*IV2, data = mydata,
contrasts=list(IV1=contr.sum,
IV2=contr.sum))
Anova(mod, type=”3”)

Above, both of my IVs are between-SS variables. But still, results from this model do not match the results from SPSS (I have to say they are not too different either). But I was wondering if I am doing something wrong. If what I am doing is okay, then my next question is can I use the same set of commands (for Anova function) if one of my IVs was within-SS and the other IV was between-SS?


Thank you very much!
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: anovas ss typeI vs typeIII

David Winsemius

On May 19, 2012, at 6:58 PM, jacaranda tree wrote:

> Hi all,
> I have been struggling with ANOVAs on R. I am new to R, so I created  
> a simple data frame, and I do some analyses on R just to learn R and  
> then check them on SPSS to make sure that I am doing fine. Here is  
> the problem that I've run into:
>
> when we use the aov function, it uses SS Type I as default (on SPSS  
> it is Type III). Then I used the Anova function under cars package  
> using the command:
>
> mod <- lm(DV
> ~ IV1*IV2, data = mydata,
> contrasts=list(IV1=contr.sum,
> IV2=contr.sum))
> Anova(mod, type=”3”)

Are you perhaps having a problem due to using a non-plain-text editor?  
Those quotes look "wrong".

compare " with ”

I do not think the second version of double-quote will be recognized  
correctly.


>
> Above, both of my IVs are between-SS variables. But still, results  
> from this model do not match the results from SPSS (I have to say  
> they are not too different either). But I was wondering if I am  
> doing something wrong. If what I am doing is okay, then my next  
> question is can I use the same set of commands (for Anova function)  
> if one of my IVs was within-SS and the other IV was between-SS?
>
>
> Thank you very much!
> [[alternative HTML version deleted]]

Part of learning R is moving away from pretty versions of formatting,

--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: anovas ss typeI vs typeIII

Peter Dalgaard-2
In reply to this post by jacaranda

On May 20, 2012, at 00:58 , jacaranda tree wrote:

> Hi all,
> I have been struggling with ANOVAs on R. I am new to R, so I created a simple data frame, and I do some analyses on R just to learn R and then check them on SPSS to make sure that I am doing fine. Here is the problem that I've run into:
>
> when we use the aov function, it uses SS Type I as default (on SPSS it is Type III). Then I used the Anova function under cars package using the command:
>
> mod <- lm(DV
> ~ IV1*IV2, data = mydata,
> contrasts=list(IV1=contr.sum,
> IV2=contr.sum))
> Anova(mod, type=”3”)
>
> Above, both of my IVs are between-SS variables. But still, results from this model do not match the results from SPSS (I have to say they are not too different either). But I was wondering if I am doing something wrong. If what I am doing is okay, then my next question is can I use the same set of commands (for Anova function) if one of my IVs was within-SS and the other IV was between-SS?

Please at least provide some output to show the difference (both systems). It's pretty hard to guess what might have gone wrong based on partial code for one system and no data...

(There are good reasons that base R doesn't do Type III SS. In my experience, they are either identical to Type I or test a hypothesis much more bizarre than the user expects.)


> Thank you very much!
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: anovas ss typeI vs typeIII

Helios de Rosario
In reply to this post by jacaranda
Hi, you should give more details of your problem (at least some output,
as Peter Daalgard says). But you are probably asking for something like
this:
http://www.r-bloggers.com/anova-%E2%80%93-type-iiiiii-ss-explained/
or many other webpages that you may find if you Google or R-seek with
keywords like "anova" "type i", "type iii", etc.

If you have within-subjects factors, the same commands will not give
you a sensible result. If you want to use Anova() for that, you should
use the arguments "idata", "idesign", etc., as explained in the help
page of that function, or in the web appendix to the "CAR" book:
http://socserv.mcmaster.ca/jfox/Books/Companion/appendix/Appendix-Multivariate-Linear-Models.pdf

Helios De Rosario



--
Helios de Rosario Martínez
 
 Researcher


>>> El día 20/05/2012 a las 0:58, jacaranda tree
<[hidden email]> escribió:
> Hi all,
> I have been struggling with ANOVAs on R. I am new to R, so I created
a
> simple data frame, and I do some analyses on R just to learn R and
then check
> them on SPSS to make sure that I am doing fine. Here is the problem
that I've
> run into:
>
> when we use the aov function, it uses SS Type I as default (on SPSS
it is
> Type III). Then I used the Anova function under cars package using
the
> command:
>
> mod <- lm(DV
> ~ IV1*IV2, data = mydata,
> contrasts=list(IV1=contr.sum,
> IV2=contr.sum))
> Anova(mod, type=”3”)
>
> Above, both of my IVs are between-SS variables. But still, results
from this
> model do not match the results from SPSS (I have to say they are not
too
> different either). But I was wondering if I am doing something wrong.
If what
> I am doing is okay, then my next question is can I use the same set
of
> commands (for Anova function) if one of my IVs was within-SS and the
other IV
> was between-SS?
>
>
> Thank you very much!


INSTITUTO DE BIOMECÁNICA DE VALENCIA
Universidad Politécnica de Valencia • Edificio 9C
Camino de Vera s/n • 46022 VALENCIA (ESPAÑA)
Tel. +34 96 387 91 60 • Fax +34 96 387 91 69
www.ibv.org

  Antes de imprimir este e-mail piense bien si es necesario hacerlo.
En cumplimiento de la Ley Orgánica 15/1999 reguladora de la Protección
de Datos de Carácter Personal, le informamos de que el presente mensaje
contiene información confidencial, siendo para uso exclusivo del
destinatario arriba indicado. En caso de no ser usted el destinatario
del mismo le informamos que su recepción no le autoriza a su divulgación
o reproducción por cualquier medio, debiendo destruirlo de inmediato,
rogándole lo notifique al remitente.

______________________________________________
[hidden email] 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.