[R] (two way) ANCOVA and subsequent multiple comparison tests
Richard M. Heiberger
rmh at temple.edu
Thu Jan 15 06:44:06 CET 2015
You found the HH package. That is a good start.
Look at the ?MMC help page, and specifically at the entire maiz example.
For an example with two factors and a covariate and with multiple comparisons
look at the apple example in file
system.file("scripts/hh2", package="HH")
The example is in chunks 18-32
The file is intended as support for the section in my book that
provides the discussion.
Heiberger, R. M. and Holland, B. (2004). Statistical Analysis and Data
Display: An Intermediate Course with Examples in S-Plus, R, and SAS.
Springer-Verlag, New York, first edition.
Section 14.6 is the apple example.
I am willing to provide specific support for your example, but to do
so I will need
"commented, minimal, self-contained, reproducible code." Fake data
would be ok as long as the
structure is the same as the real data.
Rich
On Wed, Jan 14, 2015 at 2:59 PM, lindsay hanford
<lindsay.hanford at gmail.com> wrote:
> Hello R Community!
>
> I am an intermediate-level R user and I am trying to figure out how program
> a two-way (Group and MCCB score) ANCOVA analysis and subsequent post-hoc
> analysis.
> My factors:
> Group (2 levels)
> Score (2 levels)
> Covariates:
> Age (continuous)
> ICV (continuous)
> Sex (M/F)
> Y:
> GMV(continuous)
>
> I am interested in looking at the interaction of these two factors and have
> set up my ANCOVA as follows:
>
> *model1 <-aov(GMV~ GROUP*Score +Age +ICV +Sex, data=dataframe)*
> *summary(model1) *
>
> which has given me some very exciting results...
>
> Analysis of Variance Table
> Response: GMV
> Df Sum Sq Mean Sq F value Pr(>F)
> GROUP 1 104219614 104219614 25.119 1.739e-06 ***
> Score 1 231825545 231825545 55.875 1.042e-11 ***
> Sex 1 49112001 49112001 11.837 0.0007828 ***
> Age 1 165812317 165812317 39.964 3.882e-09 ***
> ICV 1 283849872 283849872 68.414 1.416e-13 ***
> GROUP:Score 1 30802470 30802470 7.424 0.0073292 **
> Residuals 129 535224714 4149029
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> I need to control for multiple comparisons as I will be trying other
> variables in place of GMV. From the forum, TukeyHSD() will not work as I
> have covariates. The glth() shows promise, however, I am not sure if the
> resulting statistics are what I am looking for?
>
> *mc1<-mcalinfct(model1, "GROUP")*
> *summary(glht(model1, linfct=mc1))*
>
> Simultaneous Tests for General Linear Hypotheses
> Fit: aov(formula = GMV ~ GROUP * Score + Age + ICV +Sex, data =dataframe)
>
> Linear Hypotheses:
> Estimate Std. Error t value Pr(>|t|)
> 1 == 0 -844.9 392.2 -2.154 0.0331 *
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> (Adjusted p values reported -- single-step method)
>
> I believe this means that the difference in GMVs is statistical significant
> between my groups (pcor = 0.03). Does this also mean that my interaction is
> significant? If not, how do I test for that? My intention is to be able to
> create a graphic of this interaction similar to the attached.
>
> I tried using previous posts from the help forum. I believe this post holds
> the answer, but it is beyond my R programming ability. If someone could
> help explain...
>
> http://r.789695.n4.nabble.com/Multiple-comparisons-for-a-two-factor-ANCOVA-td1593039.html
> http://cran.r-project.org/web/packages/HH/HH.pdf
>
> Thanks!
>
>
> Lindsay
>
> --
> Lindsay Hanford, BSc, PhD Candidate
> McMaster Integrative Neuroscience Discovery & Study | *Department of
> Psychology, Neuroscience & Behaviour *
> McMaster University *|* 1280 Main Street West, PC329 Psychology Building *|*
> Hamilton, ON, L8S 4L8
> 905 525 9140 x24784 *|* lindsay.hanford at gmail.com
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list