An R package for obtaining least-squares means for many linear, generalized linear, and mixed models. Compute contrasts or linear functions of least-squares means, and comparisons of slopes. Plots and compact letter displays.
Questions tagged [lsmeans]
111 questions
1
vote
1 answer
Significant interaction in linear mixed effect model but plot shows overlapping confidence intervals?
I try to show you as much as possible of the structure of the data and the results I produced.
The structure of the data is the following:
GroupID Person Factor2 Factor1 Rating
1 2 109 2 …

ljbotzet
- 13
- 5
1
vote
0 answers
Make lsmeans work when called inside a function with a nb.glm object
I need to make a function (fit.function) that calls lsmeans with different formulas and data based on a negative binomial model fit from MASS (nb.glm).
I get the following error when I try to call lsmeans inside the function:
Error in…

faustovrz
- 71
- 4
1
vote
0 answers
Estimating Means and Confidence Intervals using lme4
I am running a mixed model logistic regression in R using lme4::glmer(). It is a model with four categorical variables. Each variable is effects coded (-1, 1). There are random effects for both participant and stimulus (coded as "actor"). I have…

David Johnson
- 439
- 1
- 3
- 13
1
vote
1 answer
lsmeans::lsmip: how to plot continuous values correctly?
The lsmip() command in the lsmeans package seems to treat continuous predictors on the x-axis as categorical predictors.
If I have observations from my continuous predictors at discrete but uneven intervals, (such as when you remove the 0.2 level…

emudrak
- 789
- 8
- 25
1
vote
0 answers
How to Interpret binomial GLMM results
I have a large dataset (24765 obs)
I am trying to look at how does cleaning method effect emergence success(ES).
I have several factors: beach(4 levels), cleaning method(3 levels) -->fixed
I also have a few random variables: Zone (128…

Megan
- 21
- 1
- 7
1
vote
1 answer
Evaluating pairwise comparisons of nested effects
I have a model which I'm attempting to investigate some pairwise comparisons of nested effects. I'm not sure if I've written the model correctly, and I'm not understanding how to actually evaluate the nested term.
My data frame has one response…

Conor Neilson
- 1,026
- 1
- 11
- 27
1
vote
2 answers
How to extract the confidence limits of LSMEANS?
I am using the oranges data provided with lsmeans.
library(lsmeans)
oranges.rg1<-lm(sales1 ~ price1 + price2 + day + store, data = oranges)
days.lsm <- lsmeans(oranges.rg1, "day")
days_contr.lsm <- contrast(days.lsm, "trt.vs.ctrl", ref = c(5,6)) …

tmalves
- 65
- 6
1
vote
1 answer
Planned Contrasts using Multcomp in R
I have an analysis i'd like to perform and I have planned out contrasts (not posthoc comparisons!) I would like to make between treatment groups. The treatment group variable has (k =) 4 levels. I plan to make a total of 3 different comparisons, and…

RNB
- 457
- 1
- 5
- 14
1
vote
1 answer
How to change the legend title and position in a lattice plot
I'm using lsmip from lsmeans to plot my model,
library(lsmeans)
PhWs1 <- lsmip(GausNugget1, Photoperiod:Ws ~ Month,
ylab = "Observed log(number of leaves)", xlab = "Month",
main = "Interaction between Photoperiod…

Luisa
- 35
- 2
- 12
1
vote
0 answers
Estimate degrees of freedom in linear mixed model contrasts on large datasets using R
I have a large dataset that I have been analysing using a linear mixed model (~600000 observations). Usually, I estimate the least-square means and do pairwise contrasts using the lsmeans from lsmeans package. I also use the estimates of the degrees…

BrunoCAfonso
- 43
- 5
1
vote
1 answer
How to show number of means +/- SE?
I wanted to show the means and standard error with numbers, in the form of Mean +/- SE on top of each bar. Please help! Thank you.
[![enter image description here][1]][1]
Here is the code I used but didn't give what I needed.…

Little Bee
- 1,175
- 2
- 13
- 22
0
votes
0 answers
What's the meaning of all indexes in a single treatment?
For the first time, a GLMM model has strange behaviour in the marginal means. I find:
lsm.mTGCp.temp <- lsmeans(mTGCp, c("temperatura"), type="response")
cld(lsm.mTGCp.temp, Letters=letters, decreasing = TRUE)
What's the meaning of abcdef? Thanks…

Leprechault
- 1,531
- 12
- 28
0
votes
1 answer
dwplot() for lsmeans in R
I would like to plot the output from more than one regression.
MWE:
df <- data.frame(
y1 = runif(100),
y2 = runif(100),
x = c(rep("A",times=50), rep("B",times=50))
)
If I want to plot the intercept and coefficients, I can use dwplot():
m0 <-…

jkortner
- 549
- 2
- 8
- 23
0
votes
0 answers
How to calculate lsmeans from a glm model with family=binomial?
I would like to calculate adjusted means from a glm model with family = binomial.
This is my script:
data$Phenotype<- as.factor(data$Phenotype)
data$Batch<- as.factor(data$Batch)
data$Tray<- as.factor(data$Tray)
data$Genotype<-…

user21260341
- 1
- 1
0
votes
0 answers
post hoc analysis for interaction effect in glmer
I'm trying to build a model for identifying effects of question types and proficiency levels on giving a correct answer.
my data looks like this.
> head(logistic_df, 20)
ID proficiency q_types answer
1 1 B2 +def,+spec 1
2 1 …

Berk Gürdamar
- 1
- 1