# Tag Info

3

Please do not use stepwise procedures for model selection. They are very bad. So are p-values (when used for model selection). See the following for further reading: Algorithms for automatic model selection Understanding why stepwise selecton based on p-values is bad Why are p-values misleading after performing a stepwise selection? ASA discusses limitations ...

0

@BenBolker, thank you very much for your suggestions. When I applied your method: 1/ I got different results between the parametric bootstrap and the method of Molenberghs and Verbeke (devising the p_value by 2): PB_PAV= 0.06193806 where P_val_corrected= 0.4999999. 2/ I got absolutely the same values between the loglik of the GLM and the GLMER inside the ...

4

Based on Molenberghs and Verbeke (2007) (ref below) I believe the "divide by 2" rule still applies (I haven't fully absorbed/carefully read the paper). In any case, that rule applies asymptotically, so I would double-check by doing a parametric bootstrap: fit glm() model (== null model) (for loop x 1000) use simulate() to generate a new set of ...

4

There is an estimated zero variance at the level of yearmonth, and that is causing the singular fit. I would suggest fitting the following model: votesPercent ~ itemresponse_mean * itemsentiment_mean + yearmonth + (1|group) + (1|item_name) If this converges without singularity then try removing yearmonth alltogether and comparing the two ...

0

I know this is a super old post. But I had the same question so I used your codes to explore a little bit. Not sure if this is what you wanted. mydata1$X1 <- with(mydata1, X11+X12) mydata1$X2 <- with(mydata1, X21+X22) mydata1$group <- as.numeric(mydata1$group1) + as.numeric(mydata1$group2) mdl.nlme <- lme(fixed = value ~ -1 + D + X1 + X2 + X1:D +... 2 Corr is a lower triangular matrix containing the estimated correlations between the random effects. For example, the correlation between the random intercept and the random slope for timeL2 is -0.743, while the correlation between the randome slope for timeL3 and the random slope for timeL4 is 0.425, and so on. 0 This is a classic situation for McNemar's test. (To learn more about it, it may help you to read my answers here and here.) You have the following$2\times 2\$ tables: > tab A B A B A 16 16 B 29 17 > tab2 A B yes no yes 0 0 no 29 17 You test either with McNemar's test: > mcnemar.test(tab) McNemar's Chi-squared ...

2

You say that the factor Year nested in Plant If Year is nested within Plant. In that case, the moel should be lmer(Productivity~Temperature +(1|Plant/Year),data = data) or eqivalently: lmer(Productivity~Temperature +(1|Plant) + (1|Plant:Year),data = data) So, just to clarify, this means that each Year belongs to one and only one Plant. So year 1 could ...

2

The problem here is that you are fiting random intercepts for condition. Since you are interested in testing this variable, you should fit fixed effects for it. Moreover, with only 3 conditions, it doesn't make sense to fit random intercepts anyway since you will be asking the software to estimate a variance for a normally distributed variable from only 3 ...

4

It does not make sense for sex to be a grouping variable for random intecepts. It has only two levels and is in many scenarios it will be a confounding variable, or possible a competing exposure. In either case the best way to control for it, is by fitting fixed effects for it: glmer(Success ~ Block * MRT + sex + (1|Subject), data = data, ...

1

See here for an example that might help: https://rpsychologist.com/r-guide-longitudinal-lme-lmer

0

The response is said to be the percentage of errors in a test. That being so, it is bounded by 0 and 100. The lower zero bound is biting, meaning evident in the data, but the upper bound of someone getting every question wrong is still there in principle. Regardless of that, by scaling to a percentage the fact that the original data are discrete is being ...

1

Using weights=id isn't going to control for repeated measures on id. (Saying that is assuming that you do have repeated measures or some other kind of grouping.) You haven't described your study or your research question(s) so it is hard to be sure. So, since you have count data, and an excess of zeros, a good approach would be to fit a zero-inflated model. ...

3

This is expected behaviour. If it did not estimate both levels seperately there would be a missing estimate. This doesn't really have anything to do with mixed models or lmer or standardisation. It is expected, normal, behaviour whenever the intercept is omitted from a model. To see why this is the case, consider a very simple simulated dataset: set.seed(1) ...

16

As you have discovered, this happens when one of the variance components is estimated as zero. This typically has one of two explanations: the random effects structure is over-fitted - usually because of too many random slopes one of more variance components is actually very close to zero and there is insufficient data to estimate it above zero. Obviously ...

3

Can I perform this kind of modelling? I mean, is it ok to leave time point 1 and 2 out of my model? I am not interested in if they learn to answer faster either. Yes, there is no problem with this. You are effectively modelling the mean reaction time.

0

It seems like you coulddo something like ( EMM = emmeans(model, "filters) ) pairs(EMM) ... and look at how many df are reported for the pairwise comparisons. I'd use the smallest of those df

2

If you alter the control paramenters in lmecontrol it converges: cl = lmeControl(maxIter = 200, msMaxIter = 1000, niterEM = 500, msMaxEval = 2000) two <- lme(value ~ 0 + name+ name:uerate, data = dat, random = ~0 + name+ name:uerate | id, weights = varIdent(form = ~1 | name), control = cl)

3

Why does my model output show levels within the fixed effects and interactions? Imagine for a moment if it didn't, and to keep things simple let's suppose you have only one fixed effect, a factor, say Eye Colour, with three levels, say "Blue", "Brown" and "Other". Now, let us suppose that you are interested in the association ...

1

Without getting into too much math and simply from my experience - lmer should do the job just fine. A log transform should indeed bring your continuous DV closer to a normal distribution but it doesn't necessarily solve the issue entirely, just brings you closer to BLUE assumptions. Also, from my experience and the literature, mixed models might be ...

1

how do I account for the fact that: There are repeated measures for each subject. Doing (1 | subject) seems obvious here. Yes, that is correct. the demographic information correlates with age (how do I regress this variable out of the model to look at just the effect of age?) You would include these variables, along with age, as fixed effects. It does not ...

3

You have repeated measures within subjects so (1|subjectID2) is appropriate. curriculum and classMode are your fixed effects and the focus of your research question, so these should not be grouping variabls for random itercepts. The first model is the better one. Questions about how to do things in specific software are off-topic here, and I don't know ...

0

Since Group is factor, the low value (i.e. Decrease) is incorporated into the Intercept and then thus to account for the high value (i.e. Increase) a separate variable "GroupIncrease" is introduced into the model. One way to look at is the "GroupIncrease" variable models the change when the variable Group transitions from Decrease to ...

2

Late to this party but didn't want to miss out on all the fun! The terminology of level-1 and level-2 predictors is usually reserved for a situation where you have two random grouping factors (e.g., Industry, Company) and one of those factors is nested in each other (e.g., Company is nested in Industry, in the sense that each Industry represented in your ...

1

If this is your actual full dataset and you think it's important to account for subject effects, you're in real trouble, and whether or not to use K-R is the least of your problems. For most subjects, you have only one observation,so the subject effects seriously confound the time effects, and it's a fool's errand to try to sort them out. Your only ...

2

I realized that my comment above is general, so I'll submit it as an answer: In lme4 syntax, fixed effects are entered as you have them here, and random effects are specified with the | operator. Correctly specifying the random effects is key to returning the correct fixed effect coefficient. It looks like you have specified the nesting of companies in ...

2

Since this question is about re-writing a model specification, I'll focus on that aspect. Without knowing more about the data or precise inferential goal, I can't comment on whether either model is the right tool. I'm also unsure why the OP needs to rewrite a functioning model to use a different function within the same software package. Let's start from the ...

0

Why not? : m1 <- lmer(doy ~ year + siteID + year:siteID + (1 + year|sppID), data = df[sppID=="spp_1"]) If the species have very dissimilar responses and you are not interested in comparing sites, an interesting option would be to perform one model for each species and add sites as random term: m2 <- lmer(doy ~ year + (1 + year|siteID), data = ...

1

Class and Type are fixed effects. They should not be grouping variables for random intercepts. participant and verb are crossed, so I would start with the model: Answer ~ Prompt + Class + Type + (1 | participant) + (1 | verb) and then consider adding random slopes, if supported by the underlying theory and the data.

0

The first approach would be very similar to a stepwise regression (see wikipedia) for variable selection, which is something that is widely done but generally not "good scientific practice". This is because the selection procedure does not lead to valid estimates and p-values, which you are actually interested in. See also this question. The second ...

0

Another way to parameterize it would be to fit a longitudinal ANCOVA with post-test RT as the outcome, and pre-test as a time-varying predictor. If your main interest is in tracking post-test RT as a function of age, this gives you a direct measure of the age effect at post test, while controlling for the pretest. This seems more straightforward and should ...

1

It seems to me (just guessing though) that you should rather use the syntax: lmer(dep ~ predictor + control + (1|participant), data) Directly to your question: it is not a problem that each participant has a different number of words, if the data are missing at random. Check this out: https://rpsychologist.com/lmm-slope-missingness

0

The difference between the two is that dummy variables do not share information with each other whereas random effects do via a distribution. The dummy variable model estimates 28 different effects. The mixed model estimates a distribution from which the 28 effects are drawn from. They share information because they all contribute to the estimation of the ...

0

From the description, this is a partially crossed design. The 2nd model is appropriate for a design that is fully nested. The first model is appropriate for a partially nested design, provided that the factors are coded uniquely. For example, if you have tract1 in cbsa1 and you also have a tract1 in cbsa2, but these are actually different tracts, then you ...

Top 50 recent answers are included