[R-sig-ME] / vs : operators in model specifications

Douglas Bates bates at stat.wisc.edu
Tue Mar 4 00:12:35 CET 2008

On Mon, Mar 3, 2008 at 4:21 PM, Martin Eklund
<martin.eklund at farmbio.uu.se> wrote:
> Hi all,

>  I'm new to mixed models and lme4 and would appreciate any help on
>  specifying models in lme4. Specifically I'm wondering about
>  specifying nested variables. As I understand it lmer is capable of
>  determining the nesting structure by itself (as long as the nesting
>  is not implicit in the factors), so is there ever a need for
>  specifying the nesting structure in the model specification when
>  using lmer? Assuming A and B are random factors, B is nested in A,
>  and Y is a response. What would be the difference between the
>  following model specifications?
>  (i)     lmer(Y ~ (1|A) + (1|B))
>  (ii)    lmer(Y ~ (1|A) + (1|A:B))
>  (iii)   lmer(Y ~ (1|A) + (1|A/B))

They should be the same provided that the levels of B are not
implicitly nested in the levels of A, which is what you indicated
would be the case.

The specification (1|A) + (1|A/B) is redundant as (1|A/B) expands to
(1|A) + (1|A:B) so (iii) could be written as

lmer(Y ~ 1|A/B)

>  On a different note: using the mcmcsamp method, is it possible to
>  change the choice of priors? I understand that this is a longshot and
>  that it is most likely not possible, but I'm still asking just to be
>  sure. Is there another way this can be done (i.e. sampling from the
>  posterior distribution of a mixed model but with a general choice of
>  prior)?

Unfortunately, no, there is no convenient way of specifying an
arbitrary prior for the mcmcsamp function.  To make it practical to
use that function routinely, the sampling scheme is hard-wired into
compiled code and based upon having an improper, locally uniform prior
on the fixed effects and improper, locally uniform priors on the
logarithms of the variance components.
>  Thank you very much!
>  Best regards,
>  Martin.
>  ========================================
>  Martin Eklund
>  PhD Student
>  Department of Pharmaceutical Biosciences
>  Uppsala University, Sweden
>  Ph: +46-18-4714281
>  ========================================
>         [[alternative HTML version deleted]]
>  _______________________________________________
>  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