The basic idea is to create a linear model in R such that FinH is explained
by SoilNkh, dDDSP, dDDSP2, Provenance, Site, Genotype and Block, where
SoilNkh, dDDSP and dDDSP2 are continuous covariates, Provenance, Site,
Genotype and Block are factors, Site and Provenance are fixed and Genotype
and Block are random. Also, Genotype is nested within Provenance and Block
within Site.
Since the order the variables go in is of importance, it should be a Anova
type-I with the parameters in following order:
FinH~SoilNkh,Site,dDDSP,dDDSP2,Provenance,Site:Provenance,Provenance/Genotype,Site/Block
For the fixed part I am ok? with either:
test31 <-lm(FinH~SoilNkh + Site + dDDSP + dDDSP2 + Provenance +
Site:Provenance ,data=d1)
test32 <-aov(FinH~SoilNkh + Site + dDDSP + dDDSP2 + Provenance +
Site:Provenance ,data=d1
When trying to specify the random-part, taking the above text as starting
point, trouble starts :)
I feel it should be of the form:
test64 <- lme(FinH~SoilNkh + Site + dDDSP + dDDSP2 + Provenance +
Site:Provenance,
random = ~1|Provenance/Genotype + ~1|Site/Block,data=d1)
but I can't avoid the error
"Error in getGroups.data.frame(dataMix, groups) : invalid formula for
groups"
I am lost for clues, really, so any advice would be great! If any data
should be supplied, I'd be happy to provide of course, but can't (yet)
figure out how...
Thanks in advance for your time.
--
B.J.H.M. Possen
[[alternative HTML version deleted]]
Bert Gunter
2018-Nov-24 22:44 UTC
[R] lme ->Error in getGroups.data.frame(dataMix, groups)
In brief, your random effects formula syntax is wrong. You need to (re) study ?lme or suitable tutorials for details of how to do what you want -- if you can with lme (e.g. crossed random effects are very difficult in lme, much easier in lmer). However, you should probably re-post on the r-sig-mixed-models list to receive better and *more expert* help. Cheers, Bert On Sat, Nov 24, 2018 at 2:31 PM Boy Possen <bpossen at gmail.com> wrote:> The basic idea is to create a linear model in R such that FinH is explained > by SoilNkh, dDDSP, dDDSP2, Provenance, Site, Genotype and Block, where > SoilNkh, dDDSP and dDDSP2 are continuous covariates, Provenance, Site, > Genotype and Block are factors, Site and Provenance are fixed and Genotype > and Block are random. Also, Genotype is nested within Provenance and Block > within Site. > > Since the order the variables go in is of importance, it should be a Anova > type-I with the parameters in following order: > > FinH~SoilNkh,Site,dDDSP,dDDSP2,Provenance,Site:Provenance,Provenance/Genotype,Site/Block > > > For the fixed part I am ok? with either: > > test31 <-lm(FinH~SoilNkh + Site + dDDSP + dDDSP2 + Provenance + > Site:Provenance ,data=d1) > > test32 <-aov(FinH~SoilNkh + Site + dDDSP + dDDSP2 + Provenance + > Site:Provenance ,data=d1 > > When trying to specify the random-part, taking the above text as starting > point, trouble starts :) > > I feel it should be of the form: > > test64 <- lme(FinH~SoilNkh + Site + dDDSP + dDDSP2 + Provenance + > Site:Provenance, > random = ~1|Provenance/Genotype + ~1|Site/Block,data=d1) > > but I can't avoid the error > > "Error in getGroups.data.frame(dataMix, groups) : invalid formula for > groups" > > I am lost for clues, really, so any advice would be great! If any data > should be supplied, I'd be happy to provide of course, but can't (yet) > figure out how... > > Thanks in advance for your time. > > > -- > B.J.H.M. Possen > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >[[alternative HTML version deleted]]