# Questions tagged [mixed-model]

Mixed (aka multilevel or hierarchical) models are linear models that include both fixed effects and random effects. They are used to model longitudinal or nested data.

6,511 questions
Filter by
Sorted by
Tagged with
8 views

### Negative covariance matrix in RI CLPM (lavaan)

I am currently struggling to solve the problem of negative covariance regarding the latent variables with respect to the random intercepts in my RI CLPM model, which I calculate via lavaan. Here is my ...
6 views

### block bootstrap implementation for gls from nlme

I have several datasets of timeseries data (days) with an experimental intervention on some days, where some of the datasets cover multiple sites. I also have matching day-level and site-level ...
• 3,210
1 vote
26 views

### Multilevel Modeling in Linear Mixed Models versus Generalized Linear Mixed Models

I am analyzing a data set that includes several discrete and continuous outcome variables (DV). For the continuous DVs I intend to use Linear Mixed Models (LMM) processed in SPSS. For the discrete ...
• 75
36 views

### Advice on mixed effect model formula for R's lme4

I'm new to mixed effects modeling and definitely lme4 and would greatly appreciate some advice. My research question: what factors determine a business' number of online reviews per day? The data is ...
1 vote
29 views

### Issue with REML likelihood--logdet terms cancel

I'm trying to write an implementation of a linear mixed effects model using REML. I'm working with a simple model: $$y_{ij} = X_{ij}\beta + Z_{ij}b_i + \epsilon_{ij}$$ In my case, the covariate $X$ ...
• 210
46 views

### lmer - how to report results and group differences? [closed]

I want to test the effect of my treatment drug on different populations. I have 3 groups, tested at 3 time points, and one dependent variable. My data: ...
• 1
16 views

### Is factor with two levels set as random effect okay in GAMs? [duplicate]

a. Can covariate that are factors/categories that have 2 levels, such as yes/no or presence/absence, that also change spatial location from year to year have a smooth basis of “re” (bs=re)? Should it ...
• 53
39 views

### Is factor with two levels set as random effect okay? [closed]

a. Can covariate that are factors/categories that have 2 levels, such as yes/no or presence/absence, that also change spatial location from year to year have a smooth basis of “re” (bs=re)? Should it ...
• 53
104 views

### URGENT: I am building a Linear regression model. Yesterday my R-squared was 0.792. Today, it had dropped to 0.267. I did not change anything. Urgent [closed]

Thank you for your responses. By way of further information, I am using R-Squared because it is recommended for the project I am doing. Below are the 2 files. The one from yesterday with the 0.792 R-...
• 1
1 vote
35 views

### Issue with bootstrap confidence and prediction intervals of mixed effects model predictions [migrated]

Recently I have asked a question on how to generate meaningful bootstrap confidence and prediction intervals for mixed effect models predictions in R using bootMer ...
• 43
1 vote
67 views

### Which statistical test would you recommend for this experimental design?

I measured the percentage of individuals that crossed an averisve barrier at six different time points for four different genotypes. The barrier is made out of an aversive substance that the control ...
• 23
14 views

• 1,328
30 views

### Multivariate LME

I am counting how often some patterns occur in many observations of timeseries data. I want to compare three conditions in two time intervals (so I average pattern counts over those intervals). There ...
220 views

### Can I include a variable related to the outcome variable into statistical analysis?

My research question is about the contact patterns during the pandemic and what characteristics of people who contacted more person during the national lock down. The outcome variable is a variable ...
• 73
1 vote
63 views

### Date as random effect in mixed model strongly changes coefficient estimates

I am struggling with the structure of a mixed model that I run with lme4. I have measured a behaviour (let's say reaction time) and another variable that might impact it (let's call it "mood, ...
• 33
45 views

### Steps to conduct a linear mixed model and post-hoc comparison test

I would like to ask for your help with the best way to analyze the following experiment within R. Here is my design: there are 15 treatments, in four blocks. For each treatment, in each block, we have ...
1 vote
29 views

### Degrees of Freedom in Emmeans

I am using the 'emmeans' package in R to compute estimated marginal means for my (liner mixed-effects) model. However, I am enountering a warning message related to the number of observations ...
1 vote
34 views

### Selecting random effects in a linear mixed model when all participants complete all repeated measures?

Participants read 10 pairs of stories from Author A and Author B on 10 different topics (different topic for each pair). For each pair, they indicated whether they preferred Author A, Author B, or ...
1 vote
21 views

### Two-Way repeated measures ANOVA with multiple data points per measurement

I would like to perform a study with physicians of three levels of experience. They shall perform a task under three different conditions. For each condition, the task is performed multiple times (e.g....
• 21
44 views

### What should I back transform beta coefficients when my dependent variable is fractionally exponentiated in R

I have this mixed effects regression model. To create a normal distribution in continuous scale dependent variable, I fractionally exponentiated it: ...
381 views

### What is the mean of random effects?

Say, I have a mixed model: y = x + y + x:y + (1 + x * y | participant) What would be the mean of the random effects? Do they fluctuate around 0 or the fixed effects?...
1 vote
22 views

### Modeling for a data set that has different number of factors for each row (not binomial) [closed]

The modeling issue I'm having is that the categorical variable for each row has different number of factors. If I can reshape the data by products (a,b,c,.....~cost, hoursum, numPod, numDate), so that ...
• 121
1 vote
47 views

### gamm and gamm4 give very different smooth term results for mixed models with factor-smooth interaction

I am analyzing an longitudinal dataset which has two groups (patient vs controls; ordered factor) with brain volume data over time. Participants entered the study at different ages and have varied ...
44 views

### What is the best mixed model approach for a time series of animal attack records?

I have a dataset of animal attack records for Brazilian states between the years 2007 and 2022. I have three explanatory variables, which were standardized for the analyses. To incorporate the ...
• 131
38 views

### Confounding Variable in Regression Model: Simpson's Paradox

I am working on a mixed effects regression model where Yi = exam score of student i. The explanatory variables are the following: Level 3: school type (public vs. private) and school's socioeconomic ...
1 vote
28 views

### Testing the effect of a continious IV on DV, in order to explain group differences

I would like to ask a question regarding an analysis I’m planning and it might be a basic question so, apologies in advane.... To describe the situation: There are two groups of participants in my ...
• 31
12 views

### Is it possible to reuse predictor fixed parameters in a nonlinear mixed effects model fit across mulitple nonlinear response parameters using nlme?

I have data where I want to fit a model given that I know the value at time zero of one stage is equal to the asymptotic value of the previous stage. In particular, I have kinetic growth curves ...
• 297
1 vote
29 views

### Fitting random slope for a subject-level predictor

In a nutshell, I am trying to understand whether it makes sense to include random slopes for group-level (or subject-level) predictors in a mixed effects model? Some Background: I am fitting a mixed ...
146 views

### Mathematical Prediction of Linear Mixed Models Random Intercept

Given data $\{(x_{i,j}, y_{i,j})\} \subset \mathbb{R}^2$, with $i = 1, \ldots, k$ classes and $j = 1, \ldots, n_i$. The linear mixed model is: \begin{equation*} y_{i,j} = a + b x_{i,j} + u_i + \...
• 456
36 views

### Longitudinal analysis of peer effect

I am working with hierarchical data (2 repeated observations on children nested within households), obtained from a RCT with 2 treatment groups. The primary goal of my analysis is to see whether the ...
45 views

### If you have large group sizes (>1000), are there any differences between fixed + random effects models?

If you have large group sizes (>1000), are there any practical differences between using a fixed effect model and a random effects model? A concrete example might be where your individuals are all ...
• 939
45 views

### Mixed models - Intuition of correlated discrete random effects

I'm looking into this source and I'm trying to understand what does it mean to have "positive correlation between the random effects when the variables aren't continuous" In the link there ...
• 499
43 views

### Centering Variables in Multilevel Models with Longitudinal Data

Enders and Tofighi 2007 provide a discussion on the various ways users can center variables in multilevel models and when each situation is appropriate. While they largely focus their commentary on ...
1 vote
59 views

### What is the difference between a) multilevel modelling and b) adding a categorical IV to a multiple regression?

The examples of multilevel modelling I have seen are equivalent to treating the group as an extra categorical IV in a multiple regression. For example, if children are grouped into N classes, you ...
• 939
1 vote
46 views

### When running a Bayesian mixed effects regression, if a random effect estimate has 95% CIs that include zero, should it be disregarded?

Consider a Bayesian mixed effects regression. I am interested in the correlation between two of the random slopes. However, the 95% CIs for the correlation value include 0. Should I disregard the ...
• 2,661
1 vote
64 views

### Validating Model Setup for Differential Abundance Analysis Using ANCOM-BC in R

I am conducting an analysis on microbiota data from a study involving 55 women, categorized by pregnancy status and BMI (lean vs. obese). The goal is to explore the differential abundance of ...
• 151
14 views

### Solving mixed effects model by hand [duplicate]

coming from this discussion, in layman terms why one should use optimisation algorithms to estimate the parameters of a multilevel model? Why a simple model such as ...
• 499
53 views

### Bootstrap confidence and prediction intervals of mixed effect model predictions

Let's say I fitted a mixed effect model mem with the lme4 R library, and I would like to use the ...
• 43
1 vote
87 views

### Modelling longitudinal pre-/post-intervention data

I have longitudinal data of a number of patients for which some biomarker was measured at irregular time intervals over the course of several years before treatment and over a shorter period of time (...
52 views

### The default covariance structure implicitly assumed in the brms formula

Background: The brms official page provides the following example code to illustrate the usage of the package: ...
160 views

### General Linear Mixed Model: How do I fix 'Rescale variables? Model is nearly unidentifiable' error on glmer

I'm trying to fit a generalized linear mixed model (GLMM), but I'm getting a persistent error. I'm looking at the relationship between weather (continuous variables: rainfall, maxtemp, and mintemp) ...
• 71
1 vote
41 views

### LME4 model producing strange p values

When modelling QPCR data using LME4 I am getting a result that tells me my treatment effect is insignificant. When I plot the data this looks wrong and if I use JMPpro the p value for Treatment is ...
• 11
82 views

### Regression Modelling using lme4 in R

I have GPS collar data on a species of desert gazelle throughout different seasons and want to model the effect of seasonal changes in weather patterns on their movement patterns (e.g. daily distance ...
66 views

### Moderation coefficient in linear mixed models SPSS - interpretation

My model: IV: extroversion (5 point likert) Moderator: Comepetence (values 1-5) DV: Offer (values 5 to 15) Hypothesis: The negative relationship between Extroversion and offer is moderated by ...
• 21