Questions tagged [random-effects]
238 questions
2
votes
0 answers
How to compare GAMs that include random effects and factors?
I am trying to make a model comparison (say, for hypothesis testing) of two GAMs (mgcv package),
where both models include random effects smooth term (s(bs="re")), and the
second model additionally include a factor variable. So:
gm0 <- gam(y ~…

Kamil Bartoń
- 1,482
- 9
- 10
2
votes
2 answers
How can I incorporate a categorical variable with ~200 levels in a nonlinear mixed effects model in R?
I am trying to fit a nonlinear mixed effects model with a categorical variable genotype that has around 200 levels.
So this is the linear version of the model.
mlinear <- lmer(WUE ~ moisture * genotype + (1|pot), data = d8)
Now I'm trying to make…

Jon
- 21
- 1
2
votes
1 answer
How do I get the within-group association using lme4 in r?
Setup:
I'm testing if the association between pairs of individuals for a trait (BMI) changes over time. I have repeated measures, where each individual in a pair gives BMI data at 7 points in time. Below is a simplified data frame in long format…

Tom
- 23
- 4
2
votes
1 answer
Changing colour of data points according to random effect using plot_model
I want to plot the regression between a response variable and one of the explanatory variables in a mixed effects model while also showing the data points. For this I am using the function plot_model(). I would also like the data points to have…

Sarah
- 23
- 3
2
votes
1 answer
Random Slope model Assumptions
What are the assumptions of a random slope model? In particular I am interested in knowing the assumptions about level-1 and level-2 residuals and what are their expected theoretical distributions.
My model in R is this,
OUTCOME ~…

Bra
- 21
- 1
2
votes
0 answers
How do I include a random effect in PERMANOVA (vegan)?
Another newbie R question;
I have a few models structured similarly to this;
communitymatrix ~ variable1 + variable2 + (1|Random effect)
I want to run a permanova analysis and have structured it like this;
result <- adonis(communitymatrix ~…

meg
- 23
- 6
2
votes
1 answer
Model convergence warning with negative binomial glmer
I've read several posts about having convergence issues with glmer and I have tried a couple recommended work arounds (changing optimizer, changing model iterations, etc.) but nothing seems to resolve my convergence issue. I was wondering if someone…

Danielle
- 23
- 3
2
votes
1 answer
How to determine the correct mixed effects structure in a binomial GLMM (lme4)?
Could someone help me to determine the correct random variable structure in my binomial GLMM in lme4?
I will first try to explain my data as best as I can. I have binomial data of seedlings that were eaten (1) or not eaten (0), together with data of…

Slimke
- 23
- 4
2
votes
0 answers
Linear mixed effects models in R - mixed advice on random effects factors with less than 5 levels
I ran an experiment where I moved subjects arm about the elbow to a reference position, returned it to a home position and then asked them to try and replicate the position, all without vision of their arm. I then measured the error in their…

Nkitchen1
- 21
- 1
2
votes
1 answer
How do I deal with random effects terms specified in formula?
This is my following script:
library(lme4)
library(RColorBrewer) # needed for some extra colors in one of the graphs
library(lmerTest)# to get p-value estimations that are not part of the standard lme4…

Liat Shechter
- 21
- 2
2
votes
0 answers
Does the "subset" command in MuMIn's dredge function work with random effects?
I have the following GLMM with a random slope that I'm conducting model averaging on using MuMIn "dredge" (I don't think my dataset is relevant so I'm just including the code here):
sett_global2 <- glmmTMB(sett_dens~ depth_scale + sst_six_scale +…

Conrad
- 45
- 6
2
votes
0 answers
How do I specify a random slope for a specific contrast in lme4?
With the following dataset...
Subj <- rep(1:10, each = 10)
Item <- rep(1:10, times = 10)
IV1 <- rep(1:5, times = 20)
DV <- rnorm(100)
library(data.table)
data <- as.data.table(cbind(Subj, Item, IV1, DV))
data$Subj <- as.factor(data$Subj)
data$Item…

Dave
- 232
- 1
- 2
- 14
2
votes
1 answer
Random slopes Cox Proportional Hazards
I have been trying to use coxme to extract random slopes for each of the covariates in my model.
library (coxme)
Start <- runif(5000, 1985, 2015)
Stop <- Start + runif(5000, 2, 10)
S <- data.frame (
X1 <- runif(5000, 5.0, 7.5),
X2 <-…

AEM
- 919
- 1
- 9
- 22
2
votes
1 answer
Getting fixed effect estimates but not pvalues with glmmLasso
Hi I am trying perform a variable selection using the lasso approach, but my model includes a random effect.
I have run the model without the random effect using both the cv.glmnet and optL1 functions in glmnet and penalized (and got results);…

broch
- 97
- 6
2
votes
2 answers
Estimating logsitic parameters and random effects with nlme
I have managed to fit logistic curves to fit growth models for 129 fish belonging to 3 groups. Unfortunately the parameters I got were not consistent and very often the models I tried have crashed. Therefore I've simulated a data set on which I've…

Max13
- 21
- 1