Skip to contents

License

Note that University of Leeds are the copyright holders of the Control of Eating Questionnaire (CoEQ) and the test data included within admiralmetabolic as well as the ADCOEQ code are for not-for-profit use only within admiralmetabolic and pharmaverse-related examples/documentation. Any persons or companies wanting to use the CoEQ should request a license to do so from the following link.

Introduction

This article describes creating a Control of Eating Questionnaire ADaM for clinical trials.

We advise you first consult the admiral Creating Questionnaire ADaMs vignette. The programming workflow around creating the general set-up of an ADQS using admiral functions is the same. In this vignette, we focus on the Control of Eating Questionnaire and avoid repeating information and maintaining the same content in two places. As such, the code in this vignette is not completely executable; we recommend consulting the ADQS template script to view the full workflow.

Note: All examples assume CDISC SDTM and/or ADaM format as input unless otherwise specified.

Required Packages

The examples of this vignette require the following packages.

Programming Workflow

Read in Data

To start, all data frames needed for the creation of the ADaM dataset should be loaded into the global environment. Reading data will usually be a company specific process, however, for the purpose of this vignette, we will use example data from pharmaversesdtm and admiral. We will utilize DM, QS and ADSL.

In this vignette we use example data for the CoEQ. The example QS data (qs_metabolic) is included in the admiralmetabolic package.

dm_metabolic <- admiralmetabolic::dm_metabolic
qs_metabolic <- admiralmetabolic::qs_metabolic
admiral_adsl <- admiral::admiral_adsl

dm <- convert_blanks_to_na(dm_metabolic)
qs <- convert_blanks_to_na(qs_metabolic)
admiral_adsl <- convert_blanks_to_na(admiral_adsl)

Within this vignette, DM is used as the basis for ADSL:

# Retrieve required variables from admiral ADSL for this vignette that are not present in DM dataset
adsl <- dm %>%
  select(-DOMAIN) %>%
  mutate(TRT01P = ARM, TRT01A = ACTARM) %>%
  derive_vars_merged(
    dataset_add = admiral_adsl,
    by_vars = exprs(USUBJID),
    new_vars = exprs(TRTSDT, TRTEDT)
  )

Original Items

The original items, i.e. the answers to the questionnaire questions, can be handled in the same way as in an {admiral} BDS finding ADaM.

adcoeq1 <- qs %>%
  # Add ADSL variables
  derive_vars_merged(
    dataset_add = adsl,
    by_vars = exprs(STUDYID, USUBJID),
    new_vars = exprs(TRTSDT, TRTEDT, TRT01P, TRT01A)
  ) %>%
  # Add analysis parameter variables
  mutate(
    PARAMCD = QSTESTCD,
    PARAM = QSTEST,
    PARCAT1 = QSCAT
  ) %>%
  # Add timing variables
  derive_vars_dt(new_vars_prefix = "A", dtc = QSDTC) %>%
  derive_vars_dy(reference_date = TRTSDT, source_vars = exprs(ADT)) %>%
  mutate(
    AVISIT = if_else(ADT <= TRTSDT, "BASELINE", VISIT),
    AVISITN = if_else(ADT <= TRTSDT, 0, VISITNUM)
  )

The analysis values (AVAL and AVALC) for most original items are set directly from QSSTRESN and QSORRES, respectively. However, CoEQ item 6 (COEQ06) requires a manual transformation, where we invert the original scores. This transformation is performed because CoEQ item 6 is used in calculating the subscale for “Positive Mood,” where its original scores indicate anxiety.

In cases where QSSTRESN values require transformation, it is recommended to keep the original QSSTRESN values in the ADaM dataset for traceability.

adcoeq2 <- adcoeq1 %>%
  # Add analysis value variables
  mutate(
    AVAL = if_else(PARAMCD == "COEQ06", 100 - QSSTRESN, QSSTRESN),
    AVALC = if_else(PARAMCD == "COEQ20", QSORRES, NA_character_)
  )

For deriving visits based on time-windows, see admiral Visit and Period Variables.

Derive the four Subscales

For the Control of Eating Questionnaire, four subscales are derived. These subscales are derived as the sum or the average across a subset of the various items/questions.

The subscales are defined as follows:

  • Craving Control: Calculate average of items 9, 10, 11, 12 and 19.

  • Craving for Sweet: Calculate average of items 3, 13, 14 and 15.

  • Craving for Savoury: Calculate average of items 4, 16, 17 and 18.

  • Positive Mood: Calculate average of items 5, 7, 8 and 6 (reversed).

These parameters can be derived by derive_summary_records():

adcoeq3 <- adcoeq2 %>%
  call_derivation(
    derivation = derive_summary_records,
    variable_params = list(
      params(
        filter_add = PARAMCD %in% c("COEQ09", "COEQ10", "COEQ11", "COEQ12", "COEQ19"),
        set_values_to = exprs(
          AVAL = mean(AVAL, na.rm = TRUE),
          PARAMCD = "COEQCRCO",
          PARAM = "COEQ - Craving Control"
        )
      ),
      params(
        filter_add = PARAMCD %in% c("COEQ03", "COEQ13", "COEQ14", "COEQ15"),
        set_values_to = exprs(
          AVAL = mean(AVAL, na.rm = TRUE),
          PARAMCD = "COEQCRSW",
          PARAM = "COEQ - Craving for Sweet"
        )
      ),
      params(
        filter_add = PARAMCD %in% c("COEQ04", "COEQ16", "COEQ17", "COEQ18"),
        set_values_to = exprs(
          AVAL = mean(AVAL, na.rm = TRUE),
          PARAMCD = "COEQCRSA",
          PARAM = "COEQ - Craving for Savoury"
        )
      ),
      params(
        filter_add = PARAMCD %in% c("COEQ05", "COEQ07", "COEQ08", "COEQ06"),
        set_values_to = exprs(
          AVAL = mean(AVAL, na.rm = TRUE),
          PARAMCD = "COEQPOMO",
          PARAM = "COEQ - Positive Mood"
        )
      )
    ),
    dataset_add = adcoeq2,
    by_vars = exprs(STUDYID, USUBJID, AVISIT, AVISITN, ADT, ADY, PARCAT1, TRTSDT, TRTEDT, TRT01P, TRT01A)
  )

Remaining ADCOEQ Set-up

The admiral Creating Questionnaire ADaMs vignette describes further steps, including, how to calculate the change from baseline variables, and how to add parameters for questionnaire completion.

Example Scripts

ADaM Sample Code
ADCOEQ ad_adcoeq.R