Questions tagged [lmer]

Function of the lme4 package for running linear mixed-effects regressions.

Function of the package for running linear mixed-effects regressions.

89 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
23
votes
1 answer

plot mixed effects model in ggplot

I am new with mixed effect models and I need your help please. I have plotted the below graph in ggplot: ggplot(tempEf,aes(TRTYEAR,CO2effect,group=Myc,col=Myc)) + facet_grid(~N) + geom_smooth(method="lm",se=T,size=1) + geom_point(alpha = 0.3)…
fede_luppi
  • 863
  • 3
  • 12
  • 27
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
10
votes
1 answer

Do I need to set refit=FALSE when testing for random effects in lmer() models with anova()?

I am currently testing whether I should include certain random effects in my lmer model or not. I use the anova function for that. My procedure so far is to fit the model with a function call to lmer() with REML=TRUE (the default option). Then I…
lord.garbage
  • 5,514
  • 4
  • 28
  • 51
9
votes
1 answer

How does lmer (from the R package lme4) compute log likelihood?

I'm trying to understand the function lmer. I've found plenty of information about how to use the command, but not much about what it's actually doing (save for some cryptic comments here:…
stewbasic
  • 801
  • 7
  • 20
8
votes
1 answer

How to unscale the coefficients from an lmer()-model fitted with a scaled response

I fitted a model in R with the lmer()-function from the lme4 package. I scaled the dependent variable: mod <- lmer(scale(Y) ~ X + (X | Z), data = df, REML = FALSE) I look at the…
lord.garbage
  • 5,514
  • 4
  • 28
  • 51
6
votes
1 answer

How to use tryCatch in R

I would like to use try() or tryCatch() or a function like this to detect if there is an error in my model called "fit1". If the model is fine, I want to use "fit1", otherwise I want to use "fit2" fit1<-glmer(stat ~ dataint + DBH + DBH2 +…
user52463
  • 61
  • 1
  • 3
6
votes
1 answer

behavior of na.action = na.exclude using lmer in lme4 1.0-5 inconsistent with lm and with older versions of lme4

Consider a simple example: > library(lme4) Loading required package: lattice Loading required package: Matrix > set.seed(1) > df <- data.frame(x = c(rnorm(7), NA), y = rep(c("A", "B"), 4)) > length(fitted(lm(data = df, x ~ y, na.action =…
David Kane
  • 343
  • 1
  • 2
  • 7
6
votes
1 answer

How to plot random intercept and slope in a mixed model with multiple predictors?

Is it possible to plot the random intercept or slope of a mixed model when it has more than one predictor? With one predictor I would do like this: #generate one response, two predictors and one factor (random effect) resp<-runif(100,1,…
Oritteropus
  • 491
  • 1
  • 6
  • 17
5
votes
1 answer

Accounting for temporal correlation in GLMM

I am trying to account for autocorrelation in a GLMM. My response variable is boolean, it represents the presence and absence of a en event in the life cycle of a set of bee nests. I am trying to predict the probability of such an event with a set…
AtiQP
  • 51
  • 1
  • 4
5
votes
1 answer

How do I run diagnostic plots for lmer in R?

I am trying to run diagnostic plots on an lmer model but keep hitting a wall. I'm not sure how much information I need to provide here, but here goes: The model is simple: best <- lmer(MSV_mm ~ Size_treat + (1|Rep) + (1|Patch) + (1|Trap), data=…
Kika Tarsi
  • 47
  • 1
  • 1
  • 2
4
votes
1 answer

Error message: Error in fn(x, ...) : Downdated VtV is not positive definite

Thanks in advance for anyone who gives this a look over. I've seen this problem once on the archives but I'm a bit new to R and had a lot of trouble understanding both the problem and the solution... I'm trying to use the lmer function to create a…
4
votes
1 answer

random effects variance of intercept being zero

I am running a power analysis using a normal LMM in R. I have seven input parameters, two of which I do not need to test for (no. of years and no. of sites). The other 5 parameters are the intercept, slope and the random effects standard deviation…
user3628889
  • 251
  • 1
  • 4
  • 10
4
votes
2 answers

Standardized coefficients for lmer model

I used to use the code below to calculate standardized coefficients of a lmer model. However, with the new version of lme the structure of the returned object has changed. How to adapt the function stdCoef.lmer to make it work with the new lme4…
majom
  • 7,188
  • 5
  • 50
  • 83
4
votes
1 answer

Why is rmvnorm() function returning "In sqrt(ev$values) : NaNs produced", what is this error and how can it be corrected or avoided?

I am working with financial/economic data in case you are wondering about the large size of some of the coefficients below... My general question has to do with the simulation of parameter coefficients output from a linear random effects model in R.…
DV Hughes
  • 295
  • 1
  • 5
  • 18
1
2 3 4 5 6