
Hi Steven,

thank you again so much for your help and for the transformation of the data. In fact I knew that there are these empty lines in the data. I couldn't take them off with the program I have. I tried to solve this problems with using the "levels".
You are right, the statistical tests are working now! But I get another error message than the one you cite:
Warnmeldung:
In mcp2matrix(model, linfct = linfct) :
  covariate interactions found -- default contrast might be inappropriate
"contrast might be inappropriate" does it mean that the means are not significantly different? Anyways my standard error seems to be always bigger than the difference of the mean, so none of these data from different provenances is significantly different, right?
I am not sure if I should have done a log transform or another transform of my data. I used this code to examine the data:

par(mfrow = c(1,2))
plot(fitted(PAM.lme), resid(PAM.lme), xlab = "fitted", ylab = "residuals")


# to check for homogeneity of variance
qqnorm(resid(PAM.lme), main = "")
qqline(resid(PAM.lme), main = "", col = 2)

But I am not sure if I interpreted it in the right way.
Hope you are doing fine! Many greetings from Tanzania!
Lilith




Am 04.12.2010 um 00:34 schrieb Steven McKinney [via R]:

> Just to close this thread, Lilith provided the data which was in a .csv text file 
> and had multiple lines of blank data at the end 
> 
> species;code;treatment;pretreatment;provenance;greenhouse;individual;leaf;Date;DataPAM 
> Ae;c-ae-1-1-3;C;C;1;1;3;1;25.05.10 14:00; 0.665 
> . 
> . 
> . 
> Ae;w-ae-6-3-4;C;W;6;3;4;3;23.06.10 12:30; 0.622 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> ;;;;;;;;; 
> 
> Removing the blank (NA) rows of data and keeping all variables in the dataframe resolves the issue. 
> 
> (Free floating variables yield this error 
> > summary(glht(PAM.lme, linfct = mcp(Provenancef = "Tukey"))) 
> Error in `[.data.frame`(mf, nhypo[checknm]) : undefined columns selected) 
> 
> 
> Steven McKinney 
> ________________________________________ 
> From: [hidden email] [[hidden email]] On Behalf Of Steven McKinney [[hidden email]] 
> Sent: December 2, 2010 2:03 PM 
> To: 'Lilith'; [hidden email] 
> Subject: Re: [R] Tukey Test, lme, error: less than two groups 
> 
> Comments in-line below 
> 
> > -----Original Message----- 
> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Lilith 
> > Sent: December-02-10 9:39 AM 
> > To: [hidden email] 
> > Subject: [R] Tukey Test, lme, error: less than two groups 
> > 
> > 
> > Dear R-group, 
> > 
> > I am trying desperately to get this Tukey test working. Its my first time 
> > here so I hope my question is not too stupid, but I couldn't find anything 
> > helpful in the help or in the forum. 
> > 
> > I am analysing a dataset of treated grasses. I want to find out, if the 
> > grasses from different Provenances react differently. 
> > In the aov test I found a significance for the combination Treatment and 
> > provenance: 
> > 
> > summary(PAMaov<-aov(PAMval~Treatmentf*Pretreatmentf*Provenancef+Error(Datef/Code))) 
> > 
> > Treatmentf:Provenancef               p-value:  0.008023 ** 
> > 
> > In the Linear fixed effects model lme, I can see that there is a 
> > significance for two provenances (HU and ES) 
> > 
> > summary(PAM.lme<-lme(PAMval~Treatmentf*Provenancef*Pretreatmentf, random= 
> > ~1|Datef/Code,na.action=na.omit)) 
> > 
> >                                               Value  Std.Error  DF   t-value 
> > p-value 
> > (Intercept)                               0.6890317 0.06117401 994 11.263473 
> > 0.0000 
> > TreatmentfF                              -0.2897619 0.05484590 467 -5.283201 
> > 0.0000 
> > ProvenancefDE                             0.0105873 0.05484590 467  0.193037 
> > 0.8470 
> > 
> > TreatmentfF:ProvenancefES                 0.1647302 0.08226884 467  2.002340 
> > 0.0458 
> > TreatmentfF:ProvenancefHU                 0.1569524 0.07756381 467  2.023526 
> > 0.0436 
> > 
> > No the big mystery is the Tukey test. I just can't find the mistake, it 
> > keeps telling me, that there are " less than two groups" 
> > 
> > summary(glht(PAM.lme, linfct = mcp(Provenancef = "Tukey"))) 
> > 
> > Fehler in contrMat(table(mf[[nm]]), type = types[pm]) : 
> >   less than two groups 
> > 
> > I guess its important to know that I made factors out of some of the data. 
> > Here is the code: 
> > 
> > 
> > PAMdata$provenance[PAMdata$provenance == "5"] = "ES" 
> > PAMdata$provenance[PAMdata$provenance == "6"] = "HU" 
> > # etc. 
> > 
> > Treatmentf <- factor(PAMdata$treatment, levels=c("C","F")) 
> > Datef <- factor(PAMdata$Date, levels=c( "25.05.10 14:00","26.05.10 
> > 19:00","27.05.2010 7:30","27.05.10 14:00","01.06.10 14:00","02.06.10 
> > 19:00","23.06.10 12:30"),ordered=TRUE) 
> > 
> > 
> > Pretreatmentf <- as.factor(PAMdata$pretreatment) 
> > Provenancef <- as.factor(PAMdata$provenance) 
> > Greenhousef <- as.factor(PAMdata$greenhouse) 
> > Individualf <- as.factor(PAMdata$individual) 
> > 
> > PAMval <- (PAMdata$DataPAM) 
> > Code<-(PAMdata$code)
> 
> I suspect the problem is the creation of all these individual variables. 
> 
> Try instead 
> 
> PAMdata$Treatmentf <- factor(PAMdata$treatment, levels=c("C","F")) 
> PAMdata$Datef <- factor(PAMdata$Date, levels=c( "25.05.10 14:00","26.05.10 
>  19:00","27.05.2010 7:30","27.05.10 14:00","01.06.10 14:00","02.06.10 
>  19:00","23.06.10 12:30"),ordered=TRUE) 
> ... 
> PAMdata$PAMval <- (PAMdata$DataPAM) 
> PAMdata$Code<-(PAMdata$code) 
> etc. 
> 
> so that all of your required variables are variables in the dataframe PAMdata. 
> 
> When you pass off fitted model objects to additional functions, the 
> additional functions often require access to the dataframe used in the 
> initial modeling.  Then call lme with 
> 
> summary(PAM.lme<-lme(PAMval~Treatmentf*Provenancef*Pretreatmentf, random= 
>  ~1|Datef/Code, data = PAMdata, na.action=na.omit)) 
> 
> then try 
> 
> summary(glht(PAM.lme, linfct = mcp(Provenancef = "Tukey"))) 
> 
> again. 
> 
> (If you still get an error, run the 
> 
> traceback() 
> 
> command and provide that information.) 
> 
> 
> I'm also wondering why no term for Pretreatmentf shows in your model output. 
> After setting up the factor variables in the PAMdata dataframe, what does the 
> command 
> 
> with(PAMdata, table(Pretreatmentf, Provenancef, Treatmentf)) 
> 
> show?  Is Pretreatmentf even needed in the model? 
> 
> The output of the command 
> 
> sessionInfo() 
> 
> is also useful to help people figure out such issues. 
> 
> Also, if you can share the data, or a mock-up of it, others will 
> be able to run code examples, and not just guess. 
> 
> HTH 
> 
> Steve McKinney 
> 
> > 
> > Thank you for any hint! That Tukey test seems so easy, I just can't find the 
> > mistake.... 
> > Thank you very much fpr your help and greetings from Tanzania, 
> > Lilith 
> > 
> > -- 
> > View this message in context: http://r.789695.n4.nabble.com/Tukey-Test-lme-error-less-than-two-groups-
> > tp3069789p3069789.html 
> > Sent from the R help mailing list archive at Nabble.com. 
> > 
> > ______________________________________________ 
> > [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.
> 
> ______________________________________________ 
> [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. 
> 
> ______________________________________________ 
> [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. 
> 
> 
> View message @ http://r.789695.n4.nabble.com/Tukey-Test-lme-error-less-than-two-groups-tp3069789p3071801.html
> To unsubscribe from Tukey Test, lme, error: less than two groups, click here.


-- 
View this message in context: http://r.789695.n4.nabble.com/Tukey-Test-lme-error-less-than-two-groups-tp3069789p3075027.html
Sent from the R help mailing list archive at Nabble.com.

	[[alternative HTML version deleted]]

