# 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.

4,762 questions
Filter by
Sorted by
Tagged with
0answers
11 views

### What statistical test should I use with count data?

In my experiment, participants are shown 4 images (A, B, C, D) that they have to rate on a 5 point scale. So my data looks like this: particpant1: A 5, B 3, C 3, D 1 p2: A 4, B 3, C 2, D 4 p3: A 4, B ...
0answers
8 views

### Mixed Models, LS Mean Plot, and Baselines Controlled by Random Effects

I have two questions about LS Means and LS Means plots. I have a simple model I'm running in lme4: lmer(score ~ group + time + group*time + (1|sub), data = df) ...
0answers
8 views

### Can someone help me understand the random effect parameters in my linear mixed model output?

I have some data for which I modeled in a linear mixed model. I understand everything except the random effect parameters. These variance parameters appear to be bound between -1 and +1. How do I ...
0answers
5 views

### Mixed effects versus conditional models for paired analyses

In this CV post I address briefly models for binary dependent data and how they might be used in a paired analysis. Stratification McNemar Test in R It occurred to me: I hadn't previously considered ...
0answers
10 views

### Mixed models: Why can level-2 variance increase when adding a random slope?

I have a three-level hierarchical model with students nested in classrooms and in schools. When I allow one of the level-one binary variable slopes to vary randomly across classrooms, the between-...
0answers
7 views

### prediction of lme object does not show all the range in predictor variable

I am trying to plot the fitting line associated to a fixed effect in an lme object, using the base package. For that, i am using (this dataset) And this code: ...
0answers
5 views

### Comparing mixed effect models using deviance statistics - comparing model 1 vs. 4 instead of 1 vs. 2, 2 vs. 3, etc

I am relatively inexperienced with mixed effect models and trying to build a model to fit my outcome of interest. I have read and followed along with chapter 4 of Singer & Willet (2003), as well ...
1answer
25 views

### Hypothesis testing with time autocorrelated data

I have a dataset such as the following: ...
0answers
24 views

### confidence intervals for mixed model with pronounced random effect unexpectedly large

Assume I generate some data with a very tiny random effect and calculate a lmer (y ~ group + (1 | surgeons)) and glm (y ~ group) ...
0answers
17 views

### What correlation a multilevel model accounts for? (R code provided)

My basic understanding of a multi-level model is that by adding a grouping variable (i.e., a level), we can generally account for correlations (dependence) between ...
0answers
7 views

### Is there a way to do cross-validation using caret in a linear mixed model? [closed]

I have a data set with 2 treatments and 1 random effect and I am not sure if I can get one model with all this data doing cross-validation. Thank you,
0answers
14 views

### Random forest for high dimensional data with repeated measures (the LongituRF package in R)

I have some high dimensional repeated measures data, and i am interested in fitting random forest model to investigate the suitability and predictive utility of such models. Specifically i am trying ...
0answers
19 views

### Fitting a mixed model in R with correlated random effects at different grouping levels

Suppose I have data grouped into two nested levels, for example school (indexed by $i$) and student (indexed by $j$), with repeated measurements on a student indexed by $k$. I want to fit the ...
0answers
4 views

### Using mixed effects models for multiple trials per condition per subject [closed]

I am new to coding and mixed-effects models, so I have this question. I have a 2 Investment (low/high) x 3 Sampling (low (1.00/1.50/2.00/2.50) / high (8.50,9.00,9.50,10.00)/ middle (4.50,5.00,5.50,6....
1answer
15 views

### Repeated Measures with LMER: Include time as random effect?

I have a dataset of measurements of 29 patients across three time-points. The scenario can be easily simulated using: ...
0answers
18 views

### How does adding country dummies relate to adding a variable that is fixed at the country level

I have firm level data from different countries (the data is completely fictional!). Let us assume that I am trying to estimate the following relation: $$Sales_i = investment_i + country + u_i$$ <...
2answers
71 views
+50

### Generalized linear models vs non-linear models

The "Mixed-Effects Models in S and S-PLUS" book by Pinheiro and Bates talks about non-linear mixed-effects models and gives a logistic model as an example to demonstrate the difference ...
1answer
28 views

### Can LMM or GLMM models handle negative values?

I am working on a set of correlated data. I am planning to apply LMM to my data, however my dependent variable has both positive and negative values. So, I was wondering if LMM or GLMM models can ...
0answers
20 views

### Code help - a mixed model lmer- hierachy level 1 response variable and all Level 2 explanatary variables and an additional crossedrandom effect

I am running a mixed effect model using lmer in lme4. I was wondering if someone can tell me if this is the correct code to include Fixed effects that are recorded at a different level to the response ...
0answers
53 views

### Why is the cohen's d effect-size from this study so different from the value I've computed manually?

In this study , they estimate an overall cohen's d effect-size of .70; however, when I try to compute the cohen's d using their means/stds, I get a much smaller effect-size of .47. Am I doing ...
0answers
19 views

### Linear-mixed effect for single timepoint/modeling a single timepoint with random effects?

I am trying to figure out how best to model advantage between conditions using the difference in mean accuracies (initially coded as 0 and 1). Not included is an Accuracy column with either 0s and 1s ...
0answers
15 views

### Single plot to illustrate two linear mixed effect model in R

I have been analysing my longitudinal data using linear mixed effect model, each person measured at 2 time points. Because my time is binary (first and second month), I have created a two dataset (...
0answers
65 views

### What's best? A model with nested random effects supported by AIC, but that validates poorly; or one with a simpler random part that validates better?

I am trying to fit a linear model to understand the factors that influence (marine) plant carbon stocks at a global level. The potential predictors of carbon stocks that I want to include in the model ...
1answer
15 views

### How to solve non-linearity in a mixed model?

I have a problem which I have been overthinking for a long time. Here my data structure: Y= quantitative variable (from 10 to 221) T=time, 5 different times where I measured Y (fixed variable) R=...
0answers
9 views

### Which comparison between models through ANOVA should I use?

I have 3 factors (A, B and C) in which each factor has two levels, a response variable (Y) and random effect (R). I have a model of the form: ...
0answers
19 views

### Biological vs Technical replicates in cell culture experiment - how to adjust mixed model

I am new to statistical analysis for lab-based research and I want to understand how the following two scenarios differ in how you would specify a mixed model: Tumour sample from 10 patients. Each ...
0answers
23 views

### Are lme4 convergence warnings indicating that I should instead run a glm?

I am currently trying to model a very large dataset to understand if equipment model has an effect on hour_detections. The data ...
0answers
10 views

### Linear mixed effect model on longitudinal data with counterbalanced design where participants recieved same treatment at different time points

I'm pretty new to linear mixed effect models and struggeling with fitting the best model for my data. My study design is the follogwing: Each subject performed the same test at 4 different time ...
0answers
22 views

### Statistical tests that can be run on differences between observations, including repeated measures?

I'm trying to figure out what stats I would have to use for my thesis. For my first experiment, I am planning on getting roughness values from grasshoppers and rocks (from 4 sites, 5 grasshoppers and ...
0answers
19 views

### Metafor Package: How to conduct Meta Regression with reliability generalization

How to conduct meta regression in "metafor" after I got I2 heterogenity 94%. My study reliability generalization alpha Cronbach, with continuous and categorical moderator variable. Thanks ...
0answers
12 views

### Number of observations <= number of random effects for term (X|participant) lmer error

I'm trying to fit an lmer model with a random intercept and slope for each participant and I am struggling to identify the error of my setup. Background: participants repeatedly attempted a putt ...
1answer
48 views

### How to calculate “by hand” between group variance and the ICC for a three-level hierarchical model?

Introduction: This question is related to this and this questions that were answered before, but I would like a more detailed answer on how between-groups variance are calculated in a (null) three-...
0answers
12 views

### How can I get p-values from a regularized GLMM?

I have a dataset containing information about patients in a hospital, with the following variables: Status for a certain disease (binary outcome) Hundreds of continuous biomarkers A few variables for ...
0answers
13 views

### Mixed Repeated Measures ANOVA vs. multilevel random effects model

I have a dataset that contains survey responses from participants attending a training workshop. Surveys were administered prior to training, just after training, and 3 months post training. Moreover, ...
0answers
8 views

### How add a fixed offset term to account for a known effect in a repeated measures mixed model?

I'm running a lmer with a continuous outcome TestY measured in each visit a participant makes to the study i.e. a longitudinal repeated measures analysis. The ...
0answers
15 views

### lmer and multiple comparisons

I did a within-subject experiment with 44 participants. The tasks were determined based on two factors: topic (1=nonmath - 2=math) and difficulty (1=easy - 2=difficult), resulting in four Conditions (...
0answers
11 views

### How to look at correlation between two variables if one variable was measured twice?

I have a dataset where I measured a ratio of a metabolite before and after surgery and I would like to understand the relationship of the metabolite ratio to a second variable (a testscore) that was ...
1answer
31 views

### GEE vs Marginal Models: Are they the same? How are they different?

In Agresti's "Foundations of Linear and Generalized Linear Models", section 9.1.3 unambiguously states that "GLMMs imply marginal models" and demonstrates in a few lines how "...
0answers
23 views

### On the prediction with mixed-effect models

I'm finding some struggles to understand the significance of the argument re.form in the function predict.merMod. In the ...
0answers
22 views

### Can a grouping variable also be a predictor or vice versa

I sometimes see that a grouping variable such as study ($1,2,...15$) is used as a grouping variable to the right of the |: ...
0answers
27 views

### Using lme4, empty model has a larger Condtional R2 than full model

I am interested in calculating the difference in conditional R2 between a full model and an empty one, but using the code below I get a higher conditional R2 from the empty model than the full one. ...
0answers
17 views

### Can you use information criterion to decide if random effects are important in your model?

I want to know if adding random effects in a model improves its predictive performance. I have a model with fixed effects below: m1<- stan_glmer(a~b+c) Which I want to compare with a mixed effects ...
0answers
28 views

### Mixed-effects models: when and how to use (with a specific example)

The scenario: In Experiment 1 footballers take 60 penalty shots. Three independent variables are manipulated: colour of shoes - for each trial participants wear different colour of shoes (20 each, ...
0answers
16 views

### Mixed Model Analysis -> where to put my factor (fixed or random)?

Short Version: I treated 10 animal mothers/dams (5 control fluid, one 100µg/kg of a substance, 4 20µg/kg of a substance (i.e. controls = 0µg/kg) --> factor dose). I got 25 control offspring animals ...
0answers
6 views

### why are confidence intervals so wide with nested random effects design for factorial linear model?

I am analyzing historical data conducted from a factorial experimental field study with nested random effects. The investigator counted indicated breeding pairs of ducks per hectare (ip.ha) in ...
0answers
16 views

### Including confounding variables in logistic mixed effect model

I have the following DAG and I want to test whether X influences Y controlling for A and B Where A is categorical, B and X are continous and Y is binary. Subjects were tested once a year and then ...
1answer
40 views

### Generalized Mixed Model with repeated measurements

I’ve have been working with a mixed model (glmmTMB) to analyse the abundance of snails in dependency of several categorical predictors. The data was measured twice in the same sample sites in two ...
0answers
44 views

### Which formula to choose for a mixed model / multilevel model

I'm trying to write a mixed model on repeated data, but I am having a hard time writing the formula. My database is composed of results of schools for different exams. Each line contains a result from ...
1answer
33 views

### If the variance of residuals is known, then can we add an extra random effect?

In random-effects meta-regression, we often model an estimate of effect size ($effectSize_i$) as: $$effectSize_i=\mu+u_i+e_i$$ where $u_i \sim N(0, \tau^2)$, and $e_i \sim N(0, v_i)$, where $\tau^2$ ...
0answers
28 views

### Sample size needed for a random effects model

I am trying to understand what I need to calculate in order to determine the sample size needed for a linear mixed effects model. For each subject I will have 10 time points, at which I measure an ...