I wish to analyze an unbalanced data set with 3 variables Tleaf, Tair, and orientation (factor with two levels). Considering the effect of the factor "orientation", I wish to determine if "Tair" has a significant effect on Tleaf and to determine the estimate of the parameter of Tair (I want to know the slope "a" of Tleaf=a(Tair)+b). Considering that the data set is unbalanced (1400 observations for the first level of the factor "orientation" and 1000 observations for the second level) and considering an interaction between orientation*Tair, here is what I've done with the functions lsmeans() et lstrends() of the package "lsmeans":

a=read.table("data.txt", header=TRUE) 
options(contrasts = c("contr.sum","contr.poly")) 
mod=lm(Tleaf~orientation*Tair, na.action="na.exclude", data=a) 
summary(org.lsm, infer = c(TRUE,TRUE), level = .95, adjust = "bon")

Here are the results of the summary():

orientation = East: 
  Tair      lsmean        SE  df lower.CL upper.CL t.ratio p.value 
 22.28218 24.93279 0.1016984 349 24.73277 25.13281 245.164  <.0001 

orientation = West: 
  Tair      lsmean        SE  df lower.CL upper.CL t.ratio p.value 
 22.28218 24.65817 0.1316022 349 24.39934 24.91701 187.369  <.0001 

Confidence level used: 0.95

I note that Tair has a significant effect on Tleaf (p<0.0001) and the marginal mean of Tleaf is 24.93°C for the level "East" and 24.66°C for the level "West" of the factor "orientation".

Then, I used the function lstrends() to obtain the estimate of the slope of Tleaf=f(Tair):

pente=lstrends (mod, "orientation", var="TairMax") 
orientation TairMax.trend         SE  df  lower.CL  upper.CL 
 East            0.8568581 0.02292076 349 0.8117779 0.9019383 
 West            0.9401517 0.03008866 349 0.8809738 0.9993296 

Confidence level used: 0.95

I note that the parameter "a" of Tleaf=a*Tair+b is 0.86 (East) and 0.94 (West).

Here are my questions:

1) Is it right to determine the significativity of the variable Tair with lsmeans() and than determine the slope with lstrends?

2) Wouldn't it be possible to obtain the significativity of Tair and the slope estimate of its parameter at the same time? (to save time, code, etc.)

3) Is there any mistake in my understanding of the outputs?

Thanks. Robin.

  • $\begingroup$ Welcome to our site! Your questions appear to probe a little more deeply into interpreting interactions than our other threads on the subject. However, this site operates in English: could you please translate your post so that our readers can understand it? $\endgroup$ – whuber Oct 14 '14 at 14:40
  • 1
    $\begingroup$ Sorry for the mistake! I translated it! $\endgroup$ – CupOfAppleTea Oct 15 '14 at 11:24

It appears to be OK to my eye to do what you did. So far you have answered two different questions -- one on the least-squares means and one about the trends. So it is appropriate that different calls were needed to produce the results. I will note though that

  1. In the first lsmeans analysis, you asked for a Bonferroni adjustment. However, there is just one mean for each orientation, so no adjustment was made. Do you wish to compare these two means? Easy enough to do - pairs(org.lsm, by = NULL) -- again, just one test, so adjustments will have no effect.
  2. Similarly, do you want to compare the slopes? pairs(pente) will do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.