Hot answers tagged

27 votes
Accepted

Which multiple comparison method to use for a lmer model: lsmeans or glht?

Not a complete answer... The difference between glht(myfit, mcp(myfactor="Tukey")) and the two other methods is that this way uses a "z" statistic (normal ...
Stéphane Laurent's user avatar
24 votes
Accepted

Is least squares means (lsmeans) statistical nonsense?

The short answer is that LS means (or more modernly, estimated marginal means) are incredibly useful with experimental data. With observational data, not so much. A long-winded explanation follows. ...
Russ Lenth's user avatar
9 votes
Accepted

Is the emmeans R package performing causal inference G-computation?

Re-reading your question, my understanding is that you are asking if emmeans() does G-computation as part of what it ordinarily does. And based on my very limited ...
Russ Lenth's user avatar
9 votes

multicomp package and emmeans package produce different adjust pvalues for Dunnett procedure

I've dug through the source code (the great thing about it being open), and it turns out that glht(..., mcp(trt = "Dunnett")) pulls its P-values out of a ...
PBulls's user avatar
  • 3,658
8 votes
Accepted

Interpreting the standard error from emmeans - R

OK, let us dissect this model. First, the model itself: ...
Russ Lenth's user avatar
8 votes

Distinct results between "emmeans" and "multcomp" - package in multi level model

I will explain using a somewhat simpler model, but with the same kind of discrepancy. Consider the pigs dataset in the emmeans package. ...
Russ Lenth's user avatar
8 votes

Why does GLM with Gaussian family give different results to LM in R?

Note that in the model summaries, the regression coefficients and standard errors are the same. In the comparisons outputs, the estimates and SEs are the identical. Also the t ratios in the first are ...
Russ Lenth's user avatar
8 votes
Accepted

Contradiction between emmeans and t.test in R

You said your conditions are within-subject but you did an independent samples t-test. If you do a paired t-test (i.e., setting paired = TRUE in the call to ...
Noah's user avatar
  • 32.4k
7 votes

How are the degrees of freedom in the emmeans package calculated? - R

Your t.test() results are each based on only selected portions of the data, whereas the emmeans() results are based on a model ...
Russ Lenth's user avatar
7 votes
Accepted

SE for estimated marginal means

The following code illustrates how this computation is done: ...
Dimitris Rizopoulos's user avatar
7 votes

Does the P value adjustment for Tukey method in emmeans differ between "between group" and "within group"

If there are comparisons you don't think are appropriate, then you really shouldn't do them. And yes, it does affect the Tukey-adjusted P values. What I suggest instead is something like this (...
Russ Lenth's user avatar
6 votes

Calculating ratios for contrasts after lmer model

It is doable! You have to do it in stages, though. Using the warpbreaks data to illustrate, I'll do such comparisons of wool at ...
Russ Lenth's user avatar
6 votes

Units of emmeans output?

Do emm <- emmeans(mod, "city", type = "response") emm pairs(emm) The comparisons will be odds ratios. You can also do ...
Russ Lenth's user avatar
6 votes

Pairwise comparisons via emmeans

Your reviewer has a good point, because you have both between- and within-subject comparisons in your collection, and those have different standard errors. But the other thing I notice is that there ...
Russ Lenth's user avatar
6 votes
Accepted

In emmeans package, how to exclude certain uninteresting contrasts from pairwise comparisons

Question 1 As is documented, P-value correction is done by default separately for each by group. In this case, each by group ...
Russ Lenth's user avatar
6 votes
Accepted

Default pairwise test in emmeans

OK, I think I understand it now. The answer is that the term "adjusted P value" doesn't necessarily mean that a set of P values is obtained, and then we adjust those values somehow. There ...
Russ Lenth's user avatar
6 votes
Accepted

R pairs function, adjust, tukey/tukey-kramer?

This means it obtains P values from the pstudent() function in R. For unbalanced data (or in general, for unequal SEs or non-spherical correlation structure), this ...
Russ Lenth's user avatar
5 votes

What are LS means useful for?

I disagree strongly with the "only situation" in the OP. EMMs (estimated marginal means, more restrictively known as least-squares means) are very useful for heading off a Simpson's paradox situation ...
Russ Lenth's user avatar
5 votes

Standard error all the same in lsmeans on a mixed model

It makes perfect sense if your data are balanced, i.e., you have the same number of observations in each Treatment * SubjectType * Year combination. (That's how ...
StasK's user avatar
  • 31.4k
5 votes
Accepted

Which test does the lsmeans package use to compare the means in pairwise tests and what are its assumptions?

It uses $t$ tests, the observed contrast divided by the estimated standard error. It gets this information from the fitted model. Thus, the validity of the result depends on the validity of the model. ...
Russ Lenth's user avatar
5 votes
Accepted

compare differences between conditions with emmeans

Yes. contrast(emmeans(m, ~f1*f2), interaction = “consec”) But @whuber’s comment does apply in a case as simple as this one. Or you may prefer ...
Russ Lenth's user avatar
5 votes
Accepted

Units of emmeans output?

As your output says Results are given on the logit (not the response) scale. So to get them on response scale, you need to pass them through inverse of the logit ...
Tim's user avatar
  • 138k
5 votes

Is it preferable to subset data to test specific hypotheses or specify a full model and run contrasts?

This may be an example showing why subsets of the same data give different results and why the assumption of equal variance across covariates matters. Here, group A has much higher dispersion compared ...
dariober's user avatar
  • 4,150
5 votes
Accepted

Confidence interval in logistic regression when probability of success is 1

Well, this is kind of a fact of life for logit models. A probability of 1 comes out as $+\infty$ on the logit scale, and it's pretty hard to construct a confidence interval around that. If you regrid ...
Russ Lenth's user avatar
5 votes
Accepted

Is it appropriate to present predicted probabilities from emmeans for a mixed-effects binomial logistic regression?

Some quick partial answers... The statistics, estimates, SEs, etc. produced by emmeans are based on the model. If the model appropriately accounts for ID effects, ...
Russ Lenth's user avatar
4 votes
Accepted

Pairwise comparison of interactions (factor*numerical variable)

I'm not sure you understand the implications of the model you fitted. Since X is a quantitative predictor and Fact is a factor, ...
Russ Lenth's user avatar
4 votes
Accepted

Post hoc for a specific variable part of an interaction, linear mixed model, r

Presumably, the model includes an interaction between A and B because those factors actually do interact. That means that the ...
Russ Lenth's user avatar
4 votes

Why the degree of freedom is NA ? And why the p value is calculated when the df is NA?

NA is just a code that no degrees of freedom are needed. The tests and CIs are based on the standard normal rather than the t distribution. Note that the headings say z rather than t
Russ Lenth's user avatar
4 votes
Accepted

Why are p-values in clinical trials often based off of LSmeans

There are a few simple reasons to report LS means or EM means and their related statistics. In cases of unbalanced designs, the EM means themselves may not equal the arithmetic means, and EM means ...
Sal Mangiafico's user avatar
4 votes

emmeans pairwise contrasts result in same output values for all?

You have fitted an additive model - the fixed-effects part is condition + location. Therefore you have in fact specified that the differences for one factor are ...
Russ Lenth's user avatar

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