First, we fit a MMRM model.
library(mmrm)
library(emmeans)
fit <- mmrm(
formula = FEV1 ~ RACE + SEX + ARMCD * AVISIT + us(AVISIT | USUBJID),
reml = TRUE, method = "Kenward-Roger", vcov = "Kenward-Roger-Linear",
data = fev_data
)
summary(fit)
And then compute the least-square means with corresponding CI.
ems <- emmeans(fit, ~ ARMCD | AVISIT)
confint(ems)
Suppose we want to answer the question that the null hypothesis is that treatment minus placebo equals zero. The contrast can be created below.
contr <- contrast(ems, adjust = "none", method = "pairwise")
contr
Suppose we would like to test the hypothesis that treatment is superior to placebo with a margin of 2.
test(contr, null = 2, side = ">")
proc mixed data=fev_data;
class ARMCD(ref='PBO') AVISIT RACE SEX USUBJID;
model FEV1 = RACE SEX ARMCD ARMCD*AVISIT / ddfm=KR;
repeated AVISIT / subject=USUBJID type=UN r rcorr;
lsmeans ARMCD*AVISIT / cl alpha=0.05 diff slice=AVISIT;
lsmeans ARMCD / cl alpha=0.05 diff;
lsmestimate ARMCD*AVISIT [1,1 4] [-1,2 4] / cl upper alpha=0.025 testvalue=2;
ods output lsmeans=lsm diffs=diff LSMEstimates=est;
run;
First, we fit a MMRM model.
library(mmrm)
library(emmeans)
fit <- mmrm(
formula = FEV1 ~ RACE + SEX + ARMCD * AVISIT + us(AVISIT | USUBJID),
reml = TRUE, method = "Kenward-Roger", vcov = "Kenward-Roger-Linear",
data = fev_data
)
summary(fit)
And then compute the least-square means with corresponding CI.
ems <- emmeans(fit, ~ ARMCD | AVISIT)
confint(ems)
Suppose we want to answer the question that the null hypothesis is that treatment minus placebo equals zero. The contrast can be created below.
contr <- contrast(ems, adjust = "none", method = "pairwise")
contr
Suppose we would like to test the hypothesis that treatment is superior to placebo with a margin of 2.
test(contr, null = 2, side = ">")
proc mixed data=fev_data;
run;