[R-sig-ME] random factor selection

Ben Bolker bbolker at gmail.com
Sun Nov 20 21:43:31 CET 2011


Kirstin-Friederike Heise <kheise at ...> writes:

>  Hello R-list, I am trying to fit a mixed model with the
> library(nlme) to a continuous outcome variable (lnX2FTtrans =>
> reaction times in ms, logarithmic transformation), being interested
> in the influence of factor age, as well as two separate estimates
> physiological parameters resulting from estimation of former
> analyses (best linear unbiased predictors , "blupREST",
> "blupTIMEST") and their interaction with age.

 You do know that there's some question about incorporating
BLUPs in further analyses, right?  (I don't have detailed
knowledge of this, just think that it's controversial
in some circles ...)

 
> After excluding non significant interactions, my model looks like
> this: 

mBZ2<- lme(lnX2FTtrans~age+blupREST+blupTIMEST+age*blupTIMEST, 
  data=dta, random= ~1|subject, na.action=na.exclude,method="REML")


  You don't technically need to specifyage+blupTIMEST here because
age*blupTIMEST expands to age+blupTIMEST+age:blupTIMEST.  It 
doesn't do any harm (except potential confusion), though.
 
> I would like to control for the influence of sex, which is not
> balanced among my (convenience) sample. I wonder wether I need to
> include it as fixed effect or if it is in any way reasonable to
> include it as a random factor. I read that dichotomous variables
> should rather be modeled as fixed factors? Is this a general "rule"?

  There are many criteria for deciding between fixed and random
(see <http://glmm.wikidot.com/faq> for some), but (at least) two
of the criteria strongly suggest that sex should be fixed:
(1) there aren't enough levels to estimate an among-level variance with 
any reasonable power;
(2) it doesn't make sense to imagine 'male' and 'female' as having been
chosen at random from a population of potential sexes that could
have been included in the model

> Having tried to put "sex" as  random =~ sex | subject

  This doesn't make much sense at all, because this is specifying
that the effect of switching from one sex to the other varies
among subjects. Unless you are dealing with sex-switching organisms
(which do exist), the 'sex' factor cannot vary within subject,
hence this variance cannot be estimated.

> this apparently slightly improved my model (p<.05) , due to AIC,
> BIC, and -2LL using the anova method in nlme.  Thank you in advance
> for your valuable time and thoughts!  Kirstin

  That's surprising. We would need to see more details in
order to know what's going on.  All I can think of is that it's
somehow interacting with the unbalanced design to give you a
result that's partially accounting for the overall difference
between sexes.

  I would try

mBZ2S <- update(mBZ2S,.~.+sex)




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