Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 442

lme4 and nlme are R packages used for fitting linear, generalized linear and nonlinear mixed effects models. For general questions about mixed models use [mixed-model] tag.

2 votes

Specifying mixed-linear model in lme() for pre-/post-treatment design

A few notes: If you look at your data you obtain: > str(data) 'data.frame': 40 obs. of 5 variables: $ id : Factor w/ 20 levels "1","10","11",..: 1 12 14 15 16 17 18 19 20 2 ... $ sess : Fact …
Henrik's user avatar
  • 14.4k
6 votes
Accepted

Approximate F-test of the intercept with pbkrtest

To test a intercept less model (but including f1) you need to simply specify it (both ways are equivalent): m3 <- lmer(x ~ 0 + f1 + (1|ID) + (0 + f1|ID), data) or m3 <- lmer(x ~ f1 + (1|ID) + (0 + …
Henrik's user avatar
  • 14.4k
8 votes
Accepted

Order of nested random effects in lme4

As all participants did see all levels of your factor f1, the factor is not nested within id. A factor is nested within another factor if each instantiation of the higher order factor does not see all …
Henrik's user avatar
  • 14.4k
2 votes

Linear mixed-effects model equation for correlated and uncorrelated random slopes

The variant with correlated random slopes is your model 1. The variant without correlation is not easily possible using lmer, due to A and B being categorical. My package afex offers two solutions: …
Henrik's user avatar
  • 14.4k
11 votes

Interpreting three forms of a "mixed model"

You should note that T is none of your model's a random effects terms, but a fixed effect. Random effects are only those effects that appear after the | in a lmer formula! A more thorough discussion …
Henrik's user avatar
  • 14.4k
4 votes
1 answer
2k views

How to analyze this dataset with 2 between-, two within- factors using lme4?

This post is a follow up on my previous post (which was interested in lme) and uses the same dataset. Now I would like to know how to analyze it using lme4. The data The data is from a behavioral ex …
Henrik's user avatar
  • 14.4k
7 votes
Accepted

How to specify uncorrelated random slopes in lmer() syntax?

I think what you want is not directly achievable. The best seems to be your second option (i.e., two random intercepts but no slopes). Depending on the number of levels in X and M, this should decrea …
Henrik's user avatar
  • 14.4k
7 votes

Mixed effects model: Compare random variance component across levels of a grouping variable

One relatively straight-forward way could be to use likelihood-ratio tests via anova as described in the lme4 FAQ. We start with a full model in which the variances are unconstrained (i.e., two diffe …
Henrik's user avatar
  • 14.4k
18 votes
1 answer
14k views

Intraclass Correlation Coefficient in mixed model with random slopes

I have the following model m_plot fitted with lme4::lmer with crossed random effects for participants (lfdn) and items (content): Random effects: Groups Name Variance Std.Dev. Corr …
Henrik's user avatar
  • 14.4k
6 votes
Accepted

Are these maximal linear mixed models (within-subject within-item factorial design) really m...

Models m2 and m3 can only be estimated if you have repetitions on the level of the participant-item combination. For m3 for the full factorial design. Otherwise this random effect is confounded with t …
Henrik's user avatar
  • 14.4k
1 vote
Accepted

Is there a way to specify a lme model with more than one within-subjects factor?

I found an answer to my question on this thread: Repeated measures ANOVA with lme in R for two within-subject factors (somehow this thread was already one of my favorites, I must have forgotten about …
Henrik's user avatar
  • 14.4k
3 votes

Using glmer to estimate treatment interactions

As I said in my comment, I expect the problem to be one of additional random effects parameters in model compared to in modelT0 + modelT1 (specifically corraletions). Hence I would first check for th …
Henrik's user avatar
  • 14.4k
7 votes
1 answer
8k views

Is there a way to specify a lme model with more than one within-subjects factor?

The data Suppose we have a dataset d with two between-subject factors (i.e., groups), group and condition, and two within-subject factors (i.e., repeated-measures factors), topic and problem (I uploa …
Henrik's user avatar
  • 14.4k
13 votes
Accepted

Encoding of categorical variables (dummy vs. effects coding) in mixed models

As said by @amoeba in the comment, the question is not so much a mixed model question, but more a general question on how to parameterize a regression model with interactions. The full quote from our …
Henrik's user avatar
  • 14.4k
22 votes
5 answers
25k views

How to assess the fit of a binomial GLMM fitted with lme4 (> 1.0)?

I have a GLMM with a binomial distribution and a logit link function and I have the feeling that an important aspect of the data is not well represented in the model. To test this, I would like to kn …
Henrik's user avatar
  • 14.4k

15 30 50 per page