Hello and thanks in advance

I am running a glm in R the code is as follows with residual diagnostic code
below 

model4<-glm(Biomass~(Treatment+Time+Site)^2, data=bobB,
family=quasi(link="log", variance="mu"))

par(mfrow=c(2,2))

plot(model2)

 

to test the effect of grazing exclusion of feral horses for a Phd with
following factors:

Treatment - 3 levels which are grazed controls (C), ungrazed horse
exclosures (H)with 3 wire strand fence to allow other herbivores but not
horses and ungrazed full netting exclosures to exclude all herbivores (A)

Site -  6 levels for 6 Sites which are considered fixed

Time - 6 levels also for 6 different monitoring or time periods which is
where the repeated measures comes in

In SPSS there is the option for Bartlett's test of sphericity and Levene's
test for whether the variability is homogenous or not.  Is it possible to do
the same in R with glm?  If not, what is the equivalent for testing these
assumptions?  Also, is it valid to use Tukey's post hocs to test main
effects if necessary?  If not, is there another method other than contrasts,
something to do with multicomp?

 

In a previous model where Site was random I used the following lme model 

model2<-lme(Anncov~Treat*Time, random=~1|Site,
data=bob,control=list(opt="optim"))

And checked residuals using:

 

print(shapiro.test(model1$residuals))

print(qqnorm(model1))

 

#resids vs fitted

plot(model1,resid(.,type="p")~fitted(.)|Site, abline=0)

 

#boxplot of resids

plot(model1,Anncov~fitted(.)|Site, abline=c(0,1))

 

And because you can't use Mauchly sphericity test used instead:

  

library(ts)

bob$resids<-model1$residuals[,2]

site.level<-levels(bob$Site)

 

par(mfrow=c(4,4), mar=c(2,4,0,0), oma=c(2,2,4,2))

for (i in seq(along=site.level)){

datain<-bob$Site==site.level[i]

 

acf(bob[datain,"resids"],xlab="", ylab="",

main=paste("Site", site.level[i]),las=1)

                } #end loop

 

BUT WHEN I TRIED THE ABOVE FOR GLM IT WOULD NOT WORK

 

And because can't use Tukeys used contrasts but heard recently about
multicomp?

I also checked and compared several variance covariance symmetry's using the
following: 

 

compoundspec<-lme(Anncov~Treat*Time, random=~1|Site,
data=bob,cor=corCompSymm(,form=~1|Site), control=list(opt="optim"))

 

autoregressivesite<-lme(Anncov~Treat*Time, random=~1|Site,
data=bob,cor=corAR1(,form=~1|Site), control=list(opt="optim"))

 

autoheterosite<-lme(Anncov~Treat*Time, random=~1|Site,
data=bob,cor=corAR1(,form=~1|Site),weight=varIdent(form=~1|Time),
control=list(opt="optim"))

unstructsite<-lme(Anncov~Treat*Time, random=~1|Site,
data=bob,cor=corSymm(,form=~1|Site),weight=varIdent(form=~1|Time),
control=list(opt="optim"))

And then anova to compare the models

SHOULD I DO THE SAME BUT IS THERE A BETTER WAY?

 

SO IN SUMMARY - BACK TO ORIGINAL QUESTION HOW TO TEST ASSUMPTIONS OF GLM IN
R?

 

Many many thanks in advance for anyone who reads or responds.


	[[alternative HTML version deleted]]


