knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

bcmixed

The bcmixed package provides two categories of important functions: bcmarg and bcmmrm. The bcmarg function provides inferences on the marginal model of the mixed effect model with the Box-Cox transformation and the bcmmrm function provides inferences on the model median differences between treatment groups for longitudinal randomized clinical trials. These statistical methods are proposed by Maruo et al. (2017).

Installation

You can install the released version of bcmixed from CRAN with:

install.packages("bcmixed")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("kzkzmr/bcmixed")

Example

This is a basic example which shows you how to solve a common problem:

library(bcmixed)
data(aidscd4)
# Marginal model of mixed model with the Box-Cox transformation
res1 <- bcmarg(cd4 ~ as.factor(treatment) * as.factor(weekc) + age,
       data = aidscd4, time = weekc, id = id)
summary(res1)

# Box-Cox transformation for the baseline
lmd.bl <- bcmarg(cd4.bl ~ 1, data = aidscd4[aidscd4$weekc == 8, ])$lambda
aidscd4$cd4.bl.tr <- bct(aidscd4$cd4.bl, lmd.bl)

# Inference on model median differences between groups at each time point
res2 <- bcmmrm(outcome = cd4, group = treatment, data = aidscd4, time = weekc,
       id = id, covv = c("cd4.bl.tr", "sex"), cfactor = c(0, 1),
       glabel = c("Zid/Did", "Zid+Zal", "Zid+Did", "Zid+Did+Nev"))

# Summarize
print(res2)

summary(res2)

plot(res2, ylab = "CD4+1", xlab = "Week", verbose = TRUE)


kzkzmr/bcmixed documentation built on Oct. 18, 2023, 10:32 p.m.