# Questions tagged [lme4-nlme]

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,676 questions
Filter by
Sorted by
Tagged with
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
9 views

### Convert bayesian model to Mixed-Effects Models (lme4)

I am studying some Score in a population of young (Age=1) and old people (Age=2). Each person was studied several times (1-4). ...
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
8 views

### Is there a way to graph an interaction from a mixed effects model with covariates?

I am trying to graph the results of a week by condition interaction in a mixed-effects model with multiple covariates. Data is nested within-subject. I am predicting steps by week (factor with 5 ...
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 ...
1answer
14 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: ...
1answer
38 views

### Binomial GLMM with proportions and categorical predictors

Study background My research question looks at the effect of age group (AgeGr) on gazing. Each infant was observed for 1h and signals with gazing (...
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
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 ...
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
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 ...
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 ...
1answer
24 views

### summary(), anova() type 3, Anova() type 3 not producing similar results for lmer model

First off, I have read a plethora of answers on this site but can't seem to find something that satisfies my situation below: ...
0answers
16 views

### Are Level-2 residuals in a MLM with lmer the same as the Random Intercepts? How to check them for Independence, constant variance and endogeneity?

I'm using the lmer function of R (lme4) to make a model of the following kind: model <- lmer(DV ~ Predictor_categorical + (1|Group_categorical), data = df_data) ...
0answers
9 views

### How to run a three-level MLM using two predictors with unequally distributed column values

Dear all, I am currently trying to run a three-level MLM for analyzing diary data using two predictors at Level 1 (columns dpc and ddmc in the attached image) predicting emotional closeness. Both ...
1answer
43 views

### Help with Poisson regression accounting for repeated measures

I'm not a statistician, but need to use these clever tools to analyse some data I have. I have a really simple dataset to analyze (see below. cases=disease counts, pop=total number of subjects sampled ...
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
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
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
19 views

### Statistitical differences pairwise comparisions on binomial data

I am running a inhibition of growth assay on bacteria on R. I've got a dataframe with the different bacteria and different concentrations, and my response variable, inhibition, being 1 if there is ...
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
14 views

### How can I account for autocorrelation in location and seawater depth together in a gamm or lme model?

I'd like to use a genaral additive mixed model to test for a relationship between two variables that are autocorrelated accross space and depth. One clear case where this happens would be with highly ...
0answers
24 views

### How to write linear model with fixed and random effect

I'm trying to figure out if I'm writing my linear mixed effect model in the correct manner to compare the models. The experimental set up: We are looking at the length~weight relationship of a species ...
0answers
14 views

### Which analys should i perform? [duplicate]

I am trying to work on the data of my master thesis. I have to perform statistic analysis but i dont know if i should use on R lm glm or lme. I have 58 sample points each has two value: altitude and ...
0answers
13 views

### Estimating a non-linear (Weibull) term in linear mixed effects model (nlme)

I'm attempting to fit a mixed effects model to some data with several predictors. However, one of the predictors has a distinctly non-linear relationship with the response variable. After some ...
0answers
15 views

### mixed model for proportion response variable

I have data that measures the proportion of cropland that was affected by drought for 10 locations measured across 10 years. as shown below: ...
0answers
7 views

### multilevel regression model for nested data?

Hypothesis 1 Independent variable = Thermal inertia (TI) Dependent variable = Depth diameter ratio (d/D), Radii variation (RV) and Rim irregularity (RI). Hypothesis 2 Independent variable = Thermal ...
0answers
15 views

### Should a linear mixed model include a random effect for experiment if the DV is standardized within each experiment?

When using a linear mixed model to analyze data from multiple experiments in which the DV is separately standardized within each experiment, does it make sense to include a random effect for ...
1answer
35 views

### linear mixed effects models: should I aggregate repeated trials?

A colleague of mine asked me to analyse some data from a movement experiment. Participants were asked to turn their head three times to the left (toL), three times to the right (toR), with both the ...
1answer
39 views

### which analysis fit the best for the data?

I am trying to work on the data of my master thesis. I have to create a model, but I don't know which analysis perform. My data look like this number ID sp ab alt SWdiv 1 A1 4 6 630 0.25802965 2 A2 ...
0answers
4 views

### GLMM appropriate for constant covariates/ baseline score? Or Ancova?

I was wondering whether my data is appropriate to fit a glmm (with r package lme4) So, I measured a questionnaire two times (q1 and q2). Also, I have variables ...
0answers
6 views

### Ideas for analysing multi-select responses (as predictor variable) on a daily-level

I was hoping to get some ideas for analyses Context: Every day, for 2 weeks, users get asked in the morning: How long did you sleep last night (in hours)? Select the device(s) you have used ...
1answer
43 views

### lmer in R variable types

I'm new to both R and using lmes, and just struggling to work out how I should be preparing my data for the model. I have a data set (dataRT): ...
0answers
17 views

### User defined comparisons?

During my experimental study I've collected a dataset with five biological replicates, each containing three technical replicates. Initially, my question was whether any difference between mean value ...
0answers
21 views

### How do I convert logistic glmer model residuals into log likelihoods

I have fitted a series of glmer models with a binary response variable (family = binominal(logit)), and I have seen alot of blogs on this questions stating that you should convert the residuals into ...
1answer
30 views

### How to go about nested random effects if model yields convergence problems?

I've built a mixed effects logistic regression model using glmer(). I'm trying to measure clause transitivity (2 possibilities: transitive/intransitive) Each observation is a clause and clauses are ...
0answers
11 views

### multiple between-subjects factors lmer

is it correct in lmer to run a model with 2 between-subjects factors + a within-subject factor + a random slope? ...
0answers
9 views

### Similar estimate standard errors in GLMMs using a wide range of environmental variables

I have a data set on animal species diversity at 40 study sites from3 sub areas. The data comprise about 60 environmental variables. I am interested in the effect of each variable on the species ...
0answers
11 views

### What is “Distribution-specific variance” or σ2d

I've built several binomial mixed effects regression models and always get the same "distribution-specific variance" (=3.29). In the 'help' of tab_model() it says the following: ...
0answers
16 views

### Scaling with categorical and continuous variables mixed model

I created I am working with data that has both categorical and continuous variables. The outcome variable y is a count. cat1 and ...
0answers
12 views

### Linear mixed model: interpreting the output when including a three-way interaction

I have specified a linear mixed model to examine the effect of an intervention study. More specifically, I am interested if any intervention effects vary according to age. The full model has four ...
0answers
9 views

### I need help to choose between GLM and LMM or GLMM

I have a dataset of 200 subjects, who were divided into a control arm and a treatment arm (100 per arm). I am investigating the incidence of pain above a certain threshold, so i was thinking if using ...
0answers
21 views

### Estimating risk ratio instead of odds ratio in mixed effect logistic regression in R

glmer is used to estimate effects on the logit scale of y when the data are clustered. In the following model ...
1answer
47 views

### Singular fit for model and want to retain random intercept

I've read many posts about singular fit issues and this: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#singular-models-random-effect-variances-estimated-as-zero-or-correlations-estimated-as--...
0answers
28 views

### Interpretation of GLMM summary in R [closed]

I have serious difficulty understanding the default R-summary of a GLMM model from the lme4 package. First of all, I would like to know how to interpret the ...
0answers
9 views

### R: lmer plot_model gives a “non-numeric binary operator” error

I am trying to plot the predictions for a linear mixed-effects model. The script worked well with glmer models but for some reason it gives me an error when trying to add additional features. The ...