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 87305

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.

0 votes

Fixed effect turns insignificant when including random effect - Multilevel

@AhmadMkhatib's answer about what your results mean is spot-on. You have non-trivial person-level variability in the slope of your main predictor. What do you do with that? Many researchers with data …
Erik Ruzek's user avatar
  • 5,890
0 votes

Data format for mixed effects model lme4

The reason you are losing observations has nothing to do with the outcome and everything to do with the predictors. All rows in which a predictor is missing are excluded from the analysis. To verify t …
Erik Ruzek's user avatar
  • 5,890
1 vote

Appropriate Linear Mixed Model for nested data

Let's start with your model: lmer(Ectomyc ~ Stand_type + (1 + Stand_type | Location) + (1 | Location:Plot)) This model examines the effect of Stand_type on Ectomyc as both a fixed ("non-varying") pop …
Erik Ruzek's user avatar
  • 5,890
1 vote
Accepted

Should I Include Visit as Both a Fixed Effect and Random Effect in a Longitudinal Mixed-Effe...

One issue in your code is that the way you have tx and menscat variables created, they end up perfectly correlated. I adjusted that bit of code, below, with a few other changes: n_visits <- 2 data < …
Erik Ruzek's user avatar
  • 5,890
1 vote

Equivalence of Fixed Effects in Contextual Models with and without Random Slopes

The "better" estimate question is worth addressing separately from the precision questions. An excellent paper by Lüdtke and colleagues (2009) in Contemporary Educational Psychology explains why one m …
Erik Ruzek's user avatar
  • 5,890
6 votes
Accepted

Clarification on Random Effects Structure in Linear Mixed Models in R

The answer depends a bit on how your country and id variables are coded. Is it the case that: a) In each country the numbering for individual ids starts at 1? or b) In country 1 you have ids 1-10 a …
Erik Ruzek's user avatar
  • 5,890
2 votes

How to analyze time varying covariate random effect

To create a person-mean centered variable, you need to first create a person mean for each individual and then subtract each person's mean from their score at a given occasion. You can use functions w …
Erik Ruzek's user avatar
  • 5,890
4 votes

Modeling repeated measures data in R - Interpretation and Validation

To help make your original regression results more interpretable, I suggest that you code timepoint such that the first occasion is given a value of 0. This is because in regression models, the interc …
Erik Ruzek's user avatar
  • 5,890
4 votes
Accepted

Specific group effects (coefficients) in mixed-effect modeling in R (lmer)

This is a great question that hits at one of the superpowers of multilevel or mixed effects models, in my opinion. In your example, A, B, and C all vary within groups but, very likely, groups vary in …
Erik Ruzek's user avatar
  • 5,890
1 vote
Accepted

How to interpret and visualise output from lmer model r?

With data such as yours, it is quite common to use mixed effects models, so you are on the right track. However, the way you treat species in your model(s) is not something I have seen before. Please …
Erik Ruzek's user avatar
  • 5,890
5 votes

Difference between Fixed Effects predictor Value and ggeffects predicted values

Keep in mind that the parameter estimate for PC1 in the lmer model summary is conditional any variables that PC1 is interacted with. In this case, you interacted PC1 with DominancePatternCod and WTW. …
Erik Ruzek's user avatar
  • 5,890
1 vote

When should grouping variables interact in a mixed-effects model?

I am going to work from the simpler model in which you do not have a random (or varying) slope for x and instead just have a set of random (or varying) intercepts: m1 <- lmer(dv ~ 1 + (1|f) + (1|g) + …
Erik Ruzek's user avatar
  • 5,890
9 votes

longitudinal data with unequal samples and end points

I believe that you are fine to use the approach you outlined in your question. There is more between id variance at time==0 (the random intercept) than there is in the rate of change (random slope for …
Erik Ruzek's user avatar
  • 5,890
2 votes
Accepted

3 Levels Linear Models in R with random slopes and intercepts with hierarchy level variables

The model you propose has random slopes at the classroom and school levels for all student-level predictors. This may be a valid model for some data, but it would not be advisable for this particular …
Erik Ruzek's user avatar
  • 5,890
2 votes
Accepted

R_lme4_mixed-effects_modelling_SASexample_replication

For Model 1, the author specified only a single random intercept for id and then a series of fixed intercepts and slopes corresponding to treatment, age group, and the interaction of age group and tre …
Erik Ruzek's user avatar
  • 5,890

1
2 3 4 5
15 30 50 per page