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.

1292 questions
69
votes
1 answer

Restart mixed effect model estimation with previously estimated values

I'm using lmer() in package lme4 to estimate mixed effects models. This works well, but now I want to run the estimation process for a fixed number of iterations, then resume the process by specifying start values, as calculated by the last…
Andrie
  • 163,419
  • 39
  • 422
  • 472
44
votes
6 answers

Extract random effect variances from lme4 mer model object

I have a mer object that has fixed and random effects. How do I extract the variance estimates for the random effects? Here is a simplified version of my question. study <- lmer(Reaction ~ Days + (1|Subject), data = sleepstudy) study This gives a…
dynamo
  • 2,718
  • 3
  • 20
  • 32
41
votes
2 answers

Linear mixed model with crossed repeated effects and AR1 covariance structure, in R

I have within-subject physiological data from participants (part), who have all looked at stimuli (reading newspapers) on three rounds (round), which each have five papers (paper), and within each there are variable number of visits (visit) in the…
RandomMonitor
  • 647
  • 1
  • 7
  • 13
36
votes
4 answers

Plot random effects from lmer (lme4 package) using qqmath or dotplot: How to make it look fancy?

The qqmath function makes great caterpillar plots of random effects using the output from the lmer package. That is, qqmath is great at plotting the intercepts from a hierarchical model with their errors around the point estimate. An example of…
Captain Murphy
  • 815
  • 3
  • 15
  • 23
31
votes
7 answers

How to get coefficients and their confidence intervals in mixed effects models?

In lm and glm models, I use functions coef and confint to achieve the goal: m = lm(resp ~ 0 + var1 + var1:var2) # var1 categorical, var2 continuous coef(m) confint(m) Now I added random effect to the model - used mixed effects models using lmer…
Tomas
  • 52,167
  • 46
  • 207
  • 345
26
votes
1 answer

Convergence error for development version of lme4

I am attempting to do a power analysis for a mixed-effects model using the development version of lme4 and this tutorial. I notice in the tutorial that lme4 throws a convergence error: ## Warning: Model failed to converge with max|grad| = 0.00187101…
dmartin
  • 643
  • 1
  • 6
  • 14
21
votes
4 answers

Is there a way of getting "marginal effects" from a `glmer` object

I am estimating random effects logit model using glmer and I would like to report Marginal Effects for the independent variables. For glm models, package mfx helps compute marginal effects. Is there any package or function for glmer objects? Thanks…
Rfan
  • 652
  • 6
  • 10
20
votes
2 answers

lme4::lmer reports "fixed-effect model matrix is rank deficient", do I need a fix and how to?

I am trying to run a mixed-effects model that predicts F2_difference with the rest of the columns as predictors, but I get an error message that says fixed-effect model matrix is rank deficient so dropping 7 columns / coefficients. From this…
Lisa
  • 728
  • 2
  • 8
  • 22
20
votes
1 answer

How to compare a model with no random effects to a model with a random effect using lme4?

I can use gls() from the nlme package to build mod1 with no random effects. I can then compare mod1 using AIC to mod2 built using lme() which does include a random effect. mod1 = gls(response ~ fixed1 + fixed2, method="REML", data) mod2 =…
It Figures
  • 363
  • 1
  • 2
  • 11
18
votes
3 answers

Any way to produce a LaTeX table from an lme4 mer model fit object?

Does anyone know a way to produce a nice publication quality LaTeX table from an lme4 mer object? Neither the xtable method (package xtable) nor the latex method (package Hmisc) know how to deal with mer objects. For example, given this…
Ryan
  • 1,277
  • 1
  • 12
  • 18
18
votes
3 answers

Speed up lmer function in R

I would like to share some of my thoughts when trying to improve the model fitting time of a linear mixed effects model in R using the lme4 package. Dataset Size: The dataset consists, approximately, of 400.000 rows and 32 columns. Unfortunately,…
mammask
  • 255
  • 3
  • 10
15
votes
1 answer

increase iterations for new version of lmer?

I just updated lme4 to version 1.0-4 and when I run lmer() my mixed effects model, which was converging before, now prints this warning: Warning message: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf, : failure to converge…
Sol
  • 692
  • 1
  • 4
  • 16
14
votes
3 answers

Multivariate Linear Mixed Model in lme4

I wonder how to fit multivariate linear mixed model with lme4. I fitted univariate linear mixed models with the following code: library(lme4) lmer.m1 <- lmer(Y1~A*B+(1|Block)+(1|Block:A), data=Data) summary(lmer.m1) anova(lmer.m1) lmer.m2 <-…
MYaseen208
  • 19,213
  • 32
  • 133
  • 260
14
votes
1 answer

warning messages when trying to run glmer in r

Dear Stack Overflow community, Currently I'm trying to rerun an old data analysis, binomial glmer model, (from early 2013) on the latest version of R and lme4, because I don't have the old versions of R and lme4 anymore. However, I experience…
FlyingDutch
  • 781
  • 2
  • 11
  • 20
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…
eborbath
  • 772
  • 5
  • 24
1
2 3
86 87