[R-sig-ME] [R] lme nesting/interaction advice
Ken Beath
kjbeath at kagi.com
Mon May 12 11:05:07 CEST 2008
On 12/05/2008, at 4:52 AM, Federico Calboli wrote:
> On 10 May 2008, at 07:36, Kingsford Jones wrote:
>> Federico,
>>
>> I think you'll be more likely to receive the type of response you're
>> looking for if you formulate your question more clearly. The
>> inclusion of "commented, minimal, self-contained, reproducible code"
>> (as is requested at the bottom of every email sent by r-help) is an
>> effective way to clarify the issues. Also, when asking a question
>> about fitting a model it's helpful to describe the specific research
>> questions you want the model to answer.
>
> <snip>
>
> I apprecciate that my description of the *full* model is not 100%
> clear, but my main beef was another.
>
> The main point of my question is, having a 3 way anova (or ancova,
> if you prefer), with *no* nesting, 2 fixed effects and 1 random
> effect, why is it so boneheaded difficult to specify a bog standard
> fully crossed model? I'm not talking about some rarified esoteric
> model here, we're talking about stuff tought in a first year Biology
> Stats course here[1].
>
> Now, to avoid any chances of being misunderstood in my use of the
> words 'fully crossed model', what I mean is a simple
>
> y ~ effect1 * effect2 * effect3
>
> with effect3 being random (all all the jazz that comes from this
> fact). I fully apprecciate that the only reasonable F-tests would be
> for effect1, effect2 and effect1:effect2, but there is no way I can
> use lme to specify such simple thing without getting the *wrong*
> denDF. I need light on this topic and I'd say it's a general enough
> question not to need much more handholding than this.
>
There is only one random effect, so where does the crossing come
from ? The fixed effects vary across blocks, but they are fixed so are
just covariates. For this type of data the usual model in lme4 is
y~fixed1+fixed2+1|group and for lme split into fixed and random parts.
> Having said that, I did look at the mixed-effects mailing list
> before posting here, and it looks like it was *not* the right place
> to post anyway:
>
> 'This mailing list is primarily for useRs and programmeRs interested
> in *development* and beta-testing of the lme4 package.'
>
> although the R-Me is now CC'd in this.
>
> I fully apprecciate that R is developed for love, not money, and if
> I knew how to write an user friendly frontend for nlme and lme4 (and
> I knew how to actually get the model I want) I'd be pretty happy to
> do so and submit it as a library. In any case, I feel my complaint
> is pefectly valid, because specifying such basic model should
> ideally not such a chore, and I think the powers that be might
> actually find some use from user feedback.
>
The problems seems to be that you want lme to work in the same way as
an ANOVA table and it doesn't. The secret with lme and lme4 is to
think about the structure of the data and describe with an equation.
Then each term in the equation corresponds to part of the model
definition in R.
> Once I have sorted how to specify such trivial model I'll face the
> horror of the nesting, in any case I attach a toy dataset I created
> especially to test how to specify the correct model (silly me).
>
I'm a bit lost with your data file, it has 4 covariates, which is more
than enough for 2 fixed effects, assuming block is the grouping and y
the outcome.
Ken
> Best,
>
> Federico Calboli
>
> [1] So much bog standard that the Zar, IV ed, gives a nice table of
> how to compute the F-tests correctly, taking into account that one
> of the 3 effects is randon (I'll send the exact page and table
> number tomorrow, I don't have the book at home).
>
> <testdat.txt>
> --
> Federico C. F. Calboli
> Department of Epidemiology and Public Health
> Imperial College, St. Mary's Campus
> Norfolk Place, London W2 1PG
>
> Tel +44 (0)20 75941602 Fax +44 (0)20 75943193
>
> f.calboli [.a.t] imperial.ac.uk
> f.calboli [.a.t] gmail.com
>
>
>
> _______________________________________________
> R-sig-mixed-models at 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