Skip to content

Lmer model drops one parameter

3 messages · Pierre Marle, Rob Robinson, Ben Bolker

#
Dear everyone,

I have a lmer model to predict [Hg] according to a categorical variable (7 parameters for 134 observations) as fixed effects and the species as random effect.

The issue that I have is that the summary of model dropped one parameter of the qualitative variable. This is not a problem of unsufficient data of the dropped parameter because it has a high number of observations comparing with other parameters. Moreover, I don?t have any warning message after the model processing.

lme <- lmer(Hg ~ Feeding_type + (1|Sp), data=sp, REML=T)

Fixed effects:
                                             Estimate    Std. Error       df t value Pr(>|t|)
(Intercept)                              0.08404    0.01344 28.13392   6.254 9.06e-07 ***
Feeding_typeGatherer          -0.06692    0.02261 27.57559  -2.960  0.00626 **
Feeding_typeGrazer             -0.06701    0.02084 20.31009  -3.216  0.00427 **
Feeding_typePiercer             -0.07752    0.03093 18.71971  -2.506  0.02161 *
Feeding_typePredator           -0.03889    0.02026 25.21664  -1.919  0.06634 .
Feeding_typeShredder          -0.04154    0.01722 27.41420  -2.413  0.02278 *
Feeding_typeSponge-feeder  0.01674    0.02157 23.04972   0.776  0.44566

As you can see I?m using the lme4 package with REML=T. Should I change something to have the coefficients of all the feeding types in the summary?

I will be very grateful if someone could help me.

Kind regards

Pierre Marle
Phd student / Research assistant
pierre.marle at unige.ch<mailto:pierre.marle at unige.ch> / +41 22 379 0487

D?partement F.-A. Forel des sciences de l?environnement et de l'eau
Laboratoire d?Ecologie et de Biologie Aquatique
Sciences de la Terre et de l?Environnement
Universit? de Gen?ve

ADRESSE POSTALE:
Universit? de Gen?ve
Carl-Vogt 66
CH-1211 Gen?ve 4
SWITZERLAND
__________________________________________
#
Pierre
 This is to be expected, you cannot estimate both an intercept and all
levels of a factor. The immediate answer to your question is to include a
"-1" in the formula, which will give you an estimate for all your
categories; but you probably also want to review how factors are treated in
linear models according to your favourite stats book so that you
understand what is actually happening here. In the meantime this post might
help a little?
https://anythingbutrbitrary.blogspot.com/2012/04/lm-function-with-categorical-predictors.html
Best wishes
Rob


*************** Learn about Britain's Birds at www.bto.org/birdfacts
  ******************

Dr Rob Robinson, Associate Director - Research (he/him)
Hon Reader: Univ East Anglia | Visiting Researcher: Swiss Ornithological
Institute
British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
Ph: +44 (0)1842 750050       T: @btorobrob
E: rob.robinson at bto.org      W: www.bto.org/about-bto/our-staff/rob-robinson

======== "How can anyone be enlightened, when truth is so poorly lit"
========
On Wed, 17 Mar 2021 at 17:59, Pierre Marle <Pierre.Marle at unige.ch> wrote:

            

  
  
#
This is a classic issue with any model based on linear models (LMs, 
GLMs, LMMs, GLMMs, ...).  When you have a categorical predictor (factor) 
with n levels in a model with an intercept, there are only (n-1) 
*independent* parameters that can be fitted. There are lots of ways 
these parameters can be organized (called "contrasts"). R's default is 
to make the intercept equal to the expected value for the first level in 
the factor (by default, the first category in alphabetical order) and to 
the make the other (n-1) parameters correspond to the differences 
between levels 2 and 1, 3 and 1, ... n and 1.

   If you want the model to estimate the means of each group, include -1 
or +0 in your formula - this will suppress the intercept (but make the 
parameters basically useless for statistical inference, as you'll be 
comparing against a null hypothesis that the mean response in each group 
is zero).

    The emmeans and effects packages are useful (so is Rob Robinson's 
answer).
On 3/17/21 1:59 PM, Pierre Marle wrote: