Questions tagged [lme4]

lme4 is an R package for fitting and analyzing linear, nonlinear and generalized linear mixed models.

Overview

lme4 is an package for fitting and analyzing linear, nonlinear and generalized linear .

Repositories

Vignettes

Books

Other resources

Related tags


Tag usage

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

1729 questions
0
votes
1 answer

Post hoc for binary GLMM (lme4) and plot

So I'm an R novice attempting a GLMM and post hoc analysis... help! I've collected binary data on 9 damselflys under 6 light levels, 1=response to movement of optomotor drum, 0=no response. My data was imported into R with the headings 'Animal_ID,…
0
votes
0 answers

Problem analysing LME outcomes when I reduce the number of factors in a variable

I have a variable with 4 factors that I put into the LME model as an independent variable (Status). The outcome in lme gives me 1 factor as a reference value and the other 3 referenced to that one. I have tried to apply 'emmeans' to get multiple…
Lili
  • 547
  • 6
  • 19
0
votes
1 answer

Run HLM mediation in R

I try to run HLM mediation with the "mediation" package: med.fit <- glmer(M ~ treat + control + (1|subject_id) ,family = binomial(link = "logit"), data = R1_data) out.fit <- glmer(Y ~ M+ treat + control+ (1 + M|subject_id),family = binomial(link =…
Tirza
  • 1
  • 1
0
votes
1 answer

Installing an old version of lme4 package in R

I am struggling to install the 1.1-13 version of lme4 package in R. I went to https://cran.r-project.org/src/contrib/Archive/lme4/ . But I am not understanding the next step after downloading lme4_1.1-13.tar.gz. What should I do next? Thanks in…
ABC
  • 341
  • 3
  • 10
0
votes
1 answer

removing covariates from a linear mixed model using update

I'm newish to R. I have a linear mixed model with several predictors and I want to test the significance of each of them. I know that I could use lmerTest but my co-authors want me to do a likelihood ratio test for each predictor instead. I would…
Carol
  • 3
  • 2
0
votes
0 answers

lmer error couldn't evaluate grouping factor

I am trying to fit a rather simple, linear nested model (teachers within schools) with about 700,000 datapoints (300,000 unique teacher ids; 60,000 school ids) as follows: formula=outcome ~ Gender + covar1 + (1|schoolid/teacherid)…
SanMelkote
  • 228
  • 2
  • 12
0
votes
1 answer

Simulate repeated measures binary data with specific odds ratio

I'm trying to simulate a binary outcome where I have N subjects (with subject-specific probabilities) measured in two distinct periods (say before and after). I want to increase the subject-specific probabilities by a certain odds ratio (OR) value…
0
votes
1 answer

How to add baseline values of outcome at time = 0 as a fixed effect in mixed effect model?

My study was a 12 week long study involving two diets (diet). Outcome measurements such as weight, waist circumference etc. were taken at time (time) = 0,6,and 12 week intervals. (Code) stands for subjects. I tried the following code to create a new…
DiscoR
  • 247
  • 2
  • 11
0
votes
0 answers

Bootstrapping a glmer model in R and associated errors

I have the following glmer model which I have run in lme4, in R: m1=glmer(Survived~Offset+(1|Trial/Chamber), family=binomial, data=surviveData) Survived is a binary response, Offset is a three level factor, Trial is a 2 level factor and Chamber…
JeanDrayton
  • 131
  • 2
0
votes
2 answers

Marginal effects from glmer

Variations on this question has been asked before (e.g. Is there a way of getting "marginal effects" from a `glmer` object), and most of them suggest using ggeffects (or sjPlot). However, a statistician at our faculty is having some trouble agreeing…
stapperen
  • 137
  • 1
  • 9
0
votes
0 answers

How to formulate the regression model in R for trials over multiple years?

I'm working in a research facility for agriculture where we do a lot of trials that continue over several years. For the example below i tried to find out how to formulate the regression model correctrly so that "year" is integrated in the model…
Stefan
  • 123
  • 1
  • 10
0
votes
0 answers

Predict() won't give standard errors for mixed-effects logistic regression

I would like to calculate the predicted probability for a logistic regression. The dependent variable is a dummy variable. The predict() function is not allowing me to get the standard errors, which I need to calculate the confidence interval for…
user91132
  • 11
  • 3
0
votes
0 answers

p values in lmer using lmer Test. Running the model multiple times to get robust p values?

I use lmerTest to obtain p values for my lmer models in R. Unfortunately, running the model multiple times give me different p values each time. Is there a way running the model multiple times to calculate one robust p value? Any other way to obtain…
0
votes
1 answer

Dunnett test for mixed effect model of incomplete block design in R

(First question here on SO, apologies for any mistakes!) I'm trying to analyse data with a linear mixed model accounting for block (Plot) and genotype (Line) effects with Welch-Satterthwaite adjustment of degrees of freedom to account for the…
0
votes
1 answer

Confidence Interval in mixed effect models

library(lme4) fm1 <- lmer(Reaction ~ Days + (Days|Subject), data = sleepstudy) To generate a 95% CI, I can use the predictInterval() function from the package merTools. library(merTools) head(predictInterval(fm1, level = 0.95, seed = 123, n.sims =…
89_Simple
  • 3,393
  • 3
  • 39
  • 94
1 2 3
99
100