[R-sig-ME] Model with interaction alone
Pierre Montpied
montpied at nancy.inra.fr
Tue Jan 28 14:35:20 CET 2014
Hi list,
I could not find any answer to my problem thus I post it on this list.
I have a design where sites (Site) are nested in different regions
(Reg) and a pair of plots in each site
is assigned two levels of a treatment (Trait).
I fit this model with lme (or lmer) with two crossed fixed factors
(Reg *Trait) and a random factor Site
All works fine when I fit the complete model "Response~Reg + Treat +
Reg:Treat"t or equivalently "Response~Reg*Trait"
But when I try the interaction alone by "Response~Reg:Trait" I get the
error message:
"Error in MEEM(object, conLin, control$niterEM) : Singularity in
backsolve at level 0, block 1".
When I replace "Reg:Trait" by "interaction(Reg,Trait)" or by
"factor(Reg:Trait)" all works fine
whereas these should be equivalent to "Reg:Trait"
Any explanation ?
Below is a script simulating this
library(nlme)
Nrep<-10 # replicates = site number per region
Data<-data.frame(expand.grid(c("T1","T2"),rep(c("R1","R2"),each=Nrep)),
Site=paste("S",rep(1:(Nrep*2),each=2),sep="")
)
names(Data)<-c("Trait","Reg","Site")
Data$Trait<-factor(Data$Trait)
Data$Reg<-factor(Data$Reg)
Data$Site<-factor(Data$Site)
Data$RegTrait<-factor(paste(Data$Reg,Data$Trait,sep="."))
str(Data)
table(Data$Reg,Data$Trait,Data$Site)
table(Data$Site,Data$Trait,Data$Reg)
Mu<-20 # Intercept
Alpha2<-1 # Fixed effect Trait
Beta2<-2 # Fixed effect Region
Gamma22<-2 # Interaction Trait:Region
Sigi<-1.5 # Random effect Site
Sige<-1 # Residual
# Simulation:
Data$Rep<- Mu +
Alpha2*(Data$Trait=="T2") +
Beta2*(Data$Reg=="R2") +
Gamma22*(Data$Reg=="R2")*(Data$Trait=="T2") +
rep(rnorm(Nrep*2,0,Sigi),each=2) +
rnorm(Nrep*4,0,Sige)
Modele.lme<-lme(Rep~Trait*Reg,
random=~1|Site,
data=Data)# OK
Modele.lme<-lme(Rep~Trait + Reg + Trait:Reg,
random=~1|Site,
data=Data)# OK
# Interaction alone:
Modele.lme<-lme(Rep~Trait:Reg,
random=~1|Site,
data=Data)# Error:
# Error in MEEM(object, conLin, control$niterEM) :
# Singularity in backsolve at level 0, block 1
Modele.lme<-lme(Rep~interaction(Trait,Reg),
random=~1|Site,
data=Data)# OK
Modele.lme<-lme(Rep~factor(Trait:Reg),
random=~1|Site,
data=Data)# OK
Thank in advance
--
=========================================================================
Pierre MONTPIED
INRA Université de Lorraine Tel : (33) 3 83 39 40 74
UMR EEF Ecophysiologie Ecologie Forestières FAX : (33) 3 83 39 40 69
F-54280 CHAMPENOUX
http://www.nancy.inra.fr montpied at nancy.inra.fr
More information about the R-sig-mixed-models
mailing list