Tags:
create new tag
, view all tags, tagging instructions
Return to Statistical Graphics Home

Title: Change from Baseline by Baseline: Categorical QTc Analysis


ClinECGVitalsGraphicsForm edit

Image Click on hyperlink to see full graphic.
1 - Baseline QTc Hr 0
2 Baseline QTc Hr 30 min
3 Baseline QTc 1 hr
4 Baseline QTC Hr 2
5 Baseline QTc Hr 3
6 Baseline QTC Hr 4
7 Baseline QTc Hr 6
8 Baseline QTc Hr 9
9 Baseline QTc Hr 12
Title Change from Baseline by Baseline: Categorical QTc Analysis
Graph_Subgroup ECGVitals
ECG_Vitals_Clinical_Question 2. Are there outlier individuals that have large changes or raw values?
Contributor/Email Rich Anziano (richard.j.anziano@pfizer.com)
Max Cherny (Max.2.Cherny@gsk.com)
Background This figure plots the change from baseline by the baseline value and is useful in examination of 'categorical' QTc changes. By plotting the changes against the baseline one can view the changes in the context of the raw QTc values. Large changes toward the left hand side of the plot are most likely due to regression to the mean and a low baseline whereas large changes to the right-hand side of the plot have large raw QTc values as well as large changes and are potentially more worrisome. The plot presented here is produced by hour post dose in a throrough QT design and the 4 hour timepoint was presented as that represented tmax of the experimental drug.
Keywords tqt, categorical qtc, baseline, change from baseline
References http://www.fda.gov/downloads/RegulatoryInformation/Guidances/ucm129357.pdf

Section 3.2.2
Datasets Other
CDISC_Data

Other_Data tQT Dataset and Description
CLASSIFICATIONS

Graph_Type Scatterplot
Variable_Relationship Continuous versus Continuous
Data_Types Continuous
Special_Considerations

Code_Available Yes
Software Program R
Software

R-Code - Attachment Cherny - R code - QTc Graphs
R-Code #Contributed by Max Cherny (email: Max.2.Cherny@gsk.com)

# clear objects
rm(list = ls())

# close graphics windows
graphics.off()

#Need gridExtra for gridtext function
require(gridExtra)

#Read data. Make sure to specify path to the data file
ecg <- read.table("tqt.dat",
header=FALSE, sep=",", na.strings="NA", dec=".", strip.white=TRUE)


#create x, y, group and page variables
ecg$tpd<-ecg$V3
ecg$y<-ecg$V20
ecg$x<-ecg$V8

#create numeric code variables for group
ecg$groupcd<-as.numeric(ecg$V22)
#create labels for groups
ecg$group<- factor(ecg$groupcd, labels = c("Exp Low Dose", "Exp High Dose", "Placebo", "Moxifloxacin") )
#create short labels for groups
ecg$groupt<- factor(ecg$groupcd, labels = c("l", "h", "p", "m") )
#keep only the required variables in dataset
ecg<-ecg[c("x", "y", "groupcd", "tpd", "group", "groupt" )]

#remove any records with missing data
ecg<-na.omit(ecg)

#check the ranges for x and y
range(ecg$x,na.rm=TRUE)
range(ecg$y,na.rm=TRUE)

#create dataset containing unique TPD records
unique_ecgs<-subset(ecg, duplicated(tpd))

#create variable representing row number for tpd variable. The counter will be used to create a graph per single page
for (i in 1:nrow(unique_ecgs)) {
unique_ecgs$tpdcd[i]=i
}
unique_ecgs<-unique_ecgs[,c('tpd', 'tpdcd')]
#add tpd counter to ECG dataset
ecg<-merge(ecg, unique_ecgs, by=c("tpd"), sort=T, all.y=T)

#determine number of pages
number_of_pages<- as.numeric(max(unique(ecg$tpdcd)))

#determine number of treatments
number_of_trt<- max(ecg$groupcd,na.rm=TRUE)

# PDF file name. Add file path here
somePDFPath = "ecg_vitals_G02.pdf"

#direct output to PDF
pdf(file=somePDFPath, paper='A4r', width=15, height=8)

#set up margins
par(new=T, par(mar=c(12,5,11,1)))

#set up colors for each treatment
colors<-c("cyan", "blue","red","black")

#set up symbols for each treatment
plotchar <-c(76,72,80,77) #77-M 76-L 72-H 80-P

#plotchar <-c(108,104,112,109) #109 produces m as symbol, 108-l, 104 -h, 112-p. This code may be used for lower case letter symbols

#Start a loop to create a graph per page
for (ii in 1:number_of_pages)
{

#create a temporary dataset for per (i.e. the timepoint)
ecg_temp1 <- subset(ecg, tpdcd==ii )

#create empty plot. The points will be added later
plot( ecg_temp1$y~ecg_temp1$x,
ylim = c(-60, 70) , #y-axis scale
type="n", #supress plot
yaxt = "n",
xaxt="n",
xlab="Baseline QTc (milliseconds) - Fridericia Correction",
ylab=" QTc Change (milliseconds) - Fridericia Correction",
xlim = c(350, 460) #x-axis scale
)

#plot points for each treatment
for (i in 1:number_of_trt)
{
#create temporary dataset for the treatment
ecg_temp2 <- subset(ecg_temp1, groupcd==i ) #subset temp dataset

#plot points
points(ecg_temp2$x,
ecg_temp2$y,
cex=0.6, #size of points
col=colors[i], #color of points
pch=plotchar[i] #symbol of points
)
} #end of (i in 1:number_of_trt) loop


#legend
legend("bottom" ,
inset=-0.5, #inset will display the legend below the plot
xpd=T,
as.character(unique(ecg$group)), #text for legend
cex=1,
col=colors,
pch=plotchar,
ncol=4,
title="Treatments:")

#this function is needed to determine the angle of reference line labes
getCurrentAspect <- function() {
uy <- diff(grconvertY(1:2,"user","inches"))
ux <- diff(grconvertX(1:2,"user","inches"))
uy/ux
}
asp <- getCurrentAspect();

#add reference lines
abline (h=0, lty=2)
abline (h=30, lty=2)
abline (h=60, lty=2)

#diagonal reference lines
abline(a=450, b=-1, lty = 2)
text(x=400, y=55, "450 msec", srt=180/pi*atan(-1*asp))

abline(a=480, b=-1, lty = 2)
text(x=430, y=55, "480 msec", srt=180/pi*atan(-1*asp))

abline(a=500, b=-1, lty = 2)
text(x=450, y=55, "500 msec", srt=180/pi*atan(-1*asp))


#display x axis
xaxis_marks <- seq(340,480,by=10)
axis(1, tick=T, at=xaxis_marks,labels = T)

#display y axis
yaxis_marks <- seq(-70,80,by=10)
axis(2, tick=T, at=yaxis_marks, las=2 ) #use las to display horizontal label on Y axis

#add text at fixed positions
grid.text(paste("user_id: ",toupper(format(Sys.time(), "%d%B%Y %H:%M"))), x=0.01, y=0.06,just="left")
grid.text("Protocol: text", x=0.01, y=0.93,just="left")
grid.text("Population: Text", x=0.01, y=0.9,just="left")
grid.text( paste("Page", ii, "of", number_of_pages), x=0.9, y=0.9,just="left")
grid.text(paste("ECG/VITALS G2"), x=0.5, y=0.88)
grid.text("Figure Number", x=0.5, y=0.85)
grid.text("Title2 (Base R)", x=0.5, y=0.82)
grid.text( paste("Hour:", unique(ecg_temp2$tpd)),, x=0.5, y=0.75)
} #end of (ii in 1:number_of_pages) loop


dev.off()
SAS-Code - Attachment

SAS-Code

Stata-Code - Attachment

Stata-Code

Other Code - Attachment

Other Code

Disclaimer The views expressed within CTSpedia are those of the author and must not be taken to represent policy or guidance on the behalf of any organization or institution with which the author is affiliated.
Permission Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT OLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Reference Image 3_Baseline_QTc_hr1_200.png
Topic revision: r8 - 01 May 2013 - 17:52:27 - MaryBanach
 

Copyright & by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CTSPedia? Send feedback