Contrasts in R
0
0
Entering edit mode
12 weeks ago
SGMS ▴ 130

Hi everyone,

In R, I want to do exactly what limma package does for "makeContrasts" (I do not have expression data).

I have two factor variables say X (levels=X1,X2) and Y (levels=Y1,Y2). I ran an lme model with an interaction term between X and Y and used the "emmeans" package to get contrasts. The emmeans though return e.g:

contrast      estimate   SE  df t.ratio p.value
 X1 - Y1    -0.141 1.58 180  -0.090  0.9997
 X1 - X2      1.949 1.03 175   1.894  0.2322
 Y1 - Y2    2.239 1.01 175   2.208  0.1228
 X2 - Y2     0.148 1.57 175      0.095  0.9997

What I need now, is the contrast of (Y1-Y2) - (X1-X2). Is this possible using emmeans or in base R? How do I create the contrasts table along with p-values etc?

Any help would be greatly appreciated.

Thanks in advance

contrasts r • 273 views
ADD COMMENT
0
Entering edit mode

have you looked into model.matrix?

ADD REPLY

Login before adding your answer.

Traffic: 2224 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6