4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
Mean Life Length
0
10
20
30
40
l
l
l
l
l
l
l
l
l
l
l
l
140
139
139
140
139
139
288
24
106
354
44
20
418
N
absent  
present  
Missing  
no edema  
edema, no diuretic therapy  
edema despite diuretic therapy  
[26.3,46.0) 
[46.0,55.5) 
[55.5,78.4] 
[1.96,3.36) 
[3.36,3.69) 
[3.69,4.64] 
Age  
Albumin  [gm/dl]  
ascites  
edema  
Overall  
l
l
l
l
l
l
l
l
l
l
l
l
l
l
D−penicillamine
placebo
not randomized
Figure 3:
Estimated mean life length from an exponential survival model
21
Best website to convert pdf to word online - application control utility:C# PDF Convert to HTML SDK: Convert PDF to html files in C#.net, ASP.NET MVC, WinForms, WPF application
How to Convert PDF to HTML Webpage with C# PDF Conversion SDK
www.rasteredge.com
Best website to convert pdf to word online - application control utility:VB.NET PDF Convert to HTML SDK: Convert PDF to html files in vb.net, ASP.NET MVC, WinForms, WPF application
PDF to HTML Webpage Converter SDK for VB.NET PDF to HTML Conversion
www.rasteredge.com
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
age.groups ← cut2(age, c(45,60))
g ← function(y) apply(y, 2, quantile, c(.25,.5,.75))
y ← cbind(Chol=chol,Bili=bili)
#You can give new column names that are not legal S names
#by enclosing them in quotes, e.g. ’Chol(mg/dl)’=chol
vars ← c(label(chol), label(bili))
label(y) ← paste(vars, collapse=’ and ’)
#Willmakenicecaptionintable
s3 ← summary(y ∼ age.groups + ascites, fun=g)
s3
setpdf(f3, h=5, w=6.5)
par(mfrow=c(1,2), oma=c(3,0,3,0))
#allow outer margins for overall
for(ivar in 1:2) {
#title
isub ← (1:3)+(ivar-1)*3
# *3=number of quantiles/var.
plot(s3, which=isub, main=’’, xlab=vars[ivar],
pch=c(91,16,93))
#[, solid circle, ]
}
mtitle(paste(’Quartiles of’, label(y)))
#Overall (outer) title
dev.off()
w ← latex(s3, trios=vars, ctable=TRUE)
# trios → collapse 3 quartiles
Table6 is shown as a graphic in Figure4.
Tables7 and8 summarizes only bilirubin, but both the mean and median
are printed. Separate tables are made for the two arms of the randomized
study. For the active arm, the data are shown in Figure5.
#Example 4: Summarize only bilirubin, but do it with two statistics:
#themean and the median. Make separatetables for the two randomized
#groups and make plots for the active arm.
g ← function(y) c(Mean=mean(y), Median=median(y))
for(sub in c("D-penicillamine", "placebo")) {
s4 ← summary(bili ∼ age.groups + ascites + chol, fun=g,
22
application control utility:VB.NET PDF Convert to Images SDK: Convert PDF to png, gif images
Best adobe PDF to image converter SDK for Visual Our website offers PDF to Raster Images Conversion Control for VB from local file or stream and convert it into
www.rasteredge.com
application control utility:C# TIFF: C#.NET Code to Create Online TIFF Document Viewer
TIFF file viewer that will suit you best, with which Create an ASP.NET website in Visual Studio 2005 or RasterEdge Image, PDF and Word Web Viewers. Besides TIFF
www.rasteredge.com
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
Cholesterol 
200
300
400
[
[
[
[
[
[
97
135
52
263
21
284
N
absent  
present  
[26.3,45.0) 
[45.0,60.0) 
[60.0,78.4] 
Age  
ascites  
Overall  
l
l
l
l
l
l
]
]
]
]
]
]
Serum Bilirubin 
5
10
15
[
[
[
[
[
[
97
135
52
263
21
284
N
absent  
present  
[26.3,45.0) 
[45.0,60.0) 
[60.0,78.4] 
Age  
ascites  
Overall  
l
l
l
l
l
l
]
]
]
]
]
]
Quartiles of Cholesterol  and Serum Bilirubin 
28Jan03
Figure 4:
Quartiles of cholesterol and bilirubin
23
application control utility:C#: How to Add HTML5 Document Viewer Control to Your Web Page
may easily test all the best-in-class Create a new website or open your existing one save")); _tabFile.addCommand(new RECommand("convert")); _tabFile.addCommand
www.rasteredge.com
application control utility:C# Word: How to Create Word Online Viewer in C# Application
SDK & web viewer add-on are the best choice for TIFF web viewer creating, you can go to PDF Web Viewer Create a website project in Visual Studio 2005 or later
www.rasteredge.com
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
Table 6:
Cholesterol and
Serum
Bilirubin
N=284, 134 Missing
N
Cholesterol
Serum Bilirubin
Age
[26.3,45.0)
97
260.0
325.0
456
0.7
1.50
3.40
[45.0,60.0) 135
257.0
300.0
374
0.8
1.30
3.45
[60.0,78.4]
52
229.5
291.0
413
0.9
1.75
4.12
ascites
absent
263
253.0
315.0
406
0.8
1.30
3.25
present
21
200.0
261.0
344
2.5
7.10
17.10
Overall
284
249.5
309.5
400
0.8
1.40
3.50
a
b
c
represent the lower quartile a, the median b, and the
upper quartile c.
subset=drug==sub)
cat(’\n’,sub,’\n\n’)
print(s4)
if(sub==’D-penicillamine’) {
setpdf(f4, h=4.5)
plot(s4, which=1:2, pch=c(16,1), subtitles=F, main=’’,
#1=mean,2=median
xlab=label(bili))
#Figure5
dev.off()
}
w ← latex(s4, append=sub==’placebo’, ctable=TRUE, size=’scriptsize’,
label=if(sub==’placebo’) ’s4b’ else ’s4a’,
caption=paste(label(bili),’ {\\em (’,sub,’)}’, sep=’’))
#Notesymbolic labels for tables for two subsets: s4a, s4b
}
24
application control utility:VB.NET Image: VB.NET Web Image Viewer Installation and Integration
2. Using Visual Studio to create a website project with VB.NET programming language. If you want to get more details on sample (PDF) Web Doc Image Viewer
www.rasteredge.com
application control utility:VB.NET TIFF: An Easy VB.NET Solution to Delete or Remove TIFF File
appreciate your online user guide." Best regards, Charles the software I need on your website." Yours, Susan & profession imaging controls, PDF document, image
www.rasteredge.com
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
Table 7:
Serum
Bilirubin (D-
penicillamine)
N=154
N
Mean
Median
Age
[26.3,45.0)
58
3.43
1.30
[45.0,60.0)
76
4.09
1.30
[60.0,78.4]
20
2.61
1.20
ascites
absent
144
3.09
1.30
present
10
11.66
14.90
Cholesterol
mg/dl
[120, 255)
36
3.13
0.75
[255, 304)
36
1.54
0.85
[304, 383)
36
2.91
1.30
[383,1775]
36
6.96
4.05
Missing
10
3.89
1.25
Overall
154
3.65
1.30
Table
8:
Serum
Bilirubin
(placebo)
N=158
N
Mean
Median
Age
[26.3,45.0)
48
2.63
1.75
[45.0,60.0)
73
2.70
1.10
[60.0,78.4]
37
3.54
2.00
ascites
absent
144
2.43
1.30
present
14
7.41
6.50
Cholesterol
mg/dl
[127, 248)
35
2.45
1.10
[248, 316)
35
1.55
1.10
[316, 420)
35
2.75
2.00
[420,1712]
35
4.89
3.20
Missing
18
2.59
1.15
Overall
158
2.87
1.40
25
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
Serum Bilirubin 
2
4
6
8
10
12
14
l
l
l
l
l
l
l
l
l
l
l
58
76
20
144
10
36
36
36
36
10
154
N
absent  
present  
Missing  
[26.3,45.0) 
[45.0,60.0) 
[60.0,78.4] 
[120, 255) 
[255, 304) 
[304, 383) 
[383,1775] 
Age  
ascites  
Cholesterol  [mg/dl]  
Overall  
l
l
l
l
l
l
l
l
l
l
l
Figure 5:
Mean(solidcircle) andmedian(open circle)bilirubin forD–penicillamine
patients
26
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
4.2 Baseline Characteristic Tables
Here the S
summary
function is used with the parameter
method=’reverse’
,
which reverses the role of the dependent variable and the independent vari-
ables. The dependent variable is assumed to be categorical; in clinical trials
it will be the treatment assignment.
The next example again uses the primary biliary cirrhosis dataset. The
result is in Table9. It is printed in landscape mode using the L
A
T
E
X
lscape
package, and using the LAT
E
X
small
font. For
’reverse’
-type tables, an
option
test=TRUE
will cause
summary.formula
to compute test statistics for
testing across columns. Default tests are Wilcoxon or Kruskal-Wallis for
continuous variables and Pearson χ
2
for categorical ones, but users may
specify their own statistical tests
6
.
#Now consider examples in ’reverse’format, where thelone dependent
#variable tells the summary function how to stratify all the ’independent’
#variables. This is typically used to make tables comparing baseline
#variables by treatment group, for example.
label(stage) ← ’Histologic Stage\nLudwig Criteria’
#split into 2 lines
s5 ← summary(drug ∼ bili + albumin + stage + protime + sex + age + spiders,
method=’reverse’, test=TRUE)
#To summarize all variables, use summary(drug ∼., data=pbc)
options(digits=1)
print(s5, npct=’both’)
#npct=’both’ : print both numerators and denominators
options(digits=3)
w ← latex(s5, npct=’both’, npct.size=’normalsize’,
size=’small’, ctable=TRUE)
#creates s5.tex using normalsizefont for numerator and
#denominator of percents
#Specify prtest=’P’ to just print P-values, prtest=’stat’to just
#print test statistics
6
In randomized trials, tests for baseline imbalance are unwarranted and difficult to in-
terpret,in addition tocausingmultiple comparison problems (see Stephen Senn, Statistical
Issues in Drug Development).
27
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
setpdf(f5a, h=7, pointsize=14)
plot(s5, which=’categorical’)
#Figure6
Key(.72,.65)
dev.off()
setpdf(f5b, h=7, pointsize=16)
#Use box-percentile plot option
plot(s5, which=’continuous’, conType=’bp’)
#Figure7
dev.off()
28
Table9:DescriptiveStatisticsbydrug
N
D-penicillamine
placebo
notrandomized
TestStatistic
N=154
N=158
N=106
SerumBilirubin
mg/dl
418
0.7251.3003.600
0.8001.4003.200
0.7251.4003.075
1F2,415=0.03,P=0.972
Albumin
gm/dl
418
3.343.543.78
3.213.563.83
3.123.473.72
1F2,415=2.13,P=0.12
HistologicStageLudwigCriteria:1
412
3%
4
154
8%
12
158
5%
5
100
2χ6
2
21%
32
154
22%
35
158
25%
25
100
3
42%
64
154
35%
56
158
35%
35
100
4
35%
54
154
35%
55
158
35%
35
100
ProthrombinTime
sec.
416
10.010.611.4
10.010.611.0
10.110.611.0
1F2,413=0.23,P=0.795
sex:female
418
190%
154
187%
158
92%
98
106
2χ2
Age
418
41.448.155.8
43.051.958.9
46.053.061.0
1F2,415=6.1,P=0.00245
spiders
312
29%
45
154
28%
45
158
2χ1
abcrepresentthelowerquartilea,themedianb,andtheupperquartilecforcontinuousvariables.Nisthenumberofnon–missing
values.
1Testsused:Kruskal-Wallistest;Pearsontest
4 MAKING S COMPOSE LAT
E
XTABLES
The EXAMPLE Study
Protocolxyz–001
February 4, 2003
To convert Table9 to graphical form,
plot.summary.formula.reverse
con-
structs two pages. The first page contains statistics for all of the categorical
variables, as all of these statistics are on the same scale (proportion or per-
cent in each category). The second page contains a matrix of dot charts
showing (by default) the 3 quartiles of each right–hand–side variable (on
the x–axis), stratified by the left–hand variable (on the y–axis of each dot
plot). The second set of plots is scaled to the most extreme 0.025 to 0.975
quantiles of the variable over all treatment groups. R can plot Greek letters,
superscripts, subscripts, and mathematical operators, and Figure 6 and7
take advantage of this capability. S-Plus does not have this capability, so
simpler output would appear.
Table10 presents a description of data from a trial for prostate cancer (from
Byar and Green). The
prostate
data frame is available fromhesweb1.med.
virginia.edu/biostat/s/data.The
overall
option is used to add a final
column of statistics for the whole sample. The following listing contains
code that produced all the tables and figures for the
prostate
data. This is
agood application of the L
A
T
E
X
relsize
style. Specifying an overall size of
the table of
smaller[3]
causes
latex()
to issue the command \smaller[3]
at thestart of the table and changes theoveralltable’s font size tothree levels
below
normalsize
,which is L
A
T
E
X’s
scriptsize
. Specifying
outer.size
and
Nsize
as
smaller
means to use one size smaller than this within the table,
for 25
th
and 75
th
percentiles and for the sample sizes above the columns.
One advantage of
relsize
is that if you use for example {\smaller foo}
within a footnote, the next smaller size thanis used for the overall footnoted
text will be the size for
foo
.
#Consider another dataset
library(Hmisc)
getHdata(prostate)
#Variables in prostate had units in ( ) inside variable labels. Move
#these units of measurements to separate units attributes
#wt is an exception. It has ( ) in its label but this does not denote units
#Also make hg have a legal R plotmath expression
prostate ← upData(prostate, moveUnits=TRUE,
units=c(wt=’’, hg=’g/100*ml’),
labels=c(wt=’Weight Index = wt(kg)-ht(cm)+200’))
30
Documents you may be interested
Documents you may be interested