242 questions
Advice
0
votes
1
replies
30
views
Check assumptions of mixed effects cox model
I am running a mixed effects cox model using coxme in R, and I cannot find any information on how to check model assumptions for this type of model. I have seen the older chats, which have recommended ...
3
votes
1
answer
90
views
Using sjPlot::plot_model to generate plot of lmer model with log-transformed dependent variable
I've got a lmer model that looks similar to the following example:
library(lme4)
df<-data.frame(var_1=c(1.1,2.2,2.1,4.4,4.4,5.6,4.4,2.6,3.3,3.3,3.9,3.8,1.1,1.3,1.4,1.1,1.8,2.1),
...
0
votes
1
answer
74
views
Random Effects v.s. Random Design Matrix
It is commonly explained that a random effect is used when the values of the variable associated with the random effect are drawn from a population, such as schools in the sample out of schools in the ...
1
vote
1
answer
260
views
How to format a random effect (i.e., + 0 vs. + 1) in my glmmTMB models
I am working on creating GLMMs to determine the effect of in-air noise on harbor seals. I have a couple other fixed predictor variables (current velocity and time) and some random effects. As I am ...
1
vote
0
answers
222
views
ar1() or ou() for my glmmTMB models in RStudio?
I am working on creating GLMMs to determine the effect of in-air noise on harbor seals (specifically the number present). I have a couple other fixed predictor variables (current velocity and time) ...
2
votes
1
answer
295
views
How can I extract and report the random slopes and confidence from a glmer in R?
I would like to report the random slopes from a binomial lme4::glmer model along with their confidence or deviations. I am adding the fixed effect to each random effect to obtain slopes, but how do I ...
2
votes
0
answers
521
views
Plotting brms random effects with tidybayes
Tidybayes can make great-looking plots for the output of Bayesian models, but it's not clear (as far as I can see) how to do this for different types of models.
So for fixed effects, we can do this (...
1
vote
1
answer
177
views
How to test more than one random slope in R for significance?
I set up a multilevel model in R with the lme4-package to test different effects on social participation in primary school classes. Now I assume that the effects of academic performance (sp) and ...
0
votes
0
answers
51
views
Is it normal that lme + random gives lower estimates than gls?
I was using a gls to model BMI trajectories based on intake of a nutrient, but realised I needed to switch to lme de to the multi-level clustering of my sample (twinID within famID).
The code for my ...
1
vote
1
answer
259
views
How to specify year for nested random effect?
I am quite new to R and is setting up a mixed effect model with lmer. I have a large dataset and want to include 3 random effects that are nested. I have data from 2 years, 2021 and 2022, and there ...
1
vote
0
answers
298
views
glmmTMB and nested random effects
I'm fairly new with stats and using glmmTMB and glmer, so bare with my explanation.
I'm analyzing data that is looking to see how different socioeconomic variables interact with each other and predict ...
0
votes
0
answers
73
views
Why would repeated measures random effects model values from polr() (in MASS package in R) be identical for all data points?
I have survey data involving two categorical IVs (Prompt_Condition and Response_Condition) of three levels each and one ordinal DV (value, a Likert-type ranking 1-7). There are 31 subjects who rated ...
0
votes
0
answers
754
views
how do I fix this glmer error in r: PIRLS loop resulted in NaN value
I am trying to run a random effects generalized linear model specifying the family as binomial and a log link to estimate risk ratio (RR) and 95% confidence intervals (CIs). When I run it, I keep ...
0
votes
0
answers
44
views
I need help in estimates lme models
I'm analyzing two models of class LME for longitudinal data (observations in two times), but
this message appears Error in lme.formula(y ~ x, random = ~1 | id, data = data_long) : nlminb problem, ...
0
votes
1
answer
745
views
Repeated measures in random effect lmer
I am looking at data from repeated experiments with 3 participants (hawks). We recorded the number of times we did the experiment with them (about 50x each) so that we could account for their learning ...
2
votes
2
answers
431
views
Random effects from Intercepts and Slopes as Outcomes model
I am trying to reproduce with R the results from Intercepts- and Slopes-as Outcomes model from Hierarchical Linear Models by Raudenbush and Bryk, which deals with High School and Beyond dataset.
Model ...
0
votes
1
answer
71
views
Error in abs(c(deltas, deltas2)) : non-numeric argument to mathematical function - RStudio
I'm trying to use the BugsNet package for NMA with contrast date.
However, when performing the random effects model operation, the message above appears.
I'm using the code below:
library(BUGSnet)
...
3
votes
1
answer
1k
views
Nonparametric way to perform ANOVA of linear mixed model and power calcualtion
I have a small data where there are 3 groups (A,B,C) and 5 participants from each group. All of those participants are measured 6 times on each of 7 different exams, so each participant get 6*7=42 ...
0
votes
0
answers
48
views
How to add stat results to a ggplot regressions with random effects and facet_wrap using the fitted function?
This is a continuation of my previous question listed here and works off of the lme4 tutorial for sleepstudy here.
My 1st question is how can I use ggplot to graph a regression with random effects ...
0
votes
1
answer
196
views
Meta-analysis with metafor package in R
I am encountering difficulties while attempting to display the incidence rates per 100,000 as my effect size variable on a forest plot. The logged-transformed rates are being displayed correctly, ...
0
votes
0
answers
106
views
How to fit a time series mixed model with several random effect in R (nmle)?
I need to fit a time series mixed model in nmle. I found that nlme allows to specify the heterogeneous structure of the variance. My response variable is yield, which is dependent on
fixed factors: ...
0
votes
0
answers
95
views
How to aggregate ORs from the same study, and after that use these aggregated effect sizes to do a meta-analysis in R
I am trying to do a meta-analysis with a random effects model. The data includes: study, Odds Ratio (OR), and 95% confidence interval. For the meta-analysis, some categories were made consisting from ...
0
votes
1
answer
61
views
random effects structure with weird residual plot
So We are triying to fit a glmm to my_data. my_data
Figure Figure resume the descriptive statistic of my_data. D0.Richness is unbalanced (n=sample size for each Group1 level) as we can see in figure. ...
0
votes
1
answer
87
views
Discrepancy when printing meta-analysis results using summary() function and accessing the elements with in the meta-analysis object
I'm performing a huge chunk of random-effects meta-analysis in R using the meta package and I am trying to export my results. However, I'm encountering a discrepancy in the pooled effect sizes per ...
2
votes
1
answer
101
views
Decomposing residuals into between and within group in Pymer4
i have a question about mixed-effect in Pymer4 (same of lme4 but in python). My model is fitted under machine-learning to get the predicted values (Observed_values = predicted_values + total_residuals)...
3
votes
1
answer
209
views
Standard Error of Variance Component from the output of GLMMadaptive::mixed_model
I am using the {GLMMadaptive} package to fit a mixed effect random slope model. And I need to extract the standard error of variance components from the output of GLMMadaptive::mixed_model(). And ...
2
votes
1
answer
307
views
How to extract metafor::rma.mv() equivalent of lme4::VarCorr() for multilevel mixed effect meta-regression with random slopes
I am attempting to calculate pseudo R squared's for a multilevel mixed-effect meta-regression that includes random slopes in the metafor package (i.e., rma.mv() object) using a similar approach to the ...
0
votes
1
answer
78
views
Formula difference specifying random effects on slope rstanarm
I believe the same syntax is used with the lme4 package as rstanarm, but I'm having trouble figuring out exactly what the differences are between the different options when fitting a grouped random ...
1
vote
1
answer
2k
views
How to get 95% CI for each level of a random effect in a lmer mixed model
I have run several mixed models in lme4 with some main effects, a few interaction terms, and two random effects (animalID and year). My model looks like this:
model <- lmer(response ~ ns(area_scale,...
0
votes
1
answer
79
views
Error in anova(): "Error in getResponseFormula(el) : 'form' must be a two-sided formula"
I have a longitudinal dataset for plant growth recorded in different seasons. I fitted the data to growth models with/without seasonal effect using nlme function from nlme package.
To see the seasonal ...
4
votes
0
answers
108
views
"optim" function fails to converge for maximum likelihood estimation in a random-effect model
I have a longitudinal dataset for plant growth that includes repeated measurements in different seasons. I am trying to estimate the parameters for a growth equation using this dataset. The growth ...
0
votes
1
answer
175
views
lme4: How to specify estimated parameters for a specific model in the lmer function?
I have a longitudinal dataset for plant growth, where each row represents an individual plant's measurements over multiple seasons. The variables in the dataset include
"id" (individual ...
0
votes
1
answer
56
views
How to add random effects in a tree taper model?
I am learning to fit a tree taper mixed model using R. So I would like to know how can I add random effects in the model?
Let's say we fit the model using variable-exponent taper funtion of Kozak (...
2
votes
1
answer
285
views
Model predictions for a nested random effects model in R?
I am trying to fit a mixed model with random effects: lmer model to the dataset df based on this example here. However, I run into an error that says invalid "times" argument. Any ...
1
vote
1
answer
726
views
Nested sample design in mgcv syntax
I'm having trouble translating my sample design into the correct mgcv package syntax for random effects.
Here is the set-up: we trawl for fish, once per "collection" site, at the same 12 ...
0
votes
1
answer
713
views
Running a post-hoc test on a random effect model with two dummy variables in R
I have a data frame in R - my code is as follows:
library(lme4)
library(lmerTest)
library(multcomp)
#Create DF
df <- data.frame(
col1 = rep(1:3, each = 3),
col2 = rep(c("A", "B&...
0
votes
1
answer
887
views
How to exclude random slope effects when predicting with gamm model using predict.gam?
I'm trying to understand what actually happens when using exclude to exclude subject-random slope terms from the prediction function mgcv::predict.gam(). I'm finding that regardless of whether I ...
0
votes
0
answers
235
views
Three level mixed model with a random slope on only one level (nlme)
I would like to fit a mixed model in R using the library nlme. I have three levels: election year, district, and candidates (unfortunately I cannot share the data). Districts are nested in election ...
0
votes
1
answer
412
views
A setting to subjectively adjust random effect variance in R package glmmTMB?
From my layman understanding of frequentist hierarchical models, there is some penalty mechanism built into the likelihood function, that prevents the random effects from overfitting to the data and ...
0
votes
1
answer
447
views
How do I suppress random effect but retain AR(1) correlation structure in R's lme mixed model
I am trying to re-create some SAS mixed model analyses using the lme function of R. The following SAS code:
proc mixed data = df noclprint covtest;
class patid visno;
model va = cst va0 cst0 / ...
-1
votes
1
answer
144
views
How to specify counterbalance as random effects when analyzing random-effects modelling using the lme4 package?
I am analyzing a dataset with multilevel modelling in R using the lme4 package. I conducted a study where The influence of participants and learning materials were counterbalanced. Participants went ...
1
vote
0
answers
265
views
Multinomial mixed effect model in R
I would like to make a multinomial model with random effects, but I don't know how.
The model would look like this: native_driftertype ~treat+(1|replica)+(1|compartment/originhive),
with ...
0
votes
1
answer
176
views
lme4 gives singularity warning for model with three-way interaction
I have a nested data set specifying cells (no, 240 values) within experimenters (experimenter_1_2, 2 values), as well as treatment status for three different treatments (cis_0_1, 2 values; rt_0_1, 2 ...
3
votes
0
answers
561
views
Predict function for Tobit model using censReg in R
I want to estimate a Tobit model with random effects and afterwards use the model for prediction.
Estimation is possible with the censReg package, however it does not provide a predict function.
I ...
1
vote
1
answer
558
views
How to input model specification for glmmLasso to get expected iterations?
I'm trying to run glmmLasso on some data with the subject IDs established as the groups for random effects. This is seen in several posted examples of glmmLasso and the example soccer data set ...
1
vote
1
answer
269
views
Can glmmLasso be used with the Tweedie distribution?
I have a linear mixed effects model and I am trying to do variable selection. The model is testing the level of forest degradation in 1000 sampled points. Most points have no degradation, and so the ...
0
votes
1
answer
423
views
Cannot fit multilevel ordinal logit model using clmm
I'm trying to fit a multilevel (random effects) ordered logit model using the ordinal package, but I keep running into this error:
Error in region:country1 : NA/NaN argument
Here's my simplified ...
0
votes
1
answer
29
views
For loop is executing on multiple divs at a time, instead of applying it one by one on div
I am creating randomly fading squares on the image. They end up one by one partially revealing the image. This function was meant to hide random squares one by one but it is hiding them abnormally.
...
1
vote
1
answer
1k
views
Likelihood ratio for glmmTMB model?
I have a mixed model where I'm trying to find the significance of my random effect. The model is a mixed model with zero-inflated beta distribution which I built using the R package glmmTMB, with the ...
0
votes
0
answers
91
views
predict() function from rma object producing results that are too large
I'm trying to produce partial regressions based on an rma object:
tmc<-rma(yi, vi, mods = ~ temp_annual_range+max_temp+min_temp+Wildfire, method="ML", data=formsc)
Based on this, I want ...