pgx.endpoints: Derive pharmacogenetic (PGx) safety endpoints from...

Description Usage Arguments Details Value Author(s) Examples

View source: R/pgx.R

Description

Function to derive safety endpoints for continuous, ordinal, binary, and time-to-event analyses, from longitudinal data typical of a clinical trial.

Usage

1
2
3
4
5
pgx.endpoints(d, measure, exposure,
           mtime, mvalue, threshval,
           msign = c("greater", "less"), mstrict = c(TRUE, FALSE), 
           estart = "exstdtR", eend = "exendtR",
           dby = NULL, subjid = "USUBJID")

Arguments

d

A data frame containing subject identifiers, and an optional stratifying variable

measure

A data frame containing time series trait measurements

exposure

A data frame containing therapy exposure records

mtime

Name of the variable in measure that describes time of measurement

mvalue

Name of the variable in measure that describes value of measurement

threshval

Critical value, for defining events for “sufficient exposure” to treatment and for survival analysis

msign

Indicator how mvalue is to be compared to threshval

mstrict

Indicator how mvalue is to be compared to threshval

estart

Name of the variable in exposure that describes exposure start time

eend

Name of the variable in exposure that describes exposure end time

dby

Name of the variable in d to stratify on for computing median exposure times

subjid

Name of the variable in d, measure, and exposure, that identifies individual subjects

Details

This function derives safety endpoint variables that can be used for continuous, ordinal, binary, and time-to-event analyses, from clinical trial data consisting of: (i) time series trait measurements, typically indicating the presence or severity of symptoms for the safety event; and (ii) therapy exposure records.

TO DO: Allow elapsed time, cumulative dose

Value

A data frame of derived variables.

Author(s)

Toby Johnson Toby.x.Johnson@gsk.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
library(survival)
data(clinex) # like plain text export of SAS files from CDER/CDISC
             # compliant data
## format dates for R
clinex$LAB <- within(clinex$LAB, {
  lbdtR <- as.Date(LBDT, "%d%b%Y")                
  grade <- grade(LBSTRESN, c(1, 5, 10), strict = TRUE)
})
clinex$EXPOSURE <- within(clinex$EXPOSURE, {
  exstdtR <- as.Date(EXSTDT, "%d%b%Y")                
  exendtR <- as.Date(EXENDT, "%d%b%Y")                
})

pgx <- clinex$DEMO
pgx <- merge(pgx,
             pgx.endpoints(clinex$DEMO, clinex$LAB, clinex$EXPOSURE,
                        mtime = "lbdtR", mvalue = "LBSTRESN", threshval = 5,
                        msign = "greater", mstrict = TRUE))
pgx <- merge(pgx,
             pgx.endpoints(clinex$DEMO, clinex$LAB, clinex$EXPOSURE,
                        mtime = "lbdtR", mvalue = "grade", threshval = 2,
                        msign = "greater", mstrict = FALSE))
pgx <- within(pgx, {
  LBSTRESN.binary <- ifelse(!LBSTRESN.exposed, NA, 
                            ifelse(LBSTRESN.event == 1, 1,
                                   ifelse(LBSTRESN.max <= 1, 0, NA)))
  ATRTGRP <- as.factor(ATRTGRP)
})

summary(lm(LBSTRESN.max ~ ATRTGRP, data = pgx, subset = LBSTRESN.exposed))
summary(glm(LBSTRESN.binary ~ ATRTGRP, family = binomial, data = pgx))
summary(coxph(Surv(LBSTRESN.time, LBSTRESN.event) ~ ATRTGRP, data = pgx))

tobyjohnson/gtx documentation built on Aug. 30, 2019, 8:07 p.m.