A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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.

Filter by
Sorted by
Tagged with
2
votes
0answers
30 views

Model selection: lme and splines or gam or gamm?

I am working with data from a cohort study. The variables are: psychological symptoms (continuous) light physcial activity (LPA) (continuous) moderate-vigorous physical activity (MVPA) (continuous) ...
0
votes
0answers
22 views

Don't understand how pseudo-R-squared results for mixed model are even possible (MuMIn in R)

We're using MuMIn in R to look at the delta R-squared when adding a term into a mixed model like this: ...
1
vote
1answer
43 views

Creating sex-specific quartiles as predictor in lmer()

I am using lmer() (lme4 package) in r to test whether a hormonal factor (x) predicts score on a mental health scale (y). I am using linear mixed models rather than a standard GLM because the outcome ...
2
votes
1answer
41 views

LMM model with nested design and random slopes: how to fit the autocorrelation term?

I am currently running a linear mixed model with a nested design and random slopes. For example, let's imagine some monthly captures of wild rabbits in kilograms in 5 sites during 21 years: ...
0
votes
1answer
11 views

Is it similar to but trt*period in a model as to compare each treatment to each period in a one way anova?

I want to know if there is any difference between the periods for each treatment. Baseline is included as a covariate.Should this give the same results? I know lmer include a random effect and lm ...
0
votes
0answers
10 views

Getting estimated marginal means from imputed pooled estimates from linear mixed models and marginal models in R [closed]

I'm running multilevel multiple imputation through the package mitml (using the panimpute() function) and am fitting linear mixed models and marginal models through the packages nlme and geepack and ...
2
votes
1answer
38 views

Std. Error estimates in mixed model of a parallel group design with repeated measurements are not as I expected

I have multilevel data and I would like to use mixed effects linear model. For each subject (sampleName variable), I have repeated measurements (...
1
vote
0answers
11 views

Relationship between Conditional R squared and random effect variance?

I have run a simple lmer with one fixed effect (day) and 3 random effects (athlete, infusion and sport). Model below. ...
1
vote
0answers
11 views

Relationship between Conditional R squared and random effect variance?

I have run a simple lmer with one fixed effect (day) and 3 random effects (athlete, infusion and sport). Model below. ...
5
votes
1answer
95 views

Why are there large discrepancies between Wald and bootstrapped confidence intervals for parameters of a lmer model in R?

I am dealing with a multilevel model with gaussian error distribution that has ~21,000 observations and 5000 clusters. The model is of the simple form: ...
4
votes
0answers
43 views

Is the algorithm of calculating SEs of beta coefficients calculated by the nlme gls finally fixed?

I can read here: https://www4.stat.ncsu.edu/~davidian/st732/examples/dental_pa.R and here: https://math.unm.edu/~luyan/stat57918/week14.pdf that: WARNING: There is a MISTAKE in gls(), and it DOES ...
2
votes
1answer
39 views

Getting singular fit error on lmer model after standardizing the response variable

I'm running a mixed model with the lmerfunction in R, and am running into an issue with singular fits. My dataset is comprised of 48,538 observations of sleep ...
2
votes
1answer
54 views

Is setting a certain covariance structure between random effects and zeroing R equivalent to setting this structure exclusively in residual matrix?

I'm wondering whether setting, say, a compound symmetry covariance structure between random effects and setting the residual covariance to 0 is effectively the same as not using the random effects G ...
0
votes
0answers
13 views

Is this possible to get Kenward-Roger correction for the GLS in R? [closed]

Is this possible to get Kenward-Roger correction for the GLS in R? Let's assume I want to model clustered, repeated in time data with autoregressive correlation. My sample is quite small, 25 ...
4
votes
1answer
50 views

Daily repeated measures with normalization

I have 2 Groups (Control and TRT, n=6x2) run in parrallel and I would like to highligh the potential effect of the treatement on variables (mydata[,ii]) measured daily (Day) during 80 days. If I ...
2
votes
2answers
50 views

Singular fit with simplest random structure in glmer (lme4)?

I am trying to run mixed models (logistic regression) on a dataframe with the glmer function from lme4 but I always receive this message: "boundary (singular) fit: see ?isSingular" Even if I create a ...
0
votes
1answer
36 views

Different regression models in clusters, same variance structure [closed]

I have data that can be clustered so that each cluster has its own set of both observations and variables. I want to fit a linear model on each cluster, but i want the clusters to share the same ...
6
votes
2answers
73 views

Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects model

In A Comparison of Cluster-Specific and Population-Averaged Approaches for Analyzing Correlated Binary Data, Neuhas, Kalbfleisch, and Hauck state: "With the cluster-specific approach, the probability ...
1
vote
1answer
34 views

Cross over design 2x2 with one baseline

I have an experiment that consist in two stages and 24 subjects between three groups. On the first stage, subjects were managed for them to answer in a certain way given the group (growth curve ...
1
vote
1answer
37 views

Mixed model with random slope and Intercept syntax?

I posted a similar question but I am still struggling to make sure my syntax is accurate. I used the Cosinor package in R to determine the amplitude value of each participant, based on heart rate per ...
2
votes
1answer
40 views

Is it ok to define the contrasts after building the model?

I have this mode starting model but I need to build the random structure but I am not sure if I can do that without setting the contrasts. Variable Time is a 3-...
1
vote
1answer
33 views

Comparing mixed models with weighted variance

I'm performing some linear mixed models for a psychological experiment. I'm not a statistician so my knowledge is limited. The basic idea is that: I have an experiment in which I model my response ...
0
votes
1answer
38 views

Binomial & numerical variables as dependent and independent + random variable

I am new to statistics and trying to figure out how to analyze my data correctly. I completed a biological study with the following variables: (I have converted my binary variables to 1 and 0) -Type ...
1
vote
0answers
29 views

Orthogonal polynomials lme4: Interpretation of significant quadratic predictor when linear predictor is not significant [duplicate]

Summary of Study Participants worked in pairs to complete three tasks. Periodically throughout the interaction, they evaluated one another across a variety of categories. The primary category of ...
2
votes
1answer
65 views

R formula for higher order polynomials and interactions, only allowing polynomial of degree 1 to interact

I am trying to build a (mixed) model using several predictor variables, and including some interactions and potentially higher degree polynomial versions of the continuous variables. The model formula ...
3
votes
0answers
39 views

Account for variance differences in linear mixed-effect model?

I'm not an expert statistician so excuse me if the question is trivial or not clearly written. I'm performing some statistical analysis of experimental psychology research. Basically, I have an ...
0
votes
0answers
19 views

What is the equivalence of BETWITHIN degrees of freedom in mixed-effect models R?

As in the title. Let's assume I cannot use the Kenward-Roger or Satterthwaite method in mixed-effect models. I was told to use the BETWITHIN method. Now I switched to R. I can use any package I want. ...
2
votes
1answer
44 views

Advice for R packages for GLMM and (adaptive) Gauss Hermite quadrature [closed]

I was looking here for a R package to make an estimate on a general linear mixed effects model (Poisson family) with two random effects and (adaptive) Gaussian quadrature. I also need the full matrix ...
3
votes
0answers
26 views

nested mixed effect ANOVA (lme4): can a factor be a fixed effect AND a nesting term for a random effect? [duplicate]

I study fish in a single large river and want to know if fish length differs between 3 large sampling 'sections' of the river. To answer this question, I measured hundreds of fish lengths within five ...
4
votes
1answer
60 views

Dealing with heavy-tailed residuals when fitting hierarchical linear models using lme4

This is my first time posting, so please excuse any issues with respect to my description of the problem and the presentation of the data and code I have supplied. Summary of the Design 30 listeners ...
1
vote
0answers
24 views

A confusing probability of mortality in glmer and effect plot

The mortality model in glmer presented a probability of mortality not in the way I expected: ...
0
votes
0answers
18 views

Regression with both between- and within-subjects factors

Does a fixed between-subjects IV need to be coded differently than a within-subjects variable in a lmer model in R? Or is the model smart enough to figure out these distinctions without any explicit ...
4
votes
1answer
75 views

Estimate of $\text{Var}(\hat\beta)$ in a linear mixed model

Let $Y = X\beta + Zu + \sigma\epsilon$ be a Gaussian linear mixed model. Let $V = Var(Y)$ be the marginal variance matrix of $Y$. Define the matrix $$ \Phi = {(X'V^{-1}X)}^{-1}. $$ According to this ...
0
votes
0answers
17 views

conducting a multilevel model with a continuous variable and categorical variable in r (+ post hoc)

I conducted a study in which I presented three types/blocks of visual stimuli (neutral stimuli in baseline, negative stimuli, neutral stimuli following negative stimuli). To examine the relationship ...
1
vote
0answers
17 views

Mixed model with one between and two within variables partially crossed. How to include items in random effects?

We have an experiment where participants solve two items presented in one of two types of brochure (OLD vs NEW). Participants see the first item with a randomly assigned age (20 vs 40) and a ...
2
votes
2answers
75 views

Mixed Model using lme4 in R for multiple response data

I am novice to R (from MATLAB) and have some questions about how to translate my data structure and research Qs to syntax for the lmer function. I am looking to predict teenagers scores on a mental ...
0
votes
0answers
47 views

Binomial Logistic-Normal Updating

I've been considering how sports with binary outcomes might be modelled e.g. the probability of a tennis player winning a point on serve. In text books the usual Bayesian approach uses the beta-...
1
vote
2answers
51 views

Problem with non-normal residuals (lmer function)

I work with animal personality and I am trying to analyze individual differences in response to certain stimuli. Taking this particular dataset as an example, I am analyzing how much distance ...
1
vote
0answers
11 views

R GLM/GLMER Differences in Intercepts Due to Group-level Variance

I've been playing with simulated multilevel data and came across something that I can't find the answer to. I find it instructive to demonstrate that logic of multilevel modeling by first getting ...
2
votes
1answer
66 views

Is the syntax of my mixed-effects model correct?

I am having trouble figuring out the proper syntax for my experiment's mixed effect model. I used the Cosinor package in R to determine the amplitude value of ...
2
votes
1answer
57 views

Adjust for correlation within group in linear mixed models

I'm trying to use a linear mixed model for this experimental setup: Students are tested three times, before and after a lecture, and after a pause, at two occasions. I want to test whether age and ...
2
votes
0answers
38 views

heteroscedasticity in a linear mixed model of longitudinal data

I want to evaluate the effectiveness of a psychological intervention in a RCT. My study consists of 150 subjects. Half of them were assigned to the intervention group. They are nested within three ...
1
vote
1answer
35 views

Testing contrasts in multilevel models

I'm trying to think of a way to test certain hypotheses regarding an experiment I've run. It's a 2 x 3 x 4 within-subjects, repeated-measures design. I would like to fit a (cross-classified) ...
2
votes
2answers
95 views

Quadratic terms in glmer

I'm looking for some references that explain step by step how to model logistic regression to longitudinal data (repeated measurements) in R. I know that I can use the ...
1
vote
1answer
35 views

Mixed models for longitudinal data

I'm starting to study the Linear Mixed Models (LMM) and the Generalized Mixed Models (GLMM) and I got kinda confused. If I want to apply logistic regression to a longitudinal data, I need to add ...
4
votes
2answers
78 views

Model selection for Mixed Effects Regression - Correcting heteroscedasticity

My experiment consist on measuring the root mean squared error (RMSE) between a path and what the participant produces. To produce the trace each participant experiences 3 feedbacks (1st factor - ...
3
votes
1answer
52 views

Filling missing data points with lmer prediction model

I'm trying to interpolate the missing data point using lmer model prediction. Subsetting to a table without any na to the missing column of interest: ...
1
vote
0answers
10 views

Linear combination of coefficients after multiple imputation in R [closed]

I have a longitudinal cohort which has 2 treatment groups and 4 time points. Let's say the model is $Y = Group + Time + Group*Time + Age + Gender + Race + Household Size$. Here are my analytic steps:...
3
votes
1answer
77 views

Can I use location as a random effect when treatment levels are not exactly the same across those locations?

I am working on a data set that aims to test various treatments with respect to vegetation regeneration. The experiment is replicated at many sites across a large geographical gradient and has been ...
1
vote
1answer
59 views

Binomial GLMM (GLMER) with proportions in unbalanced, observational panel data: nesting issues and errors

Thanks in advance. I am new to mixed models and having several doubts about a mixed model (lme4's glmer, binomial) with multiple levels, measuring a proportion [0,1] in three time periods. My data ...