Questions tagged [lme4]

lme4 is an R package for fitting and analyzing linear, nonlinear and generalized linear mixed models.

Overview

lme4 is an package for fitting and analyzing linear, nonlinear and generalized linear .

Repositories

Vignettes

Books

Other resources

Related tags


Tag usage

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

1729 questions
14
votes
1 answer

lme4 error: boundary (singular) fit: see ?isSingular

I am trying to run lme4 package in R. I have 10 Lines in total with four plants for each line in each of the two replications. But some of the plants died and there are some missing values. Weight is the response variable. Here are some lines from…
Jessica
  • 391
  • 1
  • 3
  • 16
13
votes
1 answer

plm or lme4 for Random and Fixed Effects model on Panel Data

Can I specify a Random and a Fixed Effects model on Panel Data using lme4? I am redoing Example 14.4 from Wooldridge (2013, p. 494-5) in r. Thanks to this site and this blog post I've manged to do it in the plm package, but I'm curious if I can do…
Eric Fail
  • 8,191
  • 8
  • 72
  • 128
13
votes
2 answers

Prediction with lme4 on new levels

I'm trying to fit a mixed effects model and then use that model to generate estimates on a new dataset that may have different levels. I expected that the estimates on a new dataset would use the mean value of the estimated parameters, but that…
random_forest_fanatic
  • 1,232
  • 1
  • 12
  • 30
12
votes
1 answer

Install lme4 from CRAN on Ubuntu

I'm having trouble installing the lme4 package from CRAN on Ubuntu 18.04. I'm running install.packages("lme4") on R 3.4.4 and get the following error: ERROR: configuration failed for package ‘nloptr’ * removing…
pete
  • 561
  • 6
  • 16
12
votes
1 answer

glmer logit - interaction effects on probability scale (replicating `effects` with `predict`)

I am running glmer logit models using the lme4 package. I am interested in various two and three way interaction effects and their interpretations. To simplify, I am only concerned with the fixed effects coefficients. I managed to come up with a…
Erdne Htábrob
  • 819
  • 11
  • 29
11
votes
2 answers

lme4::glmer vs. Stata's melogit command

Lately I have been trying to fit a lot of random effects models to relatively big datasets. Let’s say about 50,000 people (or more) observed at up to 25 time points. With such a large sample size, we include a lot of predictors that we’re adjusting…
Jonathan Gellar
  • 303
  • 1
  • 8
11
votes
2 answers

How to have multiple groups in Python statsmodels linear mixed effects model?

I am trying to use the Python statsmodels linear mixed effects model to fit a model that has two random intercepts, e.g. two groups. I cannot figure out how to initialize the model so that I can do this. Here's the example. I have data that looks…
Sourav Dey
  • 387
  • 1
  • 4
  • 14
10
votes
2 answers

How to cope with a singular fit in a linear mixed model (lme4)?

I am running several linear mixed models for an study about birds with the variable nest as a random variable. The thing is that in some of these models I get what is called 'singular fit': my nest random variable has a variance and st error of…
Iraida
  • 101
  • 1
  • 1
  • 8
10
votes
1 answer

Installing nloptr on Linux - fatal error: nlopt.h: No such file or directory

Another cry for help with installing nloptr package on Linux (Ubuntu 14.04.4 LTS). I looked through many questions but did not manage to find a solution for this. I am unable to install lme4 package in R (version 3.3.1/Rstudio Version 0.99.902) as…
user1442363
  • 800
  • 1
  • 10
  • 18
10
votes
2 answers

R stargazer, lme4 and lmerTest incompatibility

R novice here. I'm having issues working with lmerTest and stargazer. I was following the tutorial here to get stargazer to work with lme4 in…
Nick Ruiz
  • 1,405
  • 4
  • 18
  • 28
9
votes
1 answer

how to use update() for random part in lmer()?

I would like to use the update() function to update the random part of my model, specifically, adding a random effect. Most examples (help("update"), help("update.formula"), lme4:mixed effects modeling with R) focus on the fixed part of the model.…
Richard
  • 1,224
  • 3
  • 16
  • 32
9
votes
1 answer

Fitting the same models in nlme and lme4

The data are from here library(nlme) dat0 <- read.table("aids.dat2",head=T) dat1 <- dat0[dat0$day<=90, ] # use only first 90-day data dat2 <- dat1[!apply(is.na(dat1),1,any),] # remove missing data # Next, let's treat the data as longitudinal…
Adrian
  • 9,229
  • 24
  • 74
  • 132
9
votes
1 answer

GLMER warning: variance-covariance matrix [...] is not positive definite or contains NA values

I sometimes find that my GLMMs from glmer, package lme4, show the following warning messages, when their summary is called: Warning messages: 1: In vcov.merMod(object, use.hessian = use.hessian) : variance-covariance matrix computed from…
kdarras
  • 389
  • 1
  • 5
  • 16
9
votes
1 answer

solution to the warning message using glmer

As many other people, I'm having troubles running a model which uses glmer function from package lme4. Here is my model: model = glmer(depvar ~ variety*cover+amplitude+time+ (1|pp) + (1|stim), data = datafile, family=poisson) And here is the…
dede
  • 1,129
  • 5
  • 15
  • 35
9
votes
1 answer

fitting a linear mixed model to a very large data set

I want to run a mixed model (using lme4::lmer) on 60M observations of the following format; all predictor/dependent variables are categorical (factors) apart from the continuous dependent variable tc; patient is the grouping variable for a random…
steve
  • 115
  • 1
  • 7