# Questions tagged [lsmeans]

Least-Squares means are predictions from a model over a regular grid, possibly averaged over other dimensions. Also use this tag for the R packages emmeans and lsmeans.

132 questions
Filter by
Sorted by
Tagged with
16 views

### Regresion Coeffients and Estimated Marginal Means in Glmm

What is the relationship between regression coefficients for categorical variables and their estimated marginal means?
15 views

### Can I compare emmeans for a linear model at any given value of covariate?

I have the following model: ABC<-lmer(A~Ta+MR+mb+group*Acl + (1|ID), data=groups) where Ta, MR and mb are linear covariates. I want to do a pairwise ...
28 views

### Large standard error when variance equals zero

The function ggemmeans() is producing very large standard errors when the within-group variance equals zero. I'm using ggemmeans() to extract estimated marginal means from a binomial GLM. The GLM ...
36 views

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

Let's say I run the following contrast: ...
31 views

### Can SAS Least Squares Means estimation algorithm be translated for a design matrix in Reference coding?

My question is whether it’s possible to compute lsmeans defined in this SAS algorithm if the design matrix is not in GLM form. In particular, in R, if one feeds that design to model.matrix(), then ...
33 views

### Confusing result from post-hoc analysis using mixed linear model

I am fitting a mixed model: ...
33 views

### Reproducing output from emmeans R package

I'm trying to better understand estimated marginal means for relatively simple linear models. To do so, I'm using the very nice emmeans as a reference but also ...
58 views

### Confusing results from lsmeans and pairwise tests

Experiment: I collected data from N participants, each was shown 50 photos and asked to provide sharing likelihood (dependent ...
55 views

### Standard error in estimated marginal means are all the same

I use the package emmeans to calculate estimated marginal means and I don't know why the standard errors are equal within the factors: ...
81 views

### Marginal means vs. marginal effects. What is the difference?

In R, there are two packages: emmeans and margins. The first implements the LS-means known from SAS, here called estimated marginal means, the second implements the margin command from Stata. I ...
28 views

### Pairwise Comparisons for Rank Based rfit Models in emmeans

I recently found this package: https://journal.r-project.org/archive/2012-2/RJournal_2012-2_Kloke+McKean.pdf. I am utilizing this package for Robust Regression without having to resort to M or MM-...
45 views

### Why do the calculated means in lm() differ from emmeans()?

Let's assume we have the data: ...
20 views

### LSMeans for repeated measures using GLM in SAS

I would like to obtain LSMeans comparisons for the within-subject factors of a repeated measures model using GLM. Here is an example ...
79 views

### Obtaining valid win probabilities from contest data using a binomial model

I conducted an enclosure experiment on lizards where I recorded contest outcome for every male-male combat. We had three morphs of lizards (o, w, y) in each enclosure. I am interested in obtaining ...
9 views

### Why Does emmeans add_grouping average over the levels of the reference factor?

I've implemented a learning technology to reduce the gender gap(the difference between male and female student grades) in CS education. I conducted a quasi-experiment across six semesters, with ~200 ...
46 views

### Slopes with opposing signs provided by two methods

I have come across a situation where I am estimating trends in two different ways and the results have opposite signs. Specifically, the R functions emtrends and <...
41 views

### Differences in LSMEANS in R vs SPSS

I am trying to replicate results from SPSS in R. The model is a repeated measure ANCOVA. Funny enough: all the estimated parameter are the same (beta-coefficients, mean differences for contrasts) but ...
19 views

### Fit one model or several models to maximize power for significance testing of slopes in a factorial design?

Problem I need to perform a power analysis for a set of statistical tests. Each test is about a regression slope computed in a cell of a factorial experiment design. To minimize the required sample ...
31 views

### Pairwise Contrast on relative change emmeans package

So I have it a Generalized Linear Mixed Model and am looking to do contrasts. However, in this case, the biochemically relevant contrast is not a simple difference of differences. It is the difference ...
53 views

### Pairwise comparisons via emmeans

I have a question about emmeans and mixed effect model. I fit a complex model using lmer() with the following variables: A: a binary categorical predictor, between-subject B: a binary categorical ...
217 views

### Why are emmeans package means different than regular means?

I am analyzing a dataset with missing data using the lme4 package for fitting mixed models and calculating fitted means from it using package emmeans. I have a feeling it relates to the missing data ...
75 views

### Are the posthoc results of the Linear Mixed Effect model valid?

I'm running a linear mixed model on a data frame that consists of 3 variables: ID (n=11), region (n=3) and ...
172 views

### Analysis of interaction with multiple levels in each factor (emmeans in mixed model)

I ran an experiment with treatment (3 levels: ctrl, A, B) as a between-subject factor and environment (4 levels: 1, 2, 3, 4) as ...
64 views

### How can I compute a confidence interval on Cohen's d derived from a Tukey HSD contrast?

Question Background Consider for example that I have some data arrayed as a 1-way (Group: A, B, C, D) between groups ANOVA. Consider further that I am interested in all possible pairwise contrasts ...
112 views

### When to correct for multiple comparisons (with specific reference to emmeans in R)?

I notice that emmeans::emmeans() will only correct for multiple comparisons within groups and not between groups. This means that if you perform a series of ...
12 views

### lsmeans diff of a variable involved in an interaction

I have a variable that is a simple 0-1 variable in a class statement. It is also involved in interactions. In the model this class variable is not significant and I understand that I shouldn't ...
45 views

### Z ratio in lsmeans of a glmer

I am running a glmer (1 dependent variable and 2 independent variables (where each independent variable has 3 categories)). I am trying to look at the pairwise differences for the treatments (to see ...
86 views

### Incoherent post hoc pairwise Tukey test using beta binomial distribution and betareg()

I am fitting a beta binomial regression to my data, which is proportion data (lifetime reproductive success ratio) ranging [0,1]. I transformed the 0s and 1s following Smithson and Verkuilen 2006 (y.(...
31 views

### Reporting RESULTS of least square means as post-hoc test for linear mixed model- Best practice

Anybody have good example of how to report the results of a least square means result of a Linear mixed model?- I welcome any guidance on good practices to report this kind of result. I posted below ...
61 views

### On how to interpret paired comparisons for model-adjusted means in GLMM

I have been trying to learn how to obtain the model-adjusted means (or least-square means) from GLMM, and come across some counterintuitive results. Below is the data I am currently using. It's the ...
65 views

### Model simplification

I am currently looking at a linear mixed model of with the formula x ~ y * z I'm struggling with simplifying the model. When I run an ANOVA of my model it said ...
44 views

### R contradiction between lmer and emmeans results

In order to determine how herbivorous fish biomass varies between the two study sites (Waikiki and Hanauma Bay) and experimental shelter treatments (low and high), I used lmer() with a random effect ...
37 views

### Adjustment for multiple comparisons in complex cases

I use the emmeans package for post-hoc pairwise comparisons with different types of models. Standard contrast families are e.g. ...
66 views

### How are contrasts tested when using estimated marginal means?

Forgive me for this, but I just can't work it out. Some dummy data : ...
224 views

### interactions involving two continuous predictors with emtrends

Let's say I have a model with two continuous predictors (nitrogen and temperature) and one categorical variable (variety). <...
48 views

### Why are the confidence intervals so large for the difference of differences?

I have run a generalized linear mixed effects model with the glmmTMB package to determine if there is an interaction between two categorical predictors, treatment and location, in predicting the ...
232 views

### Units of emmeans output?

I have values of relative humidity on a scale of 0 to 1 (e.g., 0.9 = 90% RH). I also have two cities (A or B). My model is as follows: ...
158 views

### How to address a detected nesting structure using emmeans

I'm analysing the results of a M BACI experiment. When trying to estimate means using emmeans, I'm getting this message: NOTE: A nesting structure was detected in the fitted model: BurnType %...
42 views

my data: ...
27 views

### Why are my emmeans SE so large, but pairwise comparison SE are modest?

I constructed a glm logistic regression model for a binary response with two categorical predictors. I am calculating the emmeans for one of the two predictors, ...
217 views

### Understanding cov.reduce argument in emmeans function

I would appreciate any help regarding emmeans package. I am fitting dummy-variable regression model (ANCOVA) with follow-up post hoc test in ...
65 views

### Using pairwise comparision on gls object [closed]

I have one factor (tree genotype) and I analyse its influence on soil content. I used gls to aply weights on my data because it's a better fitted model. Here is an exemple of my data with one ...
73 views

### Which emmeans to choose between full and main effect mixed effect models with heteroscedasticity corrected

I have a split splot full factorial design : 3 blocks, each block contains 4 plots for factor E and each plot is divided into 3 subplots for factor F. I use a mixed effect model with random effects on ...
103 views

### How to interpret Emmeans results

I have used the emmeans() package to calculated the difference between the difference of estimated marginal means. I did this by first calculating the EMMs of location|treatment, and then the ...
158 views

### Getting marginal means for ANCOVA in R (effect vs emmeans)

I'm a bit new to running GLM models in R, so forgive me is this is a silly question. Context: I'm running an ANCOVA with the goal to control for multiple covariates while understanding the ...
564 views

### Is it appropriate to use estimated marginal means when model estimates are not significant but data is unbalanced?

Is it appropriate to use estimated marginal means when estimates (either interaction or main effects) are not significant but the data is unbalanced? I've come across variations of this question on ...
1k views

### How to calculate Tukey-adjusted p-values for emmeans pairwise comparisons?

I would like to calculate Tukey-adjusted p-values for emmeans pairwise comparisons. I know that these can be obtained directly with functions like pairs() and CLD(). However, when there are three ...
211 views

### Using emmeans with clmm to look at joint effects

I am running an ordinal model on rating data, with 1 random effect (subject) and 2 fixed effects (condition with 3 levels, probe.position with 6). I use the clmm function from the ordinal package. I ...