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

3,602 questions
Filter by
Sorted by
Tagged with
5k views

### Model selection in mixed-model context using lmer

Assume I have two factors A and B potentially predicting my outcome Y. Now I would like to test for fixed-effects using likelihood ratio test to find the best model. ...
6k views

### How to fit the model for crossed and nested design using lme function in R?

Suppose A is a fixed factor and B is a random factor. A and B are crossed. Another random factor C is nested in B. Taking into account the AB and AC interactions, how should I fit the model using lme ...
18k views

### Example reports for mixed-model analysis using lmer in biology, psychology and medicine?

As the general consensus seems to be to use mixed-models via lmer() in R instead of classical ANOVA (for the often cited reasons, like unbalanced designs, crossed ...
710 views

### Confidence intervals in a mixed model

Consider the following mixed model: $$(y_{ijk} \mid \mu_{ij}) \sim_{\text{i.i.d}} {\cal N}(\mu_{ij}, \sigma^2), \quad k=1, \ldots K$$  \begin{pmatrix} \mu_{i1} \\ \vdots \\ \mu_{iJ} \end{pmatrix} \...
779 views

### Mixed Model in SAS

I want to analyse the data from an experiment. The participants get different acoustic signals and judge them. The score is a high number, if they feel comfortable with the signal in the other case ...
4k views

### How to test the effect of a grouping variable with a non-linear model?

I have a question regarding the use of a grouping variable in a non-linear model. Since the nls() function does not allow for factor variables, I have been struggling to figure out if one can test the ...
2k views

### Equivalent mixed models yielding different results in SAS

Below I show two equivalent ways to write a mixed model in R and SAS. The two R models as well as the two SAS models yield the same estimates of the random and fixed effects and the same standard ...
320 views

### Include two correlated factors in mixed model?

In my experiment in which participants make a yes-no decision, I use two measures of empathy because I predict these to be both of influence. The two questionnaire scales are weakly correlated but do ...
278 views

### SAS fails to fit a mixed model

Here are some simulated data: ...
92 views

### Time series with 3 factors from different sources

I've been asked to try to do a preliminary 'meta-analysis' of some data, but while comfortable with maths I don't have much experience with stats. I'm hoping to get some feedback with what I have ...
5k views

### What is the mathematical difference between random- and fixed-effects?

I have found a lot on the internet regarding the interpretation of random- and fixed-effects. However I could not get a source pinning down the following: What is the mathematical difference between ...
8k views

### How to interpret two-way interactions in Linear Mixed Effects modeling?

I've fit a Linear Mixed Effects model to some "accuracy" scores for a study with rats. The fixed effects are TrialNumber and Age,...
539 views

### Do I need to aggregate data when using linear mixed effects model?

I have a 2 by 2 design with 12 subjects. The two factors are within-subjects variables. For each cell, 24 responses were collected from each subject. My question is whether I need to aggregate ...
5k views

### R: How to “control” for another variable in Linear Mixed Effects Regression model?

Essentially, I have two collinear variables which could be seen as either random or as fixed effects, a dependent variable I'm fitting the model to, and a variable that's assuredly a random effect. ...
2k views

### Understanding what a factor is in a model

I have a model which I built with a number of factors as fixed effect variables. Up to now they all had two values e.g. high tide/low tide and so when I ran the summary it would show one variance for ...
821 views

### Proportion Estimates - Shrink to the Mean Based on Sample Size

Set-up: One of the fundamental elements of direct marketing is choosing which lists of prospects to select and send an offer to. There are hundreds of lists on the market to choose from and each list ...
3k views

### Relative variable importance values vs. magnitude of effect

I have ran a series of models to see which best fit the response variable and I got the following (for the model average of all models with a $\Delta AIC < 2$). I am currently learning models so ...
187 views

### Asymptotic normality in linear mixed-effects models

Estimates for the fixed effects in a mixed-effects model are known to be asymptotically normal in distribution (under mild assumptions). Are there any results that quantify the deviation from ...
174 views

### A question about a formula for lmer

I have been asking a number of questions about fitting mixed effects models. Thanks to a number of wonderful statisticians on here I have come far, and I thank you for you continued patience. I was ...
1k views

### how to use model.avg

I have been asking a number of separate questions as each are unique in themselves but connected to my learning process in running mixed effects models. I apologise if i am becoming a nuisance. ...
4k views

### Figured out models but issues with object not being found and dredge command

After some amazing help, especially from @jbowman, I was ready to get into my models but have hit a snag that I don't understand. I decided to try package MuMIn as it works with lme4 so that I am able ...
2k views

### How to build a linear mixed-effects model in R?

I asked a question but it was a bit long and confusing so I will attempt to keep this shorter and simple (original post https://stats.stackexchange.com/questions/24971/mixed-effects-model-equations) ...
513 views

### Mixed effects models issue and correlation question. Getting desperate

I have been trying to get answers for a while, and have looked up every help section and tried other stats sites. I have a thesis that I need to be completing shortly, but one set of data has been ...
1k views

### How do you interpret the coefficients in PROC GLIMMIX and PROC GENMOD?

For clustered data, how would you interpret the coefficients? Would you just exponentiate the coefficient to get an odds ratio?
2k views

### Interpreting coefficients of ordinal logistic regression when there is clustering within the data

I have built and refined a regression model using the ordinal package in R. The measure is $0>1>2>3>4>5$ (Yes/No ...
35k views

### How to interpret variance and correlation of random effects in a mixed-effects model?

I hope you all don't mind this question, but I need help interpreting output for a linear mixed effects model output I've been trying to learn to do in R. I am new to longitudinal data analysis and ...
564 views

### glmer() warning message help [closed]

I'm running a glmm with the lme4 package in R that looks like the following: glmer(y ~ factor1 + factor2 + (1 | RE), data=data, poisson) And I get the following ...
2k views

### Time variable in Longitudinal data set mixed model question

It has been a few years since I fit a mixed model, so I have gone on a massive review session on old notes, books (Pinheiro and Bates, Faraway, etc) and going through the posts on SO and CV about ...
28k views

### When is a repeated measures ANOVA preferred over a mixed-effects model?

In response to this question, regarding whether my design where I randomly presented participants with pictures from different categories was an example where I should use a repeated measures ANOVA, I ...
159 views

### Weighing contrasts differently for unbalanced designs

I'm using a mixed effect multilevel model for a crossed design in R. By design, one of my conditions has half the number of observations as the other condition (I am not talking about missing values ...
665 views

### Can I fit a mixed model with subjects that only have 1 observation?

I have a very large dataset where I have repeated measurements over time for individual locations. Some locations might have 10 data points and some locations have only 1 data point. I fit a mixed ...
2k views

### Box-Cox transformation for mixed models

Does there exists a Box-Cox method for linear Gaussian models with random effects ?
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 ...
7k 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 ...
1k views

### How to draw B-spline plots via the PROC GLIMMIX procedure in SAS?

Recently I found that the PROC GLIMMIX procedure in SAS added a statement effect, which can handle B-spline in models. I tried ...
976 views

### Fitting panel data with both variable and constant coefficients using R

I'm working with panel data and want to fit a model of the form: $y_{ij} = \alpha_{i} + \beta_{1i} x_{1ij} + \beta_{2i} x_{2ij} + \beta_{3} treatment_{ij} + \epsilon_{ij}$ The data consist of (...
9k views

### How should mixed effects models be compared and or validated?

How are (linear) mixed effects models normally compared against each other? I know likelihood ratio tests can be used, but this doesn't work if one model is not a 'subset' of the other correct? Is ...
2k views

### Interaction term as a dependant variable in LMM with R

In a longitudinal study, two groups of subjects have been measured over a period of two years at 6 months intervals. During these measurements subjects have been assessed with a series of $k$ measures ...
209 views

### Longitudinal modelling of ordinal censored data

I have n subjects observed over some time $t{\scriptscriptstyle n}<T$ . At several time points during $T$, I measure in each subject the value of an ordinal variable $V$ (which can take 5 values). ...
3k views

### Can I use generalised least squares with a binomial distribution and a nested structure?

I'm trying to fit linear models to my data in R. I need to use a generalised least squares method as I have heterogeneity of variance in one of my variables. I was planning to use varIdent, as the ...
11k views

### Paired t-test as a special case of linear mixed-effect modeling

We know that a paired t-test is just a special case of one-way repeated-measures (or within-subject) ANOVA as well as linear mixed-effect model, which can be demonstrated with lme() function the nlme ...
973 views

### Crossed random effects and unbalanced data

I am modeling some data where I think I have two crossed random effects. But the data set is not balanced, and I'm not sure what needs to be done to account for it. My data is a set of events. An ...
26k views

### How to perform post-hoc comparison on interaction term with mixed-effects model?

I’m working on a data set in order to evaluate the impact of drying on sediment microbial activities. The objective is to determine if the impact of drying varies among sediment types and/or depth ...
154 views

### Sampling distribution of random effects estimator

I have read that the distribution for the random effects estimator in lme4 is highly skewed and for this reason standard errors are not reported. I wonder if anyone can provide a reference for this ? ...
125k views

### How to obtain the p-value (check significance) of an effect in a lme4 mixed model?

I use lme4 in R to fit the mixed model lmer(value~status+(1|experiment))) where value is continuous, status and experiment are factors, and I get ...
326 views

### Reparameterizing the binomial link for psychometric data

Consider an experiment where a square and diamond appear on a screen, one before the other, and participants are required to judge which came first. Manipulating the time interval between the two ...
2k views

### How to treat year variable in observational longitudinal data analysis?

I have a huge multilevel longitudinal observational data of the concentration of certain chemical collected at various sites over 10 years (1990-2010). Sites are classified into different type of ...
1k views

### How to interpret 3-way interaction with one continuous variable in mixed model

I have problems interpreting the direction of the effects in my model. Can you help me with this? I conducted an experiment which includes between subject factor: group=2 (coded as 0-1) within ...