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

Yes, you can first fit the model using the default treatment contrasts in R, and then you can use the emmeans package to perform the comparisons of interest, also correcting for multiple testing.


5

I agree that this can be a little confusing. Some authors avoid setting it up in this way. The important point is that the $\alpha_{i}$ are not estimated individually, instead they are subsumed into a general model and the usual assumption is that they are normally distributed, with an unknown variance, which is to be estimated. Focusing on the main point: ...


3

It doesn't make sense to fit random slopes for Days without including it also as a fixed effect, unless you know the the overall effect of Days is zero. Try including it also a a fixed effect. If it still doesn't converge, try removing Days as a random slope, and just keeping it fixed. If the first measurement of Days is much above zero, then you might ...


3

The point that is made in this paper is with regard to the conditional versus marginal interpretation of the regression coefficients. Namely, because of the nonlinear link function used in the mixed effects logistic regression, the fixed effects coefficients have an interpretation conditional on the random effects. Most often this is not the desirable ...


2

The reason why you get this warning is indeed because the term factor * x expands to factor + x + factor:x, and poly(x, 2) is equivalent (but not the same because it uses orthogonal polynomials) with x + I(x^2). Hence, you have two times the linear term for x. As a solution, you could try specifying the following formula y ~ factor + poly(x, 2) + factor:x. ...


2

Possible reasons why you get different results from the two packages include The default of glmer() is the Laplace approximation and not the adaptive Gaussian quadrature. You could try refitting with glmer() and increase the nAGQ argument. The optimization procedure in one of the two packages was not completely successful. You could try fitting the model ...


2

Some thoughts on each of your assumptions: I want to assume that measurements that are further apart in time are less correlated than measurements that closer (random slope). In theory, the random slope can help you with this, but the way you describe it here, it sounds like you believe there to be further residual autocorrelation (measurements ...


2

Yes, these models are nested and therefore you can use a likelihood ratio test to compare them. This can be simply done using the anova() function, i.e., anova(fit, fit_var) A significant p-value at your prespecified significance level would indicate that allowing for different variances for the error terms for the two groups improves the fit of the model.


2

Using some specific examples, I'd like to know which (if any!) of the following capture my needs... m1 <- lmer(score ~ X*sex+ age + (1+rater), data = mydata ) m2 <- lmer(score ~ X*sex + age + (1|rater), data = mydata ) # same as m1? m3 <- lmer(score ~ X*sex + age + (1|ID/rater), data = mydata ) # Error: number of levels of each ...


2

Indeed, your data do not support that hypothesis that there is significant variation in the outcome between the levels of the grouping factor. library(lme4) library(tidyverse) dat <- data.frame(f = rep(letters[1:6], c(26 + 40, 24 + 36, 12 + 37, 35 + 59, 20 + 32, 15 + 28)), y = rep(c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1), c(26, 40, 24, ...


2

In the two-stage approach, in the first step, you summarize the repeated measurements per peptide_Id into a single number. This inevitably leads to some information loss. To give another example, say that you measure the blood pressure of a patient ten times. Even though these measurements are correlated, they contain more information than their average. The ...


2

Typically, you'd use something like corCAR1(form = ~ date | site) or corAR1(form = ~ months_since_start_of_timeseries | site). This specifies time as an auto-correlation co-variate and groups by site. If your time series are perfectly regular and the data sorted by time, you could use corAR1(form = ~ 1 | site). However, I suggest that you do not use a ...


1

Most statisticians will tell you that categorizing a continuous variable is a bad idea, and I generally agree with that. In your case, you can allow the effect of continuous x to vary by a person's gender. This would then induce separate slopes of x for males and females as well as intercept values for males and females at x==0. It preserves all the ...


1

It is not entirely clear what you mean by "extracting treatment A," but I'm assuming that you are somehow limiting the data to only include data points from those who got treatment A. Personally I would trust the results from the lmer model more so than the results from the lm model(s) because the lmer model represents your actual design $-$ repeated ...


1

As noted in the comments of the other responders you have a quite small dataset, which makes fitting a mixed model tricky. In general, you could give a try to different optimization algorithms, and altering the defaults. For example, the simple random intercepts model seems to converge with GLMMadaptive when you increase the number of EM iterations, i.e., ...


1

Basically, the Wald statistic is not good and you shouldn't trust it for mixed models. It uses a much cruder approximation to the actual likelihood than you get with the profile and boot.ci methods. If R (and SAS and JMP and...) would have been written today, they would not have bothered implementing Wald stats. That's why the summary.merMod method ...


1

Normalizing the dependent variable as you have does not make sense. It would be one thing to take a regular z-score of it (based on the sample mean and standard deviation). Sometimes people do that to their predictors and outcome to get their coefficients into an effect size metric - 1 standard deviation increase in predictor is associated with XX standard ...


1

A couple of notes: In glmmTMB() and for a normally distributed outcome, specifying the random-effects structure as (1 + factor | ID) will be equivalent to us(0 + factor | ID) provided that dispformula = ~ 0. However, this is not equivalent to compound symmetry. The compound symmetry structure typically assumes that the covariance is the same for all pairs ...


1

As long as you have the same dependent and independent variables measured on all individuals, regardless of cluster membership, then you can use lmer to model your data. However, you state that each cluster has its own set of both observations and variables. Does that mean you have a unique set of variables that you measured on cluster A and then ...


1

Briefly, as noted in comments: You can specify a random effect for logistic regression in the glmer() function in the same way as you did for linear regression in lmer(). Residuals in a logistic regression would not be expected to be normally distributed. (For reference, in linear regression it's good to visualize the residuals as a function of predicted ...


1

The Bayesian options mentioned in the comment thread appropriately treat the outcome as if it were drawn from a beta distribution, but because the beta distribution restricts values to be between >0 & <1, zoib and brms allow you to model the inflation you have at 1. They do so by estimating a separate model for the range >0 & <1, and then for ...


1

The point in that the estimator for the marginal covariance matrix of $Y$, i.e., $\hat \Phi = {(X' \hat V^{-1}X)}^{-1}$ will be a biased estimator of $\Phi = {(X'V^{-1}X)}^{-1}$. If I see correctly in your simulation, you compare $\Phi$ with the empirically determined variance of $\hat \beta$, not $\hat \Phi$. Nonetheless, this bias is not that great. Check ...


Only top voted, non community-wiki answers of a minimum length are eligible