# Tag Info

1

I found very useful advices in the Ben Bolker document: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#singular-models-random-effect-variances-estimated-as-zero-or-correlations-estimated-as---1 In particular, the advice to use the "blme" package was a great help to me. This solved all my problems with the random coefficient estimated at ...

3

Here are the no-pooling and partial pooling estimates for each school plotted against one another Note that the partially pooled estimates are pooled towards the completely pooled estimates (in red). This is the demonstration of the partially pooled estimates being shrunk towards the population mean. Here is the code to reproduce this figure library(...

3

The problem is that sch.id is stored as an integer (see str(d)) and in order for it to work as intended for the no pooling model, it needs to be treated as a factor variable. You can do this either by mutating the variable into a factor variable using dplyr or simply declaring it as a factor variable in your lm model: no_pooling <- lm(math~as.factor(sch....

3

For a binomial glmm, the main assumptions are: the outcome/response is binary. You said the variables including y are "all numeric" the random effects are approximately normally distrubuted. The main thing here is that you have sufficient number of participants for the software to reliably estimate a variance.

1

If the model matrix for subfeature + condition:feature is not of full rank, then I would simply remove condition from the random structure.

5

Without seeing the data and the model it is hard to be absolutely sure, but I would think that it just means that the p value is extremely small. We can do a simulation to show this quite easily: N <- 1000 group <- rep(c(1,2,3,4,5,6,7,8,9,10),100) x <- seq(1:N) y <- rnorm(N, 100, 1) + x + group/10 group <- as.factor(group) lmm.lme <- lme(...

0

The first model: Gene.mix <- lmer(ddCt ~ Status + Treatment + Status*Treatment + (1|Status:Animal), data=Gene1) will account for repeated measures within each unique combination of Status and Animal. You haven't explained what status is, though I'm guessing that it's the treatment group, but it is included also as a fixed effect and this rarely makes ...

1

You are correct in that frequentist mixed models look and feel very Bayesian, but point estimates and inference are different. In the standard formulation of a non-GLM mixed model we have $$y = X\beta + Z\gamma +\varepsilon$$ where $\beta$ corresponds to the fixed effects and $\gamma\sim\mathcal N(\mathbf 0, \Omega)$ is the random effects. \$\varepsilon\...

2

These models are not the same. The first model: Y ~ A + (C+B||particiapnt)+(1|B) does not make much sense because you are specifying that B is a grouping factor ( (1|B)) but then you are fitting random slopes for B, meaning that each level of B will vary with each level of participant. Apart from not making much sense, I would doubt that such a model would ...

3

I guess in this case you would like to depict the heterogeneity in the estimated slopes per subject. Then, you could extract the subject-specific intercepts and slopes using function coef(), and make the plot. The following code illustrates how this could be done with a linear mixed fitted in R using lmer() from package lme4: library("lme4") fm <...

3

Adding to the excellent response of @RobertLong, just a couple of extra points: Given the small sample size, it would be best to use the REML approach because it provides less biased estimates in this case. Perhaps the motivation to use lmer(..., REML = FALSE) is to do a likelihood ratio test, but, again because of the sample size, it would be best to use ...

3

note: I cannot add (1+Time_point|Subject) or (Time_point|Subject) due to singularity First note that (1+Time_point|Subject) and (Time_point|Subject) are exactly the same. Second it is not surprising that the addition of random slopes leads to a singular fit - you have only 38 observations and 15 groups. A slightly more Parsimonious model is to specify no ...

5

But, I'm wondering if I can also add information about the food and weather, which are not part of my fixed effects into my model( without including interactions) Yes, you can. By not including them as fixed effects, but including them as random slopes, you are saying that the overall mean slope is zero, but each individual subject (baby and weather in your ...

1

This is a similar solution to that used here using the pbkrtest R package. A mistake is that you are combining bootstrapped statistics with different sampled datasets. If you want to aggregate the bootstrapped log-likelihoods of two models, you need to estimate them with the same resampled datasets. This is a snippet to perform a parametric bootstrap: ...

3

So I went ahead and generated some data to demonstrate that these work as expected. library(tidyverse) library(lme4) if(!require(modelr)){ install.packages('modelr') } library(modelr) pop_mean<-10 n_groups<-4 groups<-gl(n_groups, 20) Z<-model.matrix(~groups-1) group_means<-rnorm(n_groups, 0, 2.5) y<- pop_mean + Z%*%group_means + rnorm(...

2

Question: Is the use of the phrase time points are "nested" within students just sloppy language? If it is, how could we correctly describe the relation of the time points to students? No, I don't think it's sloppy, but I can see why you think it might be and why it can be confusing. The main point is that nesting is a generic term, but in the ...

2

You can plot the residuals against the predictors using simulation techniques in DHARMa package, it also offers a range of diagnostics such as overdispersion, and outliers, I think its a practical and simple assessment tool for GLMM. Check it out: https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html

0

Since there is interest in the association of Treatment with the outcome, it should be a fixed factor. There are repeated measures per subject, and no interest in subject-specific associations with the outcome, so ID should be specified as a random intercept. By similar reasoning, replicate could also be considered random, however, with only 3 replicates per ...

2

For almost all variables you have the choice to model them with a fixed or random effect. I personally find the term random effect quite confusing, since random effects are usually just grouping factors for which we are trying to control. They are always categorical, as you can’t force R to treat a continuous variable as a random effect. A lot of the time we ...

2

From a mixed-effects logistic regression, you can show/calculate two types of probabilities. Namely, conditional on the random effects or marginal populations. For more information on the difference between the two, check this post. Most often you want the latter. Regarding getting this in R, you can have a look at the effects package, and the GLMMadaptive ...

1

A couple of points: Mixed models are used to account for correlations in the levels of grouping factor. If you are going to put date as a grouping factor, then you assume that binary measurements on the same date from different wetlands are correlated. To answer if this is a reasonable assumption, requires subject-matter expertise, but I would say that ...

1

you've probably found an answer by now but for anyone who is trying to ask a similar question I've found some answers in this updated version of the vignette you mentioned "Covariance structures with glmmTMB" (Kasper Kristensen, 2020-03-15). For your particular problem, I would use a unique identifier for each group within each individual year, ...

1

Yes, the proposed mixed model will separate the sources of variability, leaving the fixed effects (X) separated from the random effects of the combination of location/pair nested variables and date. Essentially, what the introduction of random effects do is to identify sources of variability, and by estimating them you can separate it from the error term, ...

0

You're probably used to the summary(object) function from the base, in which case the residuals of the object are equivalent to the residuals of the summary of the object (indeed, summary just stores the residuals in the class summary.lm). But with gls, you're probably using summary.gls() which, as mentioned in the documentation (see here), defines the ...

4

Question: Have I written formulas that convey the correct mathematical representation for my three-level model? Is my written interpretation of the coefficients in the equations correct? Unfortunately, no. The model you are fitting: lmer(value ~ A + B + C + (1|ID/stimulus_num), data = data) has the following features: A global intercept (fixed effect) ...

1

Yes, when you include the location and date as independent variables (as in your formula), you are separating their effects from X. However, you do want to be sure that you are not missing variables in your formula that impact the dependent variable. If you are missing variables, the effect of X that you get may not be the pure effect from X alone. By the ...

2

Fleshing out Dimitris' comment, you can look at this by considering the estimates you get from lmer and lm. Using your lmer model, we can ask for the estimated intercepts and slopes with the coef() function. The intercept listed in coef() is based on the overall (fixed effect/grand mean) intercept plus/minus each group's random effect deviation off the fixed ...

3

You could be misunderstanding how mixed effects models work. You say you want a seperate estimate for your fixed effects for each state. Well, that's exactly what you get when you fit random slopes for those fixed effects. There is an overall estimate for each fixed effect, and then an offset from the overall fixed effect for each state. You just neeed to ...

0

When dealing with time as a regressor in models, the distinction between "categorical" vs "continuous" is, in reality, too vague to be meaningful except that "categorizing" (with dummy encoding) is generally the wrong way to go. What most novice analysts mean when they say they adjust "continuously" for time is that ...

3

By default in R, treatment contrasts are used for factor. This means that what you get in the output from summary(mod) are the differences from the reference level for treatment. E.g., 37.4 is the difference between treatment B and treatment A. If you want to get the mean for treatment B, you will need to add the coefficients. For the standard errors, you ...

1

There's a lot on this in the relevant section of the GLMM FAQ: briefly, the three simplest approaches are to: get the equivalent of a quasibinomial model by first fitting the model and adjusting the standard errors etc. post hoc (there's code on the GLMM FAQ to do this); fit a compound model (Beta-binomial) — although you'll have to switch to glmmTMB or ...

2

One reason things might look different across lmer() and mixed is that lmer() (and I think lme()) estimates the covariance between the random slope and random intercept by default. On the other hand, mixed does not. You need to specify it explicitly as such: mixed isei_r fisei || country : fisei , cov(unstructured) See if adding this to your mixed results ...

5

It is difficult to see what is going on without a reproducible example. Nonetheless, mixed models are, in general, complex models. And because of this reason, the algorithms used to find the maximum likelihood may some times have trouble converging. Also, note that lmer(), lme() and STATA use different optimization algorithms with different defaults. Hence, ...

1

The chance of answering correctly decreases significantly by -0.95974 when comparing condition 0 to condition 1 (p < .001) It's Logit(p) rather than p, that decreases significantly by -0.95974 when comparing condition 0 to condition 1, with p being the chance of answering correctly, and: $$Logit(p) = ln(p/(1-p))$$ cond1:treatment1: When comparing ...

2

When you have interactions, things indeed get more complicated. But what you describe seems valid. That is, you select a specific value for the covariate, and make the pairwise comparisons for the different conditions using this particular value. Also, because you have fitted an interaction model, note that the main effect of condition is interpreted for a ...

1

This is a good set of questions you are asking. I'm not sure there is a right answer, but there are options you can consider, which I'll lay out below. You are right to be aware/concerned about the fact that observations in the same day might be more correlated than observations on different days. It is hard to tell if this is an issue right now because I ...

Top 50 recent answers are included