New answers tagged

1 vote

Overfitting in lme4 package: which is the best choice when repoting several models in the same research?

First, it's useful to point out that the problem you're encountering is that the models have "singular fit", which isn't exactly the same thing as "overfitting" - see here for ...
Eoin's user avatar
  • 7,597
5 votes
Accepted

A random effect nested in another random effect in R with mgcv package

If you have many schools, the factor by smooths may be appropriate, but you might get better/different results using a simple nested random effect. From a technical point of view the factor by smooths ...
Gavin Simpson's user avatar
0 votes

Mediation model with covariates and between and within-person mediators

I would like the stress level (stress) without disentangling as a mediator (2-1-1 mediation) Stress is the mediator, so it is an endogenous variable. The way this is modeled in MLSEM is that you ...
Terrence's user avatar
  • 1,528
1 vote

Interpret results of a mixed effects model analyzing a 2x2 cross-over study?

Is my code and interpretation correct? No! Your model has 2 large issues and the parameter you have extracted means something very different then what you think. The issues with your model: It is ...
Lukas Lohse's user avatar
  • 1,027
1 vote

How to do the post-hoc analysis for three predictors (two factor variables and one numeric variable)

Typically, you shouldn't look at the 2-way interactions if you have included a 3-way interaction into the model. I find the emmeans package function emtrends easy to use when unpacking interactions ...
Sointu's user avatar
  • 620
1 vote

R: Can judge significance based on overlap in graph produced by dotplot(ranef(model))?

No, this is not an appropriate way to evaluate if including the random effects improves the model fit. You could formally test that with a likelihood ratio test by comparing the model with and without ...
Dimitris Rizopoulos's user avatar
1 vote

How to structure higher level effect (between clusters) in mixed-effect models

The second option (... + (1|school)) is probably correct. In general the variables that you use as a grouping variable should be categorical and exchangeable (i.e.,...
Ben Bolker's user avatar
  • 38.8k
2 votes
Accepted

How to write the results of an hierarchical regression into an equation?

If LaTeX output is OK, try equatiomatic::extract_eq(mdl). For example, on this model: ...
Alex J's user avatar
  • 1,201
0 votes

How to determine contrasts in combinations of categorical variables with emmeans

I think you have a nested fixed-effects structure, where group is nested in sub_type. Did not ...
Russ Lenth's user avatar
0 votes

Interpreting Mixed Model ANOVA

There's some confusion here about null hypothesis statistical testing (NHST) and about causation. In the first question, you would reject the null hypothesis of no effect. That does not automatically ...
mkt's user avatar
  • 15.9k
6 votes
Accepted

Difference between four random effects structure

in general, terms shouldn't be in RE if they're missing from FE (By "terms" here I mean "terms that vary among groups", not "grouping variables"; in formula notation, ...
Ben Bolker's user avatar
  • 38.8k
2 votes

How to specify random effects for panel/longitudinal data with level 2 predictor?

ORIGINAL ANSWER Without knowing much about this (interesting!) subject, I'm not sure you need the year in the model at all. Perhaps you need it for some other reason, but not to investigate gender ...
Sointu's user avatar
  • 620
0 votes

Multinomial glmm with glmmADMB in R

mgcv package seems very slow and space inefficient. I was only able to estimate the binary model. The multinomial model could not complete the estimation.
Harsh's user avatar
  • 1
0 votes

Bayesian mixture model with Random Effects in Linear Predictor

Here is a potential viewpoint of the sort of model that you can have: $$y_i|z_i,x_i \sim \mathcal{N}(\mu_{z_i,x_i},\sigma_\epsilon)$$ where $x_i$ is an index for the individual. With priors $$\begin{...
Sextus Empiricus's user avatar
-1 votes

What is the meaning of $\oplus$ and $\otimes$?

Suppose $A=\begin{pmatrix}a&b\\c&d\end{pmatrix}$ and $B=\begin{pmatrix}e&f\\g&h\end{pmatrix}$ Then, A$\otimes$B=$\begin{pmatrix}a&b\\c&d\end{pmatrix}$ $\otimes$ $\begin{pmatrix}...
Abhijeet Kumar 's user avatar
0 votes

Mixed Effects or other Model for Binary Interventions and Binary Outcome

Since you don't seem to have a strong reason to consider effect of the course as random and with only 10 different courses I would recommend against random effects, based on the glmm-faq from Ben ...
Lukas Lohse's user avatar
  • 1,027
2 votes

Multiple predictors that measure the same concept in regression

If you can reasonably assume that the three questionnaires measure the same dimension/latent variable representing musical training (MT), you could aggregate the three scores and use a single ...
Christian Geiser's user avatar
0 votes

Normalizing Data in Multiple Categories

Since your goal is simply to identify the best/fastest user overall, I would start with a mixed/hierarchical model of the form: ...
mkt's user avatar
  • 15.9k
0 votes

Unstructured model vs random slope model for repeated measures based on R functions lmer, lme and gls

The gls and lme models have an important difference. As this Stack Overflow answer quotes from Pinheiro and Bates: The gls ...
EdM's user avatar
  • 81.8k
1 vote
Accepted

Interpretation of lme4 output with different contrasts for variables

The unique rows of your fixed effects design matrix under your first contrast specification can be obtained via ...
statmerkur's user avatar
  • 4,440
0 votes

Mixed effects model to explore the linear relationship between two variables for each level of the repeated-measures in Rstudio using lme()

Using the data you provided: look at the model summary first: ...
Sointu's user avatar
  • 620
3 votes

How 'by' factor works with 'fs' random smooth in gam?

You missed some important output from plot_smooth() and some critical understanding about what the function is doing. The reason I was confused absent knowledge ...
Gavin Simpson's user avatar
1 vote

Why are Bayesian mixed-effects models (e.g., brms) more able to estimate complex models than Frequentist mixed models (e.g., lme4)?

Random effects are used to capture correlations in the data, namely, within the same level of the corresponding grouping factors. The parameters that quantify the strength of these correlations are ...
Dimitris Rizopoulos's user avatar
2 votes

Why are Bayesian mixed-effects models (e.g., brms) more able to estimate complex models than Frequentist mixed models (e.g., lme4)?

When you “estimate” a Bayesian model most often what you do is you sample from the posterior distribution. Posterior is, by Bayes theorem, basically a product of the priors and the likelihood. If you ...
Tim's user avatar
  • 131k
4 votes

Why are "fixed" and "random" called that?

Because like many other fields (possibly all other fields), statistics terms were not created at the beginning, then used, but rather have evolved over time and many terms make sense from one ...
Greg Snow's user avatar
  • 49k
3 votes

Plotting a regression line with a different fit than the model it is supposed to illustrate

I assume that by 'size', you mean something like body length. Your model is inconsistent with the data, and ignores much that is known about such scaling relationships in biology. As a start, it's ...
mkt's user avatar
  • 15.9k
3 votes

Fitting a Markov chain with variable path lengths (survival analysis)

I'm worried about the effect of individual variance in this setup. For example… those individuals with a tendency to quickly transition into state 2, they will have a small impact on the transition ...
Sextus Empiricus's user avatar
3 votes

Fitting a Markov chain with variable path lengths (survival analysis)

Technically, according to Wikipedia, A Markov chain or Markov process is a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state ...
EdM's user avatar
  • 81.8k
5 votes
Accepted

Fitting a Markov chain with variable path lengths (survival analysis)

In the case of a single terminating event, a comparison with the Cox PH model as @sextus-empiricus suggested is a great idea and you'll find that the two will provide virtual identical standard errors ...
Frank Harrell's user avatar
1 vote
Accepted

Examples for using mixed models in physics & engineering

As I see it, there is no reason why these models cannot be used in these domains. My feeling is that there is a degree of techniques falling in and out of fashion. Often students will learn the ...
8e9yQBKVlIDwoIVegfkJ's user avatar
1 vote
Accepted

Hierarchical gam (HGAM) with 'by' ordered factor and random smooth 'fs' effect: why so wiggly?

By removing 'k=20', the wiglyness disappears. I deduce (without being able to demonstrate it) that the ordered factor-based model as proposed here should not have too many degrees of freedom to be ...
denis's user avatar
  • 75
0 votes

Should I pool multiple observations from the same experimental unit, or use mixed effects models

Thank you very much for this complete answer @BenBolker. I guess things do get messy with my data because my responses are non-Gaussian. Your example has quite the design I have (just simpler). ...
Rodolfo Pelinson's user avatar

Top 50 recent answers are included