I'm working on a study where I employed an analysis of covariance (Ancova) with unbalanced factors. I used permutation tests to obtain p-values for my estimates since my observation does not come from a random sample of some statistical population. My Ancova was found significant and I wanted to conduct multiple pairwise comparisons (MPC) to observed differences between my factors.

Since my factors are unbalanced, I ran my analysis using least-square means with the function lsmean() from the package {lsmeans} in R 3.1.2.

unb_ancova <- lm(doorw10_sqrt ~ MDS + modularity_cluster, data=df_mandrill)
pairwise.lsm <- lsmeans(unb_ancova, list(pairwise ~ modularity_cluster), 
adjust = c("tukey"))    

This code return a list containing two tables:

Table 1

Table 2

From this point, my first clue was to generate the bootstrapped 95% confidence interval for estimate pairwise differences (table 2, column 2). However, I did not found how to extract this estimate from the lsmeans object. Moreover, i'm not sure this is the right thing to do. Finally, how do I apply tukey p-value adjustment for p-values generated by permutation?

Thanks for the feedback.


1 Answer 1


If you do

pairwise.summ = summary(pairwise.lsm[[2]])

the result is a data.frame which you can use as you please. The command vignette("using-lsmeans") displays a PDF file that has a lot of information and examples on how to use the package and what kinds of objects are produced.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.