[R] Post-hoc after Anova() car package using linear.hypothesis() in a Repeated Measure Analysis

"Alejandro Luis Collantes Chávez-Costa" collants at uqroo.mx
Thu Sep 27 19:44:45 CEST 2007


R masters:

I need your help to figure out how can I perform Post-hoc test after “Anova()” “car package” using “linear.hypothesis()” in a Repeated Measure Analysis.

I performed a Repeated Measures Analysis to test the effect of Category, Season and their Interaction on some ecological properties using “Anova()” from “car package”.
I find some significant effect and now I would like to know where the differences are. In order to perform these Within, Between and within-between post hoc’s Professor John Fox recommend me to use “linear.hypothesis()” and a Bonferonni adjustment of the p-values.

After a couple of weeks of work, I can not figure out how to do that. I am very sorry, I did my best but I am not statistician and I can not find examples to understand how can I use linear.hypothesis() in post hoc test.

There are someone who can help me?

P.D.  (I am very thankful to Professor Richard Heiberger who give me advices about the use of “glht.mmc()” with the “calpha” argument).


For those who can help me, I am posting some extra information about my case and my attempts:

The experiment design was as follow: 1 between subjects (fixed factor with 3 levels) and 1 within subjects (fixed factor with 3 levels). Between subjects are nine plots grouped into 3 age category (tree plot for each age category “T”, “I”, “M”), and Within category are 3 season of the year  "llu”, “nor”, “sec" (equidistant in the time scale). The data set is:

lludiversity	nordiversity	secdiversity	Plot	Category	Season
1.96601	2.10215	2.17984	07A	T	llu
1.73697	1.96866	1.99766	10B	T	llu
1.87122	1.92848	2.2673	10C	T	llu
2.06851	1.98455	2.43838	15B	I	llu
2.17905	2.49451	2.25759	15C	I	llu
2.2572	2.16882	2.58295	17A	I	llu
1.99913	2.43767	2.29582	60A	M	llu
2.12738	2.64161	2.5385	60B	M	llu
2.22421	2.42401	2.5385	60C	M	llu

To test the effect of Category, Season and their Interaction on some ecological properties I use the following code:

rm(list=ls(all=TRUE))
library(lattice);
library(Matrix);
library(car);
setwd(“c:/R help/”);
diversity.tbl <- read.table("diversity.txt", header=TRUE);
Season <- factor(c("Lluvias","Nortes","Secas"), levels=c("Lluvias","Nortes","Secas"));
idata.df <- data.frame(Season) # Within “plot”;
Plot <- diversity.tbl[,4];
Category <- factor(diversity.tbl[,5], levels=c("T", "I", "M")) #Between “plot”;
dLluvias <- diversity.tbl[,1];
dNortes <- diversity.tbl[,2];
dSecas <- diversity.tbl[,3];
datalm.df <- data.frame(Plot, Category, dLluvias, dNortes, dSecas);
diversitylm.ok <- lm(cbind(dLluvias, dNortes, dSecas) ~ Category, data=datalm.df);
diversityav.ok <- Anova(diversitylm.ok, idata=idata.df, type="II", idesign=~Season);
summary(diversityav.ok, multivariate=FALSE);
diversityav.ok

To try perform post hoc test I did:
linear.hypothesis(diversitylm.ok, c("(Intercept)=CategoryM"), idata=idata.df, idesign=~Season, iterms="Season"); #To contrast Intercept (Category T) and Category M


Alejandro Collantes Chávez-Costa
Universidad de Quintana Roo, Unidad Cozumel

http://www.cozumel.uqroo.mx


More information about the R-help mailing list