inst/doc/introduction.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----echo=FALSE---------------------------------------------------------------
library(knitr)
output <- data.frame(
  A1 = c("100 (20)", "50 (30)"),
  B1 = c("90 (35)", "40 (15)"),
  "..." = c("", "")
)
row.names(output) <- c("M", "F")
kable(output, align = "c")

## -----------------------------------------------------------------------------
library(tern.mmrm)
data(mmrm_test_data)
head(mmrm_test_data)

## ----message=FALSE, results="hide"--------------------------------------------
mmrm_results <- fit_mmrm(
  vars = list(
    response = "FEV1",
    covariates = c("RACE", "SEX", "FEV1_BL"),
    id = "USUBJID",
    arm = "ARMCD",
    visit = "AVISIT"
  ),
  data = mmrm_test_data,
  cor_struct = "unstructured",
  weights_emmeans = "proportional"
)

## -----------------------------------------------------------------------------
mmrm_results$lsmeans$contrasts

## ----eval=FALSE---------------------------------------------------------------
#  library(mmrm)
#  library(emmeans)
#  
#  fit <- lmer(
#    formula = FEV1 ~ RACE + SEX + FEV1_BL + ARMCD * AVISIT + us(AVISIT | USUBJID),
#    data = mmrm_test_data
#  )
#  emmeans::emmeans(fit, pairwise ~ ARMCD | AVISIT, weights = "proportional")

## ----eval=F-------------------------------------------------------------------
#  mmrm_results$diagnostics

Try the tern.mmrm package in your browser

Any scripts or data that you put into this service are public.

tern.mmrm documentation built on June 22, 2024, 9:38 a.m.