[R-sig-ME] lme ->Error in getGroups.data.frame(dataMix, groups)

Ben Bolker bbolker @ending from gm@il@com
Tue Dec 11 23:40:29 CET 2018


  Didn't read carefully, but: lme does not allow crossed random
effects without considerable effort (there is an example somewhere in
the later chapters of Pinheiro and Bates's book).  You r model
specification

 test64 <- lme(FinH~SoilNkh + Site + dDDSP + dDDSP2 + Provenance +
Site:Provenance,
            random = ~1|Provenance/Genotype + ~1|Site/Block,data=d1)

appears to specify crossed provenance/genotype and site/block REs.

If you can use lme4::lmer it should be easier (note RE is specified as
an additive term within the single formula argument).

On Tue, Dec 11, 2018 at 12:17 PM Boy Possen <bpossen using 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-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list