+ Reply to Thread
Results 1 to 3 of 3

Thread: Random intercept only for 1 subgroup in lmer

  1. #1
    Points: 3,865, Level: 39
    Level completed: 44%, Points required for next Level: 85

    Posts
    15
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Random intercept only for 1 subgroup in lmer




    Dear all,
    suppose I have a case study with 3 different populations, A, B and C. For all groups I have data on, e.g. body mass, length and sex of a given species. For group A I also have information on the year of birth, which I may be interested to include in the analysis as a random term to account for the cohort effect, while for groups B and C I have no such information. The dataframe would look something like:

    Pop Coh Weight Length Sex
    A 2010 12.1 34 m
    A 2011 13.4 42 m
    A 2012 10.3 36 f
    A 2010 10.5 32 m
    A 2013 12.1 37 f
    A 2014 12.4 35 f
    A 2011 14.1 32 f
    ...
    B NA 13.1 36 m
    B NA 10.5 35 f
    B NA 12.4 32 f
    B NA 12.6 35 m
    ...
    C NA 13.7 31 m
    C NA 11.5 37 f
    C NA 10.7 33 m
    C NA 11.9 35 f
    ...

    Let's now suppose I want to investigate the relationship between Weight and Length, for males and females of different populations, e.g. by using a 3-way interaction. Would it still be possible to run the analysis in one single mixed model with a random intercept (cohort) only for group A?

    With my actual dataset, the model

    lmer(Weight ~ Length * Sex * Pop + (1 + Pop | Coh) )

    fitted changing NAs to 1 appears to work, as it returns the same estimates for population B and C (but clearly not A) as the model

    lm(Weight ~ Length * Sex * Pop)

    but I am not quite sure if this is the correct approach.

    Thanks!

  2. #2
    Omega Contributor
    Points: 33,571, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Activity Award
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,523
    Thanks
    368
    Thanked 1,091 Times in 1,055 Posts

    Re: Random intercept only for 1 subgroup in lmer

    So year is a continuous variable or factor?
    Stop cowardice, ban guns!

  3. #3
    Points: 3,865, Level: 39
    Level completed: 44%, Points required for next Level: 85

    Posts
    15
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Random intercept only for 1 subgroup in lmer


    Both Pop and Coh are factors. The idea would be to fit a random intercept shared by individuals that have the same value for Cohort, and allow a random slope for different Populations. This makes biological sense, as the factor Cohort is meaningful within different levels of Population.

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats